OSDN Git Service

Keyguard: Improve trusted unlock while occluded
authorAdrian Roos <roosa@google.com>
Thu, 4 Aug 2016 21:52:06 +0000 (14:52 -0700)
committerAdrian Roos <roosa@google.com>
Fri, 5 Aug 2016 00:05:16 +0000 (00:05 +0000)
Smoothly unlocks device when going from a SHOW_WHEN_LOCKED activity
to a DISMISS_KEYGUARD activity while the device is trusted.

This change suppresses the jank from going briefly through the
lockscreen if the device is trusted and unlockable without entering
a credential.

Bug: 27410215
Change-Id: Idd86e825d37a89538a0a1f690daf6afcf94a0699

services/core/java/com/android/server/policy/PhoneWindowManager.java

index b0f7038..5668352 100644 (file)
@@ -3562,7 +3562,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
 
     @Override
     public boolean canShowDismissingWindowWhileLockedLw() {
-        return false;
+        // If the keyguard is trusted, it will unlock without a challange. Therefore, windows with
+        // FLAG_DISMISS_KEYGUARD don't need to be force hidden, as they will unlock the phone right
+        // away anyways.
+        return mKeyguardDelegate != null && mKeyguardDelegate.isTrusted();
     }
 
     private void launchAssistLongPressAction() {
@@ -5261,7 +5264,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                 }
             } else if (mDismissKeyguard != DISMISS_KEYGUARD_NONE) {
                 mKeyguardHidden = false;
-                if (setKeyguardOccludedLw(false)) {
+                final boolean trusted = mKeyguardDelegate.isTrusted();
+                if (trusted) {
+                    // No need to un-occlude keyguard - we'll dimiss it right away anyways.
+                } else if (setKeyguardOccludedLw(false)) {
                     changes |= FINISH_LAYOUT_REDO_LAYOUT
                             | FINISH_LAYOUT_REDO_CONFIG
                             | FINISH_LAYOUT_REDO_WALLPAPER;
@@ -5271,7 +5277,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                     mHandler.post(new Runnable() {
                         @Override
                         public void run() {
-                            mKeyguardDelegate.dismiss(false /* allowWhileOccluded */);
+                            mKeyguardDelegate.dismiss(trusted /* allowWhileOccluded */);
                         }
                     });
                 }