diff options
| author | 2019-09-17 11:19:53 -0400 | |
|---|---|---|
| committer | 2019-09-18 10:38:34 -0400 | |
| commit | e7ff7be645bce83218c35a059b03fa6f23ddb4ed (patch) | |
| tree | 751c27430c6d7593c4245e84bc455f3f35d06e93 | |
| parent | 2a873c7628980444cfb2ae45311dc5181a2b2afd (diff) | |
Avoid going to SHADE_LOCKED when already in SHADE
It's not possible for the device to go to SHADE_LOCKED after you're
already unlocked, still it's possible that it would happen.
Added an extra condition to avoid it, and logs to catch the regression
if it happens again.
Fixes: 139259891
Test: pull down notification while authenticating
Change-Id: I5c2b81906fa444dfd07d040b81a527245d4130e6
3 files changed, 12 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt index 276afa7a3a94..a70dc7c0ec5d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt @@ -33,6 +33,7 @@ import com.android.systemui.Gefingerpoken import com.android.systemui.Interpolators import com.android.systemui.R import com.android.systemui.plugins.FalsingManager +import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView @@ -56,7 +57,8 @@ constructor( private val wakeUpCoordinator: NotificationWakeUpCoordinator, private val bypassController: KeyguardBypassController, private val headsUpManager: HeadsUpManagerPhone, - private val roundnessManager: NotificationRoundnessManager + private val roundnessManager: NotificationRoundnessManager, + private val statusBarStateController: StatusBarStateController ) : Gefingerpoken { companion object { private val RUBBERBAND_FACTOR_STATIC = 0.25f @@ -188,7 +190,8 @@ constructor( MotionEvent.ACTION_MOVE -> updateExpansionHeight(moveDistance) MotionEvent.ACTION_UP -> { velocityTracker!!.computeCurrentVelocity(1000 /* units */) - val canExpand = moveDistance > 0 && velocityTracker!!.getYVelocity() > -1000 + val canExpand = moveDistance > 0 && velocityTracker!!.getYVelocity() > -1000 && + statusBarStateController.state != StatusBarState.SHADE if (!mFalsingManager.isUnlockingDisabled && !isFalseTouch && canExpand) { finishExpansion() } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java index f0eeb046bc44..abf29c47e803 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java @@ -20,6 +20,7 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.text.format.DateFormat; import android.util.FloatProperty; +import android.util.Log; import android.view.View; import android.view.animation.Interpolator; @@ -136,6 +137,11 @@ public class StatusBarStateControllerImpl implements SysuiStatusBarStateControll // Record the to-be mState and mLastState recordHistoricalState(state, mState); + // b/139259891 + if (mState == StatusBarState.SHADE && state == StatusBarState.SHADE_LOCKED) { + Log.e(TAG, "Invalid state transition: SHADE -> SHADE_LOCKED", new Throwable()); + } + synchronized (mListeners) { for (RankedListener rl : new ArrayList<>(mListeners)) { rl.mListener.onStatePreChange(mState, state); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index 0334d49ce9df..f94779d6d5ca 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -129,7 +129,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { mKeyguardBypassController); PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator, mKeyguardBypassController, mHeadsUpManager, - mock(NotificationRoundnessManager.class)); + mock(NotificationRoundnessManager.class), mStatusBarStateController); mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler, mKeyguardBypassController); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); |