summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2016-06-21 11:39:17 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-25 21:55:20 -0700
commit304cf5efa8454ff247d86f42b9b531d5851fbe8e (patch)
treea852d8c01908b1f792c36cbc9b9f2f0ff22bf421
parent78e53defe9afbff92c87e7b7662ede268b64e91b (diff)
downloadandroid_packages_apps_Snap-304cf5efa8454ff247d86f42b9b531d5851fbe8e.zip
android_packages_apps_Snap-304cf5efa8454ff247d86f42b9b531d5851fbe8e.tar.gz
android_packages_apps_Snap-304cf5efa8454ff247d86f42b9b531d5851fbe8e.tar.bz2
SnapdragonCamera: Fix the camera setting corruption issue
Two instances of camera preference were created and caused the wrong preference instance is referenced when changing the camera2 mode. Due to this, it corrupted the camera setting on the other camera device. To resolve the issue, create single instance of camera preference and re-use it. Change-Id: Ia1a6923a10b83e4c5777fb1318677c1f191942fb CRs-fixed: 1025776
-rw-r--r--src/com/android/camera/PhotoModule.java11
-rw-r--r--src/com/android/camera/SettingsManager.java5
-rw-r--r--src/com/android/camera/VideoModule.java12
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java12
4 files changed, 33 insertions, 7 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index deab80e..f8e5981 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -542,7 +542,10 @@ public class PhotoModule
}
public void reinit() {
- mPreferences = new ComboPreferences(mActivity);
+ mPreferences = ComboPreferences.get(mActivity);
+ if (mPreferences == null) {
+ mPreferences = new ComboPreferences(mActivity);
+ }
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), mActivity);
mCameraId = getPreferredCameraId(mPreferences);
mPreferences.setLocalId(mActivity, mCameraId);
@@ -553,7 +556,11 @@ public class PhotoModule
public void init(CameraActivity activity, View parent) {
mActivity = activity;
mRootView = parent;
- mPreferences = new ComboPreferences(mActivity);
+ mPreferences = ComboPreferences.get(mActivity);
+ if (mPreferences == null) {
+ mPreferences = new ComboPreferences(mActivity);
+ }
+
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), activity);
mCameraId = getPreferredCameraId(mPreferences);
mContentResolver = mActivity.getContentResolver();
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index cc75232..bd9322b 100644
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -104,7 +104,10 @@ public class SettingsManager implements ListMenu.SettingsListener {
mListeners = new ArrayList<>();
mCharacteristics = new ArrayList<>();
mContext = context;
- mPreferences = new ComboPreferences(mContext);
+ mPreferences = ComboPreferences.get(mContext);
+ if (mPreferences == null) {
+ mPreferences = new ComboPreferences(mContext);
+ }
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), mContext);
CameraManager manager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE);
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 19bbcab..cb0fa95 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -447,7 +447,11 @@ public class VideoModule implements CameraModule,
}
public void reinit() {
- mPreferences = new ComboPreferences(mActivity);
+ mPreferences = ComboPreferences.get(mActivity);
+ if (mPreferences == null) {
+ mPreferences = new ComboPreferences(mActivity);
+ }
+
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), mActivity);
mCameraId = getPreferredCameraId(mPreferences);
mPreferences.setLocalId(mActivity, mCameraId);
@@ -458,7 +462,11 @@ public class VideoModule implements CameraModule,
public void init(CameraActivity activity, View root) {
mActivity = activity;
mUI = new VideoUI(activity, this, root);
- mPreferences = new ComboPreferences(mActivity);
+ mPreferences = ComboPreferences.get(mActivity);
+ if (mPreferences == null) {
+ mPreferences = new ComboPreferences(mActivity);
+ }
+
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), activity);
mCameraId = getPreferredCameraId(mPreferences);
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 8e28f81..1b0ba8e 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -301,7 +301,11 @@ public class WideAnglePanoramaModule
mDialogPanoramaFailedString = appRes.getString(R.string.pano_dialog_panorama_failed);
mDialogWaitingPreviousString = appRes.getString(R.string.pano_dialog_waiting_previous);
- mPreferences = new ComboPreferences(mActivity);
+ mPreferences = ComboPreferences.get(mActivity);
+ if (mPreferences == null) {
+ mPreferences = new ComboPreferences(mActivity);
+ }
+
mPreferences.setLocalId(mActivity, getPreferredCameraId(mPreferences));
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), activity);
mLocationManager = new LocationManager(mActivity, null);
@@ -985,7 +989,11 @@ public class WideAnglePanoramaModule
@Override
public void onResumeBeforeSuper() {
mPaused = false;
- mPreferences = new ComboPreferences(mActivity);
+ mPreferences = ComboPreferences.get(mActivity);
+ if (mPreferences == null) {
+ mPreferences = new ComboPreferences(mActivity);
+ }
+
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), mActivity);
mPreferences.setLocalId(mActivity, getPreferredCameraId(mPreferences));
CameraSettings.upgradeLocalPreferences(mPreferences.getLocal());