Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +28 −2 Original line number Diff line number Diff line Loading @@ -166,7 +166,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, private boolean mScreenBlankingCallbackCalled; private Callback mCallback; private boolean mWallpaperSupportsAmbientMode; // Scrim blanking callbacks private Choreographer.FrameCallback mPendingFrameCallback; private Runnable mBlankingTransitionRunnable; private final WakeLock mWakeLock; private boolean mWakeLockHeld; Loading Loading @@ -249,10 +252,15 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, mCurrentInFrontAlpha = state.getFrontAlpha(); mCurrentBehindAlpha = state.getBehindAlpha(); // Cancel blanking transitions that were pending before we requested a new state if (mPendingFrameCallback != null) { Choreographer.getInstance().removeFrameCallback(mPendingFrameCallback); mPendingFrameCallback = null; } if (getHandler().hasCallbacks(mBlankingTransitionRunnable)) { getHandler().removeCallbacks(mBlankingTransitionRunnable); mBlankingTransitionRunnable = null; } // Showing/hiding the keyguard means that scrim colors have to be switched, not necessary // to do the same when you're just showing the brightness mirror. Loading Loading @@ -767,7 +775,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, mScreenBlankingCallbackCalled = true; } Runnable blankingCallback = () -> { mBlankingTransitionRunnable = () -> { mBlankingTransitionRunnable = null; mPendingFrameCallback = null; mBlankScreen = false; // Try again. Loading @@ -776,7 +785,10 @@ 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. getHandler().postDelayed(blankingCallback, 100); if (DEBUG) { Log.d(TAG, "Waiting for the screen to turn on..."); } getHandler().postDelayed(mBlankingTransitionRunnable, 500); }; doOnTheNextFrame(mPendingFrameCallback); } Loading Loading @@ -888,6 +900,20 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, } } /** * Interrupts blanking transitions once the display notifies that it's already on. */ public void onScreenTurnedOn() { final Handler handler = getHandler(); if (handler.hasCallbacks(mBlankingTransitionRunnable)) { if (DEBUG) { Log.d(TAG, "Shorter blanking because screen turned on. All good."); } handler.removeCallbacks(mBlankingTransitionRunnable); mBlankingTransitionRunnable.run(); } } public interface Callback { default void onStart() { } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -4407,6 +4407,7 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onScreenTurnedOn() { mScrimController.onScreenTurnedOn(); } @Override Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +28 −2 Original line number Diff line number Diff line Loading @@ -166,7 +166,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, private boolean mScreenBlankingCallbackCalled; private Callback mCallback; private boolean mWallpaperSupportsAmbientMode; // Scrim blanking callbacks private Choreographer.FrameCallback mPendingFrameCallback; private Runnable mBlankingTransitionRunnable; private final WakeLock mWakeLock; private boolean mWakeLockHeld; Loading Loading @@ -249,10 +252,15 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, mCurrentInFrontAlpha = state.getFrontAlpha(); mCurrentBehindAlpha = state.getBehindAlpha(); // Cancel blanking transitions that were pending before we requested a new state if (mPendingFrameCallback != null) { Choreographer.getInstance().removeFrameCallback(mPendingFrameCallback); mPendingFrameCallback = null; } if (getHandler().hasCallbacks(mBlankingTransitionRunnable)) { getHandler().removeCallbacks(mBlankingTransitionRunnable); mBlankingTransitionRunnable = null; } // Showing/hiding the keyguard means that scrim colors have to be switched, not necessary // to do the same when you're just showing the brightness mirror. Loading Loading @@ -767,7 +775,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, mScreenBlankingCallbackCalled = true; } Runnable blankingCallback = () -> { mBlankingTransitionRunnable = () -> { mBlankingTransitionRunnable = null; mPendingFrameCallback = null; mBlankScreen = false; // Try again. Loading @@ -776,7 +785,10 @@ 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. getHandler().postDelayed(blankingCallback, 100); if (DEBUG) { Log.d(TAG, "Waiting for the screen to turn on..."); } getHandler().postDelayed(mBlankingTransitionRunnable, 500); }; doOnTheNextFrame(mPendingFrameCallback); } Loading Loading @@ -888,6 +900,20 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, } } /** * Interrupts blanking transitions once the display notifies that it's already on. */ public void onScreenTurnedOn() { final Handler handler = getHandler(); if (handler.hasCallbacks(mBlankingTransitionRunnable)) { if (DEBUG) { Log.d(TAG, "Shorter blanking because screen turned on. All good."); } handler.removeCallbacks(mBlankingTransitionRunnable); mBlankingTransitionRunnable.run(); } } public interface Callback { default void onStart() { } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -4407,6 +4407,7 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onScreenTurnedOn() { mScrimController.onScreenTurnedOn(); } @Override Loading