OSDN Git Service

Fix 1909891. Allow keep() to be called without open().
authorChih-Chung Chang <chihchung@google.com>
Thu, 11 Jun 2009 06:27:57 +0000 (14:27 +0800)
committerChih-Chung Chang <chihchung@google.com>
Thu, 11 Jun 2009 06:28:30 +0000 (14:28 +0800)
src/com/android/camera/CameraHolder.java

index 09b6b55..b85aefb 100644 (file)
@@ -97,7 +97,10 @@ public class CameraHolder {
     }
 
     public synchronized void keep() {
-        Assert(users == 1);
+        // We allow (users == 0) for the convenience of the calling activity.
+        // The activity may not have a chance to call open() before the user
+        // choose the menu item to switch to another activity.
+        Assert(users == 1 || users == 0);
         // Keep the camera instance for 3 seconds.
         keepBeforeTime = System.currentTimeMillis() + 3000;
     }