OSDN Git Service

Refactor PhotoSphere and Refocus: new camera open
authorAngus Kong <shkong@google.com>
Fri, 22 Nov 2013 02:14:14 +0000 (18:14 -0800)
committerAngus Kong <shkong@google.com>
Fri, 22 Nov 2013 22:26:38 +0000 (14:26 -0800)
This is part of the Denali refactor work. Now PhotoSphere and Refocus both uses
the new camera start up process so the camera is not released between modules.

See http://ag/392043/

Change-Id: I6ae9b111ba1fda33912159e0967f3a12d02937ba

src/com/android/camera/app/CameraController.java
src/com/android/camera/app/CameraProvider.java
src/com/android/camera/module/ModulesInfo.java

index acd2cce..1bb0a29 100644 (file)
@@ -68,7 +68,7 @@ public class CameraController implements CameraManager.CameraOpenCallback, Camer
         int firstFront = -1;
         int firstBack = -1;
         // Get the first (smallest) back and first front camera id.
-        for (int i = 0; i < mNumberOfCameras; i++) {
+        for (int i = mNumberOfCameras - 1; i >= 0; i--) {
             if (mCameraInfos[i].facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
                 firstBack = i;
             } else {
index 7c81557..5733e97 100644 (file)
@@ -51,12 +51,12 @@ public interface CameraProvider {
     public int getNumberOfCameras();
 
     /**
-     * Returns the lowest ID of the back camera.
+     * @returns The lowest ID of the back camera or -1 if not available.
      */
     public int getFirstBackCameraId();
 
     /**
-     * Returns the lowest ID of the front camera.
+     * @return The lowest ID of the front camera or -1 if not available.
      */
     public int getFirstFrontCameraId();
 }
index c42865b..a0a7f44 100644 (file)
@@ -126,7 +126,7 @@ public class ModulesInfo {
 
             @Override
             public boolean requestAppForCamera() {
-                return false;
+                return true;
             }
 
             @Override
@@ -146,7 +146,7 @@ public class ModulesInfo {
 
             @Override
             public boolean requestAppForCamera() {
-                return false;
+                return true;
             }
 
             @Override