summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2016-06-15 14:04:34 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-21 18:46:32 -0700
commit1ebc5c3bd541256509f4eed9a085f554a8ba3ea7 (patch)
treedba8216c6e8fb5d52ae9e6791cd8a0b5e5bdec76
parenta17322a1caa2520f96f167a3d779abcbf7e6d641 (diff)
downloadandroid_packages_apps_Snap-1ebc5c3bd541256509f4eed9a085f554a8ba3ea7.zip
android_packages_apps_Snap-1ebc5c3bd541256509f4eed9a085f554a8ba3ea7.tar.gz
android_packages_apps_Snap-1ebc5c3bd541256509f4eed9a085f554a8ba3ea7.tar.bz2
SnapdragonCamera: Multiple fixes in SettingManager
- Setting manager instance was not destroyed when camera activity onDestroy is called and a new instance is created again when onCreate is called. Make change to destroy the setting manager during onDestroy. - Include high resolution picture sizes to the picture size list Change-Id: Id6cb52da1419f7e723304236b5d2c204d217398c CRs-Fixed: 1025845, 1025789
-rw-r--r--src/com/android/camera/CameraActivity.java1
-rw-r--r--src/com/android/camera/SettingsManager.java24
2 files changed, 21 insertions, 4 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index f5d99a6..5252883 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1824,6 +1824,7 @@ public class CameraActivity extends Activity
mWakeLock.release();
Log.d(TAG, "wake lock release");
}
+ SettingsManager.getInstance().destroyInstance();
if (mCursor != null) {
if (mSecureCamera) {
unregisterReceiver(mScreenOffReceiver);
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index 095c5d8..cc75232 100644
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -88,10 +88,9 @@ public class SettingsManager implements ListMenu.SettingsListener {
public static final String KEY_TIMER = "pref_camera2_timer_key";
public static final String KEY_LONGSHOT = "pref_camera2_longshot_key";
private static final String TAG = "SnapCam_SettingsManager";
- private static final List<CameraCharacteristics> mCharacteristics = new ArrayList<>();
private static SettingsManager sInstance;
-
+ private ArrayList<CameraCharacteristics> mCharacteristics;
private ArrayList<Listener> mListeners;
private Map<String, Values> mValuesMap;
private Context mContext;
@@ -103,6 +102,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
private SettingsManager(Context context) {
mListeners = new ArrayList<>();
+ mCharacteristics = new ArrayList<>();
mContext = context;
mPreferences = new ComboPreferences(mContext);
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), mContext);
@@ -146,6 +146,12 @@ public class SettingsManager implements ListMenu.SettingsListener {
return sInstance;
}
+ public void destroyInstance() {
+ if (sInstance != null) {
+ sInstance = null;
+ }
+ }
+
public List<String> getDisabledList() {
List<String> list = new ArrayList<>();
Set<String> keySet = mValuesMap.keySet();
@@ -683,9 +689,19 @@ public class SettingsManager implements ListMenu.SettingsListener {
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
Size[] sizes = map.getOutputSizes(ImageFormat.JPEG);
List<String> res = new ArrayList<>();
- for (int i = 0; i < sizes.length; i++) {
- res.add(sizes[i].toString());
+ if (sizes != null) {
+ for (int i = 0; i < sizes.length; i++) {
+ res.add(sizes[i].toString());
+ }
}
+
+ Size[] highResSizes = map.getHighResolutionOutputSizes(ImageFormat.JPEG);
+ if (highResSizes != null) {
+ for (int i = 0; i < highResSizes.length; i++) {
+ res.add(highResSizes[i].toString());
+ }
+ }
+
return res;
}