diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-12-06 14:21:54 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-12-06 15:16:00 +0800 |
commit | 4da02059e884dbef897f410861329acad96d46d4 (patch) | |
tree | 8c4bafda6bf55c8762f7905ee8281fc23669454f /src | |
parent | 0107b90056eb40d4ae3a536aa1fc1a641e551542 (diff) | |
download | LegacyCamera-4da02059e884dbef897f410861329acad96d46d4.zip LegacyCamera-4da02059e884dbef897f410861329acad96d46d4.tar.gz LegacyCamera-4da02059e884dbef897f410861329acad96d46d4.tar.bz2 |
Fix crash after restoring defaults.
After restoring defaults in camcorder mode, the indicator
control calls onSharedPreferenceChanged if record location
is on. onSharedPreferenceChanged is also called in the end
of restorePreferences.
With two onSharedPreferenceChanged calls in a row, the first
call notices effects have been disabled, and begins the
effect pipeline teardown in the background thread. Normally,
this would conclude in a few hundred milliseconds, and would
then restart regular preview.
However, with the second call to onSharedPreferenceChanged
coming in right after the first, the method no longer sees
an effect transition in progress (since current and new
effect are equal to none now), and thus just ends up
restarting preview. That attempt at restart runs into the
crash because the main SurfaceView has not yet been released
by the background effects thread.
To fix this, InLineSettingSwitch should not invoke the
listener when updating UI.
bug:5679133
Change-Id: I06aca382105455585b633dc63f014a8f71ccadbe
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/ui/InLineSettingSwitch.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/com/android/camera/ui/InLineSettingSwitch.java b/src/com/android/camera/ui/InLineSettingSwitch.java index 8fc37da..20efc0c 100644 --- a/src/com/android/camera/ui/InLineSettingSwitch.java +++ b/src/com/android/camera/ui/InLineSettingSwitch.java @@ -57,13 +57,16 @@ public class InLineSettingSwitch extends InLineSettingItem { R.string.accessibility_switch, mPreference.getTitle())); } + @Override protected void updateView() { + mSwitch.setOnCheckedChangeListener(null); if (mOverrideValue == null) { mSwitch.setChecked(mIndex == 1); } else { int index = mPreference.findIndexOfValue(mOverrideValue); mSwitch.setChecked(index == 1); } + mSwitch.setOnCheckedChangeListener(mCheckedChangeListener); } @Override |