OSDN Git Service

am 5420d57f: am 74b1d995: am 893acd56: am 11d3405c: am 0c9af933: Merge "Revert "Delay...
authorAlan Newberger <alann@google.com>
Tue, 16 Sep 2014 15:21:35 +0000 (15:21 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Tue, 16 Sep 2014 15:21:35 +0000 (15:21 +0000)
* commit '5420d57fa25c421252bdb703338c2806c18d7b09':

AndroidManifest.xml
res_p/mipmap-hdpi/logo_camera_color_44in48dp.png [moved from res_p/drawable-hdpi/logo_camera_color_44in48dp.png with 100% similarity]
res_p/mipmap-mdpi/logo_camera_color_44in48dp.png [moved from res_p/drawable-mdpi/logo_camera_color_44in48dp.png with 100% similarity]
res_p/mipmap-xhdpi/logo_camera_color_44in48dp.png [moved from res_p/drawable-xhdpi/logo_camera_color_44in48dp.png with 100% similarity]
res_p/mipmap-xxhdpi/logo_camera_color_44in48dp.png [moved from res_p/drawable-xxhdpi/logo_camera_color_44in48dp.png with 100% similarity]
res_p/mipmap-xxxhdpi/logo_camera_color_44in48dp.png [moved from res_p/drawable-xxxhdpi/logo_camera_color_44in48dp.png with 100% similarity]
src/com/android/camera/CameraActivity.java
src/com/android/camera/CaptureModule.java
src/com/android/camera/PhotoModule.java
src/com/android/camera/app/CameraController.java

index 435c48e..e187f99 100644 (file)
@@ -42,7 +42,7 @@
     <application
         android:name="com.android.camera.app.CameraApp"
         android:hardwareAccelerated="true"
-        android:icon="@drawable/logo_camera_color_44in48dp"
+        android:icon="@mipmap/logo_camera_color_44in48dp"
         android:label="@string/app_name"
         android:largeHeap="true"
         android:restoreAnyVersion="true"
index 8fbe5bd..9a560fc 100644 (file)
@@ -248,7 +248,7 @@ public class CameraActivity extends Activity
 
     private static final int LIGHTS_OUT_DELAY_MS = 4000;
     private final int BASE_SYS_UI_VISIBILITY =
-            View.SYSTEM_UI_FLAG_FULLSCREEN
+            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
             | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
     private final Runnable mLightsOutRunnable = new Runnable() {
         @Override
index 9c74d4d..07d779a 100644 (file)
@@ -665,6 +665,10 @@ public class CaptureModule extends CameraModule
         if (!mHdrEnabled) {
             bottomBarSpec.enableFlash = true;
         }
+        // Added to handle case of CaptureModule being used only for Gcam.
+        if (mStickyGcamCamera) {
+            bottomBarSpec.enableFlash = false;
+        }
         return bottomBarSpec;
     }
 
index 173ecae..8865a80 100644 (file)
@@ -160,6 +160,13 @@ public class PhotoModule
     private boolean mAwbLockSupported;
     private boolean mContinuousFocusSupported;
 
+    /*
+     * If true, attempts to start the preview will be denied.  This ensures that
+     * we never call startPreview multiple times when making changes to
+     * settings.
+     */
+    private boolean mStartPreviewLock = false;
+
     // The degrees of the device rotated clockwise from its natural orientation.
     private int mOrientation = OrientationEventListener.ORIENTATION_UNKNOWN;
 
@@ -1383,12 +1390,21 @@ public class PhotoModule
 
         // Do camera parameter dependent initialization.
         mCameraSettings = mCameraDevice.getSettings();
-        setCameraParameters(UPDATE_PARAM_ALL);
-        // Set a listener which updates camera parameters based
-        // on changed settings.
-        SettingsManager settingsManager = mActivity.getSettingsManager();
-        settingsManager.addListener(this);
-        mCameraPreviewParamsReady = true;
+        // HACK: The call to setCameraParameters(UPDATE_PARAM_ALL) may
+        // eventually recurse back into startPreview().
+        // To avoid calling startPreview() twice, first acquire
+        // mStartPreviewLock.
+        mStartPreviewLock = true;
+        try {
+            setCameraParameters(UPDATE_PARAM_ALL);
+            // Set a listener which updates camera parameters based
+            // on changed settings.
+            SettingsManager settingsManager = mActivity.getSettingsManager();
+            settingsManager.addListener(this);
+            mCameraPreviewParamsReady = true;
+        } finally {
+            mStartPreviewLock = false;
+        }
 
         startPreview();
 
@@ -1945,33 +1961,46 @@ public class PhotoModule
      * The start/stop preview should only run on the UI thread.
      */
     private void startPreview() {
-        if (!checkPreviewPreconditions()) {
+        // HACK: The call to setCameraParameters(UPDATE_PARAM_ALL) may
+        // eventually recurse back into startPreview().
+        // To avoid calling startPreview() twice, we must acquire
+        // mStartPreviewLock.
+        if (mStartPreviewLock) {
+            // do nothing
             return;
         }
+        mStartPreviewLock = true;
+        try {
+            if (!checkPreviewPreconditions()) {
+                return;
+            }
 
-        mCameraDevice.setErrorCallback(mHandler, mErrorCallback);
-        setDisplayOrientation();
+            mCameraDevice.setErrorCallback(mHandler, mErrorCallback);
+            setDisplayOrientation();
 
-        if (!mSnapshotOnIdle) {
-            // If the focus mode is continuous autofocus, call cancelAutoFocus
-            // to resume it because it may have been paused by autoFocus call.
-            if (mFocusManager.getFocusMode(mCameraSettings.getCurrentFocusMode()) ==
-                    CameraCapabilities.FocusMode.CONTINUOUS_PICTURE) {
-                mCameraDevice.cancelAutoFocus();
+            if (!mSnapshotOnIdle) {
+                // If the focus mode is continuous autofocus, call cancelAutoFocus
+                // to resume it because it may have been paused by autoFocus call.
+                if (mFocusManager.getFocusMode(mCameraSettings.getCurrentFocusMode()) ==
+                        CameraCapabilities.FocusMode.CONTINUOUS_PICTURE) {
+                    mCameraDevice.cancelAutoFocus();
+                }
+                mFocusManager.setAeAwbLock(false); // Unlock AE and AWB.
             }
-            mFocusManager.setAeAwbLock(false); // Unlock AE and AWB.
-        }
-        setCameraParameters(UPDATE_PARAM_ALL);
-        mCameraDevice.setPreviewTexture(mActivity.getCameraAppUI().getSurfaceTexture());
+            setCameraParameters(UPDATE_PARAM_ALL);
+            mCameraDevice.setPreviewTexture(mActivity.getCameraAppUI().getSurfaceTexture());
 
-        Log.i(TAG, "startPreview");
-        mCameraDevice.startPreview();
+            Log.i(TAG, "startPreview");
+            mCameraDevice.startPreview();
 
-        mFocusManager.onPreviewStarted();
-        onPreviewStarted();
-        SessionStatsCollector.instance().previewActive(true);
-        if (mSnapshotOnIdle) {
-            mHandler.post(mDoSnapRunnable);
+            mFocusManager.onPreviewStarted();
+            onPreviewStarted();
+            SessionStatsCollector.instance().previewActive(true);
+            if (mSnapshotOnIdle) {
+                mHandler.post(mDoSnapRunnable);
+            }
+        } finally {
+            mStartPreviewLock = false;
         }
     }
 
index feb9882..c87df91 100644 (file)
@@ -22,6 +22,7 @@ import android.os.Handler;
 import com.android.camera.CameraDisabledException;
 import com.android.camera.debug.Log;
 import com.android.camera.util.CameraUtil;
+import com.android.camera.util.GservicesHelper;
 import com.android.ex.camera2.portability.CameraAgent;
 import com.android.ex.camera2.portability.CameraAgent.CameraExceptionCallback;
 import com.android.ex.camera2.portability.CameraDeviceInfo;
@@ -230,12 +231,14 @@ public class CameraController implements CameraAgent.CameraOpenCallback, CameraP
             // No camera yet.
             checkAndOpenCamera(mContext, cameraManager, id, mCallbackHandler, this);
         } else if (mCameraProxy.getCameraId() != id || mUsingNewApi != useNewApi) {
+            boolean syncClose = GservicesHelper.useCamera2ApiThroughPortabilityLayer(mContext);
             Log.v(TAG, "different camera already opened, closing then reopening");
             // Already has camera opened, and is switching cameras and/or APIs.
             if (mUsingNewApi) {
-                mCameraAgentNg.closeCamera(mCameraProxy, false);
+                mCameraAgentNg.closeCamera(mCameraProxy, true);
             } else {
-                mCameraAgent.closeCamera(mCameraProxy, false);
+                // if using API2 ensure API1 usage is also synced
+                mCameraAgent.closeCamera(mCameraProxy, syncClose);
             }
             checkAndOpenCamera(mContext, cameraManager, id, mCallbackHandler, this);
         } else {