diff options
3 files changed, 28 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/CameraWidgetFrame.java b/policy/src/com/android/internal/policy/impl/keyguard/CameraWidgetFrame.java index 7f5d66f..2728bfc 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/CameraWidgetFrame.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/CameraWidgetFrame.java @@ -64,7 +64,10 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli private final Runnable mLaunchCameraRunnable = new Runnable() { @Override public void run() { + if (!mTransitioning) + return; mLaunchCameraStart = SystemClock.uptimeMillis(); + if (DEBUG) Log.d(TAG, "Launching camera at " + mLaunchCameraStart); mActivityLauncher.launchCamera(); }}; @@ -274,7 +277,7 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli @Override protected void onFocusLost() { - Log.d(TAG, "onFocusLost"); + if (DEBUG) Log.d(TAG, "onFocusLost"); cancelTransitionToCamera(); super.onFocusLost(); } @@ -293,6 +296,11 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli } } + public void onScreenTurnedOff() { + if (DEBUG) Log.d(TAG, "onScreenTurnedOff"); + reset(); + } + private void rescheduleTransitionToCamera() { if (DEBUG) Log.d(TAG, "rescheduleTransitionToCamera at " + SystemClock.uptimeMillis()); mHandler.removeCallbacks(mTransitionToCameraRunnable); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardActivityLauncher.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardActivityLauncher.java index 389939e..8283af2 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardActivityLauncher.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardActivityLauncher.java @@ -25,6 +25,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.os.RemoteException; +import android.os.SystemClock; import android.os.UserHandle; import android.provider.MediaStore; import android.util.Log; @@ -132,6 +133,8 @@ public abstract class KeyguardActivityLauncher { Log.w(TAG, "can't dismiss keyguard on launch"); } try { + if (DEBUG) Log.d(TAG, String.format("Starting activity for intent %s at %s", + intent, SystemClock.uptimeMillis())); context.startActivityAsUser(intent, animation, new UserHandle(UserHandle.USER_CURRENT)); } catch (ActivityNotFoundException e) { diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java index b93f9d2..ca3d0a2 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java @@ -39,6 +39,7 @@ import android.os.Bundle; import android.os.Looper; import android.os.Parcel; import android.os.Parcelable; +import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.util.AttributeSet; @@ -708,13 +709,18 @@ public class KeyguardHostView extends KeyguardViewBase { @Override public void onScreenTurnedOff() { - if (DEBUG) Log.d(TAG, "screen off, instance " + Integer.toHexString(hashCode())); + if (DEBUG) Log.d(TAG, String.format("screen off, instance %s at %s", + Integer.toHexString(hashCode()), SystemClock.uptimeMillis())); // Once the screen turns off, we no longer consider this to be first boot and we want the // biometric unlock to start next time keyguard is shown. KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true); saveStickyWidgetIndex(); showPrimarySecurityScreen(true); getSecurityView(mCurrentSecuritySelection).onPause(); + CameraWidgetFrame cameraPage = findCameraPage(); + if (cameraPage != null) { + cameraPage.onScreenTurnedOff(); + } } @Override @@ -1140,6 +1146,15 @@ public class KeyguardHostView extends KeyguardViewBase { mAppWidgetContainer.setCurrentPage(pageToShow); } + private CameraWidgetFrame findCameraPage() { + for (int i = mAppWidgetContainer.getChildCount() - 1; i >= 0; i--) { + if (isCameraPage(i)) { + return (CameraWidgetFrame) mAppWidgetContainer.getChildAt(i); + } + } + return null; + } + private boolean isCameraPage(int pageIndex) { View v = mAppWidgetContainer.getChildAt(pageIndex); return v != null && v instanceof CameraWidgetFrame; |
