summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakeSleepReason.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakefulnessModel.kt11
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java9
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java42
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java3
10 files changed, 94 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakeSleepReason.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakeSleepReason.kt
index 51ce7ff45182..fb685dab1797 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakeSleepReason.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakeSleepReason.kt
@@ -23,9 +23,12 @@ enum class WakeSleepReason {
/** The physical power button was pressed to wake up or sleep the device. */
POWER_BUTTON,
- /** The user has taped or double tapped to wake the screen */
+ /** The user has tapped or double tapped to wake the screen. */
TAP,
+ /** The user performed some sort of gesture to wake the screen. */
+ GESTURE,
+
/** Something else happened to wake up or sleep the device. */
OTHER;
@@ -34,6 +37,7 @@ enum class WakeSleepReason {
return when (reason) {
PowerManager.WAKE_REASON_POWER_BUTTON -> POWER_BUTTON
PowerManager.WAKE_REASON_TAP -> TAP
+ PowerManager.WAKE_REASON_GESTURE -> GESTURE
else -> OTHER
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakefulnessModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakefulnessModel.kt
index 7ca90ba63fda..dd577137599a 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakefulnessModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/WakefulnessModel.kt
@@ -27,7 +27,11 @@ data class WakefulnessModel(
fun isStartingToSleep() = state == WakefulnessState.STARTING_TO_SLEEP
- fun isStartingToSleepOrAsleep() = isStartingToSleep() || state == WakefulnessState.ASLEEP
+ private fun isAsleep() = state == WakefulnessState.ASLEEP
+
+ fun isStartingToSleepOrAsleep() = isStartingToSleep() || isAsleep()
+
+ fun isDeviceInteractive() = !isAsleep()
fun isStartingToSleepFromPowerButton() =
isStartingToSleep() && lastWakeReason == WakeSleepReason.POWER_BUTTON
@@ -41,6 +45,11 @@ data class WakefulnessModel(
fun isAwakeFromTap() =
state == WakefulnessState.STARTING_TO_WAKE && lastWakeReason == WakeSleepReason.TAP
+ fun isDeviceInteractiveFromTapOrGesture(): Boolean {
+ return isDeviceInteractive() &&
+ (lastWakeReason == WakeSleepReason.TAP || lastWakeReason == WakeSleepReason.GESTURE)
+ }
+
companion object {
fun fromWakefulnessLifecycle(wakefulnessLifecycle: WakefulnessLifecycle): WakefulnessModel {
return WakefulnessModel(
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 1174d3d932ae..8d16ca72ff58 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -134,6 +134,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants;
import com.android.systemui.keyguard.shared.model.TransitionState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
+import com.android.systemui.keyguard.shared.model.WakefulnessModel;
import com.android.systemui.keyguard.ui.binder.KeyguardLongPressViewBinder;
import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel;
import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingTransitionViewModel;
@@ -2150,10 +2151,14 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
}
int getFalsingThreshold() {
- float factor = mCentralSurfaces.isWakeUpComingFromTouch() ? 1.5f : 1.0f;
+ float factor = ShadeViewController.getFalsingThresholdFactor(getWakefulness());
return (int) (mQsController.getFalsingThreshold() * factor);
}
+ private WakefulnessModel getWakefulness() {
+ return mKeyguardInteractor.getWakefulnessModel().getValue();
+ }
+
private void maybeAnimateBottomAreaAlpha() {
mBottomAreaShadeAlphaAnimator.cancel();
if (mBarState == StatusBarState.SHADE_LOCKED) {
@@ -3587,8 +3592,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
expand = flingExpands(vel, vectorVel, x, y);
}
- mDozeLog.traceFling(expand, mTouchAboveFalsingThreshold,
- mCentralSurfaces.isWakeUpComingFromTouch());
+ mDozeLog.traceFling(
+ expand,
+ mTouchAboveFalsingThreshold,
+ /* screenOnFromTouch=*/ getWakefulness().isDeviceInteractiveFromTapOrGesture());
// Log collapse gesture if on lock screen.
if (!expand && onKeyguard) {
float displayDensity = mCentralSurfaces.getDisplayDensity();
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
index 203355e71021..0548180807ab 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
@@ -17,6 +17,7 @@ package com.android.systemui.shade
import android.view.MotionEvent
import android.view.ViewGroup
+import com.android.systemui.keyguard.shared.model.WakefulnessModel
import com.android.systemui.statusbar.RemoteInputController
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
@@ -218,6 +219,16 @@ interface ShadeViewController {
val shadeNotificationPresenter: ShadeNotificationPresenter
companion object {
+ /**
+ * Returns a multiplicative factor to use when determining the falsing threshold for touches
+ * on the shade. The factor will be larger when the device is waking up due to a touch or
+ * gesture.
+ */
+ @JvmStatic
+ fun getFalsingThresholdFactor(wakefulness: WakefulnessModel): Float {
+ return if (wakefulness.isDeviceInteractiveFromTapOrGesture()) 1.5f else 1.0f
+ }
+
const val WAKEUP_ANIMATION_DELAY_MS = 250
const val FLING_MAX_LENGTH_SECONDS = 0.6f
const val FLING_SPEED_UP_FACTOR = 0.6f
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index 7b046d6c9256..a52c84300b4d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -61,6 +61,7 @@ import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
+import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.media.controls.ui.KeyguardMediaController;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.FalsingManager;
@@ -69,6 +70,7 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.OnMenuEv
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shade.ShadeController;
+import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener;
@@ -170,6 +172,7 @@ public class NotificationStackScrollLayoutController {
private final KeyguardMediaController mKeyguardMediaController;
private final SysuiStatusBarStateController mStatusBarStateController;
private final KeyguardBypassController mKeyguardBypassController;
+ private final KeyguardInteractor mKeyguardInteractor;
private final NotificationLockscreenUserManager mLockscreenUserManager;
// TODO: CentralSurfaces should be encapsulated behind a Controller
private final CentralSurfaces mCentralSurfaces;
@@ -558,7 +561,8 @@ public class NotificationStackScrollLayoutController {
@Override
public float getFalsingThresholdFactor() {
- return mCentralSurfaces.isWakeUpComingFromTouch() ? 1.5f : 1.0f;
+ return ShadeViewController.getFalsingThresholdFactor(
+ mKeyguardInteractor.getWakefulnessModel().getValue());
}
@Override
@@ -622,6 +626,7 @@ public class NotificationStackScrollLayoutController {
SysuiStatusBarStateController statusBarStateController,
KeyguardMediaController keyguardMediaController,
KeyguardBypassController keyguardBypassController,
+ KeyguardInteractor keyguardInteractor,
ZenModeController zenModeController,
NotificationLockscreenUserManager lockscreenUserManager,
Optional<NotificationListViewModel> nsslViewModel,
@@ -669,6 +674,7 @@ public class NotificationStackScrollLayoutController {
mStatusBarStateController = statusBarStateController;
mKeyguardMediaController = keyguardMediaController;
mKeyguardBypassController = keyguardBypassController;
+ mKeyguardInteractor = keyguardInteractor;
mZenModeController = zenModeController;
mLockscreenUserManager = lockscreenUserManager;
mViewModel = nsslViewModel;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
index 0b02f33daeae..118e961acd24 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -224,8 +224,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {
boolean isLaunchingActivityOverLockscreen();
- boolean isWakeUpComingFromTouch();
-
void onKeyguardViewManagerStatesUpdated();
boolean isPulsing();
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 fde08bde5d17..c220fd2aafe2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -466,8 +466,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
private final LightRevealScrim mLightRevealScrim;
private PowerButtonReveal mPowerButtonReveal;
- private boolean mWakeUpComingFromTouch;
-
/**
* Whether we should delay the wakeup animation (which shows the notifications and moves the
* clock view). This is typically done when waking up from a 'press to unlock' gesture on a
@@ -1625,7 +1623,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
if (mDozing && mScreenOffAnimationController.allowWakeUpIfDozing()) {
mPowerManager.wakeUp(
time, wakeReason, "com.android.systemui:" + why);
- mWakeUpComingFromTouch = true;
mFalsingCollector.onScreenOnFromTouch();
}
}
@@ -1802,11 +1799,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
return mIsLaunchingActivityOverLockscreen;
}
- @Override
- public boolean isWakeUpComingFromTouch() {
- return mWakeUpComingFromTouch;
- }
-
/**
* To be called when there's a state change in StatusBarKeyguardViewManager.
*/
@@ -1935,7 +1927,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
SystemClock.uptimeMillis(),
PowerManager.WAKE_REASON_APPLICATION,
"com.android.systemui:full_screen_intent");
- mWakeUpComingFromTouch = false;
}
}
@@ -3116,7 +3107,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
releaseGestureWakeLock();
mLaunchCameraWhenFinishedWaking = false;
mDeviceInteractive = false;
- mWakeUpComingFromTouch = false;
updateVisibleToUser();
updateNotificationPanelTouchState();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
index 41351e53e0c8..ee382d30c1dd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
@@ -315,6 +315,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
protected final int mMaxUdfpsBurnInOffsetY = 5;
protected KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor;
+ protected FakeKeyguardRepository mFakeKeyguardRepository;
protected KeyguardInteractor mKeyguardInteractor;
protected NotificationPanelViewController.TouchHandler mTouchHandler;
protected ConfigurationController mConfigurationController;
@@ -342,10 +343,12 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
public void setup() {
MockitoAnnotations.initMocks(this);
mMainDispatcher = getMainDispatcher();
- mKeyguardBottomAreaInteractor = new KeyguardBottomAreaInteractor(
- new FakeKeyguardRepository());
+ KeyguardInteractorFactory.WithDependencies keyguardInteractorDeps =
+ KeyguardInteractorFactory.create();
+ mFakeKeyguardRepository = keyguardInteractorDeps.getRepository();
+ mKeyguardBottomAreaInteractor = new KeyguardBottomAreaInteractor(mFakeKeyguardRepository);
+ mKeyguardInteractor = keyguardInteractorDeps.getKeyguardInteractor();
- mKeyguardInteractor = KeyguardInteractorFactory.create().getKeyguardInteractor();
SystemClock systemClock = new FakeSystemClock();
mStatusBarStateController = new StatusBarStateControllerImpl(mUiEventLogger, mDumpManager,
mInteractionJankMonitor, mShadeExpansionStateManager);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
index a5a9de54c558..b1f8475f7d74 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
@@ -58,6 +58,9 @@ import androidx.test.filters.SmallTest;
import com.android.keyguard.FaceAuthApiRequestReason;
import com.android.systemui.DejankUtils;
import com.android.systemui.R;
+import com.android.systemui.keyguard.shared.model.WakeSleepReason;
+import com.android.systemui.keyguard.shared.model.WakefulnessModel;
+import com.android.systemui.keyguard.shared.model.WakefulnessState;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener;
@@ -1162,4 +1165,43 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
when(mUnlockedScreenOffAnimationController.isAnimationPlaying()).thenReturn(true);
assertThat(mNotificationPanelViewController.isExpanded()).isTrue();
}
+
+ @Test
+ public void getFalsingThreshold_deviceNotInteractive_isQsThreshold() {
+ mFakeKeyguardRepository.setWakefulnessModel(
+ new WakefulnessModel(
+ WakefulnessState.ASLEEP,
+ /* lastWakeReason= */ WakeSleepReason.TAP,
+ /* lastSleepReason= */ WakeSleepReason.POWER_BUTTON)
+ );
+ when(mQsController.getFalsingThreshold()).thenReturn(14);
+
+ assertThat(mNotificationPanelViewController.getFalsingThreshold()).isEqualTo(14);
+ }
+
+ @Test
+ public void getFalsingThreshold_lastWakeNotDueToTouch_isQsThreshold() {
+ mFakeKeyguardRepository.setWakefulnessModel(
+ new WakefulnessModel(
+ WakefulnessState.AWAKE,
+ /* lastWakeReason= */ WakeSleepReason.POWER_BUTTON,
+ /* lastSleepReason= */ WakeSleepReason.POWER_BUTTON)
+ );
+ when(mQsController.getFalsingThreshold()).thenReturn(14);
+
+ assertThat(mNotificationPanelViewController.getFalsingThreshold()).isEqualTo(14);
+ }
+
+ @Test
+ public void getFalsingThreshold_lastWakeDueToTouch_greaterThanQsThreshold() {
+ mFakeKeyguardRepository.setWakefulnessModel(
+ new WakefulnessModel(
+ WakefulnessState.AWAKE,
+ /* lastWakeReason= */ WakeSleepReason.TAP,
+ /* lastSleepReason= */ WakeSleepReason.POWER_BUTTON)
+ );
+ when(mQsController.getFalsingThreshold()).thenReturn(14);
+
+ assertThat(mNotificationPanelViewController.getFalsingThreshold()).isGreaterThan(14);
+ }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java
index 6a0e3c6d51eb..9938fa8700fd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java
@@ -47,6 +47,7 @@ import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
+import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.media.controls.ui.KeyguardMediaController;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
@@ -117,6 +118,7 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
@Mock private KeyguardMediaController mKeyguardMediaController;
@Mock private SysuiStatusBarStateController mSysuiStatusBarStateController;
@Mock private KeyguardBypassController mKeyguardBypassController;
+ @Mock private KeyguardInteractor mKeyguardInteractor;
@Mock private NotificationLockscreenUserManager mNotificationLockscreenUserManager;
@Mock private MetricsLogger mMetricsLogger;
@Mock private DumpManager mDumpManager;
@@ -463,6 +465,7 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
mSysuiStatusBarStateController,
mKeyguardMediaController,
mKeyguardBypassController,
+ mKeyguardInteractor,
mZenModeController,
mNotificationLockscreenUserManager,
Optional.<NotificationListViewModel>empty(),