OSDN Git Service

Shorter scrim delay if display is on
authorLucas Dupin <dupin@google.com>
Mon, 12 Feb 2018 20:44:37 +0000 (12:44 -0800)
committerLucas Dupin <dupin@google.com>
Mon, 12 Feb 2018 20:56:23 +0000 (12:56 -0800)
Reduces the scrim blanking delay in cases where the display
was already on:
- AOD enabled and display doesn't require blanking.
- Pulsing notification since we're already in a high power state.

Test: unlock with fp
Test: double tap pulsing notification
Test: unlock with fp when pulsing
Test: unlock with pin
Change-Id: I5aa98d7affc92119af6f8777462460a2b05e1374
Fixes: 73187454

packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java

index 1438763..2b50853 100644 (file)
@@ -166,6 +166,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
     private boolean mScreenBlankingCallbackCalled;
     private Callback mCallback;
     private boolean mWallpaperSupportsAmbientMode;
+    private boolean mScreenOn;
 
     // Scrim blanking callbacks
     private Choreographer.FrameCallback mPendingFrameCallback;
@@ -785,10 +786,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
 
             // Setting power states can happen after we push out the frame. Make sure we
             // stay fully opaque until the power state request reaches the lower levels.
+            final int delay = mScreenOn ? 16 : 500;
             if (DEBUG) {
-                Log.d(TAG, "Waiting for the screen to turn on...");
+                Log.d(TAG, "Fading out scrims with delay: " + delay);
             }
-            getHandler().postDelayed(mBlankingTransitionRunnable, 500);
+            getHandler().postDelayed(mBlankingTransitionRunnable, delay);
         };
         doOnTheNextFrame(mPendingFrameCallback);
     }
@@ -904,6 +906,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
      * Interrupts blanking transitions once the display notifies that it's already on.
      */
     public void onScreenTurnedOn() {
+        mScreenOn = true;
         final Handler handler = getHandler();
         if (handler.hasCallbacks(mBlankingTransitionRunnable)) {
             if (DEBUG) {
@@ -914,6 +917,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
         }
     }
 
+    public void onScreenTurnedOff() {
+        mScreenOn = false;
+    }
+
     public interface Callback {
         default void onStart() {
         }
index 458518c..3b63d6c 100644 (file)
@@ -4413,6 +4413,7 @@ public class StatusBar extends SystemUI implements DemoMode,
         @Override
         public void onScreenTurnedOff() {
             mFalsingManager.onScreenOff();
+            mScrimController.onScreenTurnedOff();
             // If we pulse in from AOD, we turn the screen off first. However, updatingIsKeyguard
             // in that case destroys the HeadsUpManager state, so don't do it in that case.
             if (!isPulsing()) {