diff options
| author | 2019-01-10 18:48:30 +0000 | |
|---|---|---|
| committer | 2019-01-10 18:48:30 +0000 | |
| commit | dcc45dcbbca1d82d20b4e9c3095d9b63e5cc484a (patch) | |
| tree | 81097885ea967e5ce072a9ba2948a32597207086 | |
| parent | 56464cf533e8dfbb7bef8ee30bf5115b8201bcd8 (diff) | |
| parent | 1c32743a1131097536dbde13e6dc199abbb61e00 (diff) | |
Merge "Swipe up to unlock when pulsing"
7 files changed, 32 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 323cf1fe7022..f14495bb959d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1843,6 +1843,13 @@ public class KeyguardViewMediator extends SystemUI { */ private void handleHide() { Trace.beginSection("KeyguardViewMediator#handleHide"); + + // It's possible that the device was unlocked in a dream state. It's time to wake up. + if (mAodShowing) { + PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); + pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:BOUNCER_DOZING"); + } + synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleHide"); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index d873b0cd1f26..75adf50c092e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -956,7 +956,7 @@ public class NotificationPanelView extends PanelView implements handled = true; } handled |= super.onTouchEvent(event); - return mDozing ? handled : true; + return !mDozing || mPulsing || handled; } private boolean handleQsTouch(MotionEvent event) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index e25c8292b637..4bece48e2a35 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -364,7 +364,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo mExpansionFraction = fraction; final boolean keyguardOrUnlocked = mState == ScrimState.UNLOCKED - || mState == ScrimState.KEYGUARD; + || mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING; if (!keyguardOrUnlocked || !mExpansionAffectsAlpha) { return; } @@ -409,7 +409,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo behindFraction = (float) Math.pow(behindFraction, 0.8f); mCurrentBehindAlpha = behindFraction * GRADIENT_SCRIM_ALPHA_BUSY; mCurrentInFrontAlpha = 0; - } else if (mState == ScrimState.KEYGUARD) { + } else if (mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING) { // Either darken of make the scrim transparent when you // pull down the shade float interpolatedFract = getInterpolatedFraction(); @@ -562,8 +562,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo if (alpha == 0f) { scrim.setClickable(false); } else { - // Eat touch events (unless dozing or pulsing). - scrim.setClickable(mState != ScrimState.AOD && mState != ScrimState.PULSING); + // Eat touch events (unless dozing). + scrim.setClickable(mState != ScrimState.AOD); } updateScrim(scrim, alpha); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 6d78f7204163..6f877ba90cfa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3573,10 +3573,7 @@ public class StatusBar extends SystemUI implements DemoMode, mVisualStabilityManager.setScreenOn(false); updateVisibleToUser(); - // We need to disable touch events because these might - // collapse the panel after we expanded it, and thus we would end up with a blank - // Keyguard. - mNotificationPanel.setTouchAndAnimationDisabled(true); + updateNotificationPanelTouchState(); mStatusBarWindow.cancelCurrentTouch(); if (mLaunchCameraOnFinishedGoingToSleep) { mLaunchCameraOnFinishedGoingToSleep = false; @@ -3599,13 +3596,22 @@ public class StatusBar extends SystemUI implements DemoMode, mDeviceInteractive = true; mAmbientPulseManager.releaseAllImmediately(); mVisualStabilityManager.setScreenOn(true); - mNotificationPanel.setTouchAndAnimationDisabled(false); + updateNotificationPanelTouchState(); updateVisibleToUser(); updateIsKeyguard(); mDozeServiceHost.stopDozing(); } }; + /** + * We need to disable touch events because these might + * collapse the panel after we expanded it, and thus we would end up with a blank + * Keyguard. + */ + private void updateNotificationPanelTouchState() { + mNotificationPanel.setTouchAndAnimationDisabled(!mDeviceInteractive && !mPulsing); + } + final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() { @Override public void onScreenTurningOn() { @@ -3871,17 +3877,15 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onPulseStarted() { callback.onPulseStarted(); - if (mAmbientPulseManager.hasNotifications()) { - // Only pulse the stack scroller if there's actually something to show. - // Otherwise just show the always-on screen. - setPulsing(true); - } + updateNotificationPanelTouchState(); + setPulsing(true); } @Override public void onPulseFinished() { mPulsing = false; callback.onPulseFinished(); + updateNotificationPanelTouchState(); setPulsing(false); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 0f8970f1069f..bb23608799f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -187,7 +187,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } else if (bouncerNeedsScrimming()) { mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); - } else if (mShowing && !mDozing) { + } else if (mShowing) { if (!isWakeAndUnlocking() && !mStatusBar.isInLaunchTransition()) { mBouncer.setExpansion(expansion); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index 53e461db3dd1..8b25c3469abe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -339,7 +339,7 @@ public class StatusBarWindowView extends FrameLayout { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { NotificationStackScrollLayout stackScrollLayout = getStackScrollLayout(); - if (mService.isDozing() && !stackScrollLayout.hasPulsingNotifications()) { + if (mService.isDozing() && !mService.isPulsing()) { // Capture all touch events in always-on. return true; } @@ -347,8 +347,7 @@ public class StatusBarWindowView extends FrameLayout { if (mNotificationPanel.isFullyExpanded() && stackScrollLayout.getVisibility() == View.VISIBLE && mStatusBarStateController.getState() == StatusBarState.KEYGUARD - && !mService.isBouncerShowing() - && !mService.isDozing()) { + && !mService.isBouncerShowing()) { intercept = mDragDownHelper.onInterceptTouchEvent(ev); } if (!intercept) { @@ -369,7 +368,7 @@ public class StatusBarWindowView extends FrameLayout { boolean handled = false; if (mService.isDozing()) { mDoubleTapHelper.onTouchEvent(ev); - handled = true; + handled = !mService.isPulsing(); } if ((mStatusBarStateController.getState() == StatusBarState.KEYGUARD && !handled) || mDragDownHelper.isDraggingDown()) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java index 146c5d647198..cc5f50a08a58 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java @@ -54,7 +54,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import java.util.Arrays; +import java.util.Collections; import java.util.HashSet; import java.util.function.Consumer; @@ -578,7 +578,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void testEatsTouchEvent() { HashSet<ScrimState> eatsTouches = - new HashSet<>(Arrays.asList(ScrimState.AOD, ScrimState.PULSING)); + new HashSet<>(Collections.singletonList(ScrimState.AOD)); for (ScrimState state : ScrimState.values()) { if (state == ScrimState.UNINITIALIZED) { continue; |