diff options
author | Josh Tsuji <tsuji@google.com> | 2022-07-01 14:58:05 -0400 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-07 03:04:41 +0000 |
commit | ddcd7479aab585acbf0618c2f4448776b693225b (patch) | |
tree | 1cfb453b543ec3f5b636190ea824e7b489a8e3bd | |
parent | 7d7ee57b4dbbe4723c19cf5308eee10d6c6cf2a6 (diff) | |
download | base-ddcd7479aab585acbf0618c2f4448776b693225b.tar.gz |
Don't setOccluded in onLaunchAnimationStart.
After recent fixes, WM exclusively communicates occluded state by
calling the occlude/unocclude animators' onAnimationStart and
onAnimationCancelled methods. We call
KeyguardViewMediator#setOccluded there to officially set System UI's
occluded state.
Those methods are guaranteed to be called prior to the launch animator
methods. This means that the setOccluded call in onLaunchAnimationStart should always be redundant. However, a series of race conditions (see
https://buganizer.corp.google.com/issues/235463625#comment85) could
cause this to be called after WM called the unocclude animator's
onAnimationStart.
Also, add logging to places where we set occluded state to aid in
future debugging. These logs are only called during activity launch
so should not be frequently logged.
Fixes: 235463625
Test: launch and kill the Android Auto head unit ~50 times until onLaunchAnimationStarted ends up being called after the unocclude onAnimationStart, verify that we don't end up in the black screen state
Test: launch/kill camera repeatedly to verify no regressions with camera occluding lockscreen
Test: launch device controls, with and without controls added, to verify that we are not regressing other trampoline occluding actvities
Change-Id: Ia71eb5fb0f85eb5fb494e66a270c68d7df5e1629
Merged-In: Ia71eb5fb0f85eb5fb494e66a270c68d7df5e1629
(cherry picked from commit 1454274680f6d43dc8a37ea4df7cf4699348d039)
Merged-In: Ia71eb5fb0f85eb5fb494e66a270c68d7df5e1629
3 files changed, 12 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java index fb61948216cd..a724d87e5c08 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java @@ -405,6 +405,8 @@ public class KeyguardService extends Service { @Override // Binder interface public void setOccluded(boolean isOccluded, boolean animate) { + Log.d(TAG, "setOccluded(" + isOccluded + ")"); + Trace.beginSection("KeyguardService.mBinder#setOccluded"); checkPermission(); mKeyguardViewMediator.setOccluded(isOccluded, animate); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 94c594dd8a48..0783eeec176f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -836,9 +836,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, private final ActivityLaunchAnimator.Controller mOccludeAnimationController = new ActivityLaunchAnimator.Controller() { @Override - public void onLaunchAnimationStart(boolean isExpandingFullyAbove) { - setOccluded(true /* occluded */, false /* animate */); - } + public void onLaunchAnimationStart(boolean isExpandingFullyAbove) {} @Override public void onLaunchAnimationCancelled() { @@ -924,6 +922,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, IRemoteAnimationFinishedCallback finishedCallback) throws RemoteException { + Log.d(TAG, "UnoccludeAnimator#onAnimationStart. Set occluded = false."); setOccluded(false /* isOccluded */, true /* animate */); if (apps == null || apps.length == 0 || apps[0] == null) { @@ -1669,6 +1668,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, * Notify us when the keyguard is occluded by another window */ public void setOccluded(boolean isOccluded, boolean animate) { + Log.d(TAG, "setOccluded(" + isOccluded + ")"); + Trace.beginSection("KeyguardViewMediator#setOccluded"); if (DEBUG) Log.d(TAG, "setOccluded " + isOccluded); mInteractionJankMonitor.cancel(CUJ_LOCKSCREEN_TRANSITION_FROM_AOD); @@ -1699,6 +1700,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, */ private void handleSetOccluded(boolean isOccluded, boolean animate) { Trace.beginSection("KeyguardViewMediator#handleSetOccluded"); + Log.d(TAG, "handleSetOccluded(" + isOccluded + ")"); synchronized (KeyguardViewMediator.this) { if (mHiding && isOccluded) { // We're in the process of going away but WindowManager wants to show a @@ -3188,16 +3190,18 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, // internal state to reflect that immediately, vs. waiting for the launch animator to // begin. Otherwise, calls to setShowingLocked, etc. will not know that we're about to // be occluded and might re-show the keyguard. + Log.d(TAG, "OccludeAnimator#onAnimationStart. Set occluded = true."); setOccluded(true /* isOccluded */, false /* animate */); } @Override public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException { super.onAnimationCancelled(isKeyguardOccluded); - setOccluded(isKeyguardOccluded /* occluded */, false /* animate */); Log.d(TAG, "Occlude animation cancelled by WM. " - + "Setting occluded state to: " + mOccluded); + + "Setting occluded state to: " + isKeyguardOccluded); + setOccluded(isKeyguardOccluded /* occluded */, false /* animate */); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 705de9b43ed0..7e57dd452cb8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -1760,6 +1760,7 @@ public class CentralSurfacesImpl extends CoreStartable implements // activity is exited. if (mKeyguardStateController.isShowing() && !mKeyguardStateController.isKeyguardGoingAway()) { + Log.d(TAG, "Setting occluded = true in #startActivity."); mKeyguardViewMediator.setOccluded(true /* isOccluded */, true /* animate */); } |