From 364d1fb9369476d2bfd133a691fe0f5499cd862d Mon Sep 17 00:00:00 2001 From: Scott Mertz Date: Thu, 12 May 2016 16:52:42 -0700 Subject: CameraNext: stop updating the pano progress bar on pause Fixes a NPE if a panorama is rendering when the user pauses the activity, then launches the camera from the lockscreen and enters panorama mode. With this patch, the user is shown a message "previous panorama is rendering" instead of the progress bar. FEIJ-533 Change-Id: I3247e4bd96aa3aa67e9b1ff75d747d8be0c3c633 --- .../android/camera/WideAnglePanoramaModule.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java index 17b3fe1a3..9c44f5c6d 100644 --- a/src/com/android/camera/WideAnglePanoramaModule.java +++ b/src/com/android/camera/WideAnglePanoramaModule.java @@ -701,13 +701,21 @@ public class WideAnglePanoramaModule extends BaseModule imp } catch (InterruptedException e) { throw new RuntimeException("Panorama reportProgress failed", e); } - // Update the progress bar - mActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - mUI.updateSavingProgress(progress); - } - }); + // Update the progress bar if we haven't paused. In the case where + // we pause the UI, then launch the camera from the lockscreen with + // this thread still running, a new WideAnglePanoramaModule is + // created, but this thread is left running to finish the task (and + // mPaused continues to be true for that instance. + if (!mPaused) { + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + if (!mPaused) { + mUI.updateSavingProgress(progress); + } + } + }); + } } } }; -- cgit v1.2.3