From bb9f5bece8728728d76dbbc28984ad3434be7143 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Fri, 8 Oct 2021 13:05:40 -0400 Subject: [PATCH 1/2] Don't play screen off animation if we are upside down unless that's allowed. Bug: 196364593 Test: be upside down, turn the screen off Change-Id: I6c4f5c93c9c2c7fe2348edd842e6c4f3276c3600 --- .../phone/UnlockedScreenOffAnimationController.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt index 143aaba648da3..f3f3325f49d7e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt @@ -4,10 +4,10 @@ import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator import android.content.Context -import android.content.res.Configuration import android.database.ContentObserver import android.os.Handler import android.provider.Settings +import android.view.Surface import android.view.View import com.android.systemui.animation.Interpolators import com.android.systemui.dagger.SysUISingleton @@ -239,10 +239,11 @@ class UnlockedScreenOffAnimationController @Inject constructor( return false } - // If we're not allowed to rotate the keyguard, then only do the screen off animation if - // we're in portrait. Otherwise, AOD will animate in sideways, which looks weird. + // If we're not allowed to rotate the keyguard, it can only be displayed in zero-degree + // portrait. If we're in another orientation, disable the screen off animation so we don't + // animate in the keyguard AOD UI sideways or upside down. if (!keyguardStateController.isKeyguardScreenRotationAllowed && - context.resources.configuration.orientation != Configuration.ORIENTATION_PORTRAIT) { + context.display.rotation != Surface.ROTATION_0) { return false } From 088de9ff5a02f4713fec9a1659905806c3fa0f0d Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Fri, 8 Oct 2021 17:34:34 -0400 Subject: [PATCH 2/2] Don't expand the keyguard if it's fading away. Bug: 196364593 Test: run an app that is locked in landscape, lock the screen, unlock it Change-Id: I2516e8d2b5b7da0056eeec0b85ed33362f7f3503 --- .../systemui/statusbar/phone/PanelViewController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java index 768567b8b4741..c23577c523e36 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java @@ -385,11 +385,16 @@ public abstract class PanelViewController { final boolean expand; if (event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel) { - // If we get a cancel, put the shade back to the state it was in when the gesture - // started - if (onKeyguard) { + // If the keyguard is fading away, don't expand it again. This can happen if you're + // swiping to unlock, the app below the keyguard is in landscape, and the screen + // rotates while your finger is still down after the swipe to unlock. + if (mKeyguardStateController.isKeyguardFadingAway()) { + expand = false; + } else if (onKeyguard) { expand = true; } else { + // If we get a cancel, put the shade back to the state it was in when the + // gesture started expand = !mPanelClosedOnDown; } } else {