OSDN Git Service

Ensure button callbacks check lifecycle
authorAlan Newberger <alann@google.com>
Sat, 10 Jan 2015 00:02:57 +0000 (16:02 -0800)
committerAlan Newberger <alann@google.com>
Sat, 10 Jan 2015 00:02:57 +0000 (16:02 -0800)
The button callbacks are asynchronous behind animators. Most in the codebase
(i.e., all in CaptureModule) do paused checks, but the one in CameraAppUI
for grid lines did not and is causing lots of feedback reports with null
SettingsManagers (done in the activity onDestroy). Audited codebase, these
two instances were the only ones not checking.

Bug: 17905718
Change-Id: I31c26088ef1e7d600b4e3be42950b0ca70613e20

src/com/android/camera/VideoModule.java
src/com/android/camera/app/CameraAppUI.java

index f0a15d8..ba23951 100644 (file)
@@ -499,6 +499,9 @@ public class VideoModule extends CameraModule
         new ButtonManager.ButtonCallback() {
             @Override
             public void onStateChanged(int state) {
+                if (mPaused) {
+                    return;
+                }
                 // Update flash parameters.
                 enableTorchMode(true);
             }
index d002a96..9323c8e 100644 (file)
@@ -1657,10 +1657,12 @@ public class CameraAppUI implements ModeListView.ModeSwitchListener,
         return new ButtonManager.ButtonCallback() {
             @Override
             public void onStateChanged(int state) {
-                if (Keys.areGridLinesOn(mController.getSettingsManager())) {
-                    showGridLines();
-                } else {
-                    hideGridLines();
+                if (!mController.isPaused()) {
+                    if (Keys.areGridLinesOn(mController.getSettingsManager())) {
+                        showGridLines();
+                    } else {
+                        hideGridLines();
+                    }
                 }
             }
         };