summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-rw-r--r--src/com/android/camera/CameraActivity.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 110df5e27..3c89fda08 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -192,11 +192,15 @@ public class CameraActivity extends Activity
private static boolean PIE_MENU_ENABLED = false;
private boolean mDeveloperMenuEnabled = false;
+ private boolean mCamera2supported = false;
+ private boolean mCamera2enabled = false;
+
/** This data adapter is used by FilmStripView. */
private LocalDataAdapter mDataAdapter;
/** This data adapter represents the real local camera data. */
private LocalDataAdapter mWrappedDataAdapter;
+ private Context mContext;
private PanoramaStitchingManager mPanoramaManager;
private PlaceholderManager mPlaceholderManager;
private int mCurrentModuleIndex;
@@ -1489,6 +1493,9 @@ public class CameraActivity extends Activity
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
+
+ mContext = getApplicationContext();
+
// Check if this is in the secure camera mode.
Intent intent = getIntent();
String action = intent.getAction();
@@ -1566,8 +1573,14 @@ public class CameraActivity extends Activity
}
}
- boolean cam2on = PersistUtil.getCamera2Mode();
- if (cam2on && (moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX ||
+ // Check if the device supports Camera API 2
+ mCamera2supported = CameraUtil.isCamera2Supported(mContext);
+ Log.d(TAG, "Camera API 2 supported: " + mCamera2supported);
+
+ mCamera2enabled = mCamera2supported && mContext.getResources().getBoolean(R.bool.support_camera_api_v2);
+ Log.d(TAG, "Camera API 2 enabled: " + mCamera2enabled);
+
+ if (mCamera2enabled && (moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX ||
moduleIndex == ModuleSwitcher.VIDEO_MODULE_INDEX))
moduleIndex = ModuleSwitcher.CAPTURE_MODULE_INDEX;
@@ -2134,9 +2147,8 @@ public class CameraActivity extends Activity
@Override
public void onModuleSelected(int moduleIndex) {
- boolean cam2on = PersistUtil.getCamera2Mode();
mForceReleaseCamera = moduleIndex == ModuleSwitcher.CAPTURE_MODULE_INDEX ||
- (cam2on && moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX);
+ (mCamera2enabled && moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX);
if (mForceReleaseCamera) {
moduleIndex = ModuleSwitcher.CAPTURE_MODULE_INDEX;
}