Use singleTask to improve unsecure lockscreen startup
This enables warm-starts from the lockscreen by reusing the same
activity if possible.
Bug: 16035858
Change-Id: I4b1ce0c290e209a5098e3f3e71509e0ca86e1845
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index bed2684..1d353dc 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -128,10 +128,6 @@
private static final int UPDATE_PARAM_PREFERENCE = 4;
private static final int UPDATE_PARAM_ALL = -1;
- // This is the delay before we execute onResume tasks when coming
- // from the lock screen, to allow time for onPause to execute.
- private static final int ON_RESUME_TASKS_DELAY_MSEC = 20;
-
private static final String DEBUG_IMAGE_PREFIX = "DEBUG_";
private CameraActivity mActivity;
@@ -285,13 +281,6 @@
};
private boolean mShouldResizeTo16x9 = false;
- private final Runnable mResumeTaskRunnable = new Runnable() {
- @Override
- public void run() {
- onResumeTasks();
- }
- };
-
/**
* We keep the flash setting before entering scene modes (HDR)
* and restore it after HDR is off.
@@ -1597,11 +1586,9 @@
focusAndCapture();
}
- private void onResumeTasks() {
- if (mPaused) {
- return;
- }
- Log.v(TAG, "Executing onResumeTasks.");
+ @Override
+ public void resume() {
+ mPaused = false;
mCountdownSoundPlayer.loadSound(R.raw.timer_final_second);
mCountdownSoundPlayer.loadSound(R.raw.timer_increment);
@@ -1701,27 +1688,8 @@
}
@Override
- public void resume() {
- mPaused = false;
-
- // Add delay on resume from lock screen only, in order to to speed up
- // the onResume --> onPause --> onResume cycle from lock screen.
- // Don't do always because letting go of thread can cause delay.
- if (isResumeFromLockscreen()) {
- Log.v(TAG, "On resume, from lock screen.");
- // Note: onPauseAfterSuper() will delete this runnable, so we will
- // at most have 1 copy queued up.
- mHandler.postDelayed(mResumeTaskRunnable, ON_RESUME_TASKS_DELAY_MSEC);
- } else {
- Log.v(TAG, "On resume.");
- onResumeTasks();
- }
- }
-
- @Override
public void pause() {
mPaused = true;
- mHandler.removeCallbacks(mResumeTaskRunnable);
getServices().getRemoteShutterListener().onModuleExit();
SessionStatsCollector.instance().sessionActive(false);