From c21fbef2f0bfdc653231ebef955ad63f77681adf Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Wed, 7 Jun 2023 16:47:36 +0000 Subject: [PATCH 1/4] [Central Surfaces] Move NotifRemoteInputManager wake to PowerInteractor. Bug: 277764509 Test: Receive notif with inline reply action while on AOD -> tap on reply action -> verify PowerInteractor#wakeUpIfDozing called and device wakes Test: atest NotificationRemoteInputManagerTest Change-Id: I6b48c3fafe50f0ac72a60c6bd7157eec0f490ae5 Change-Id: I7f5cd5548133c6a7ae32153d25f1a7922f6a0329 --- .../NotificationRemoteInputManager.java | 20 ++++++------------- .../CentralSurfacesDependenciesModule.java | 13 ++++++------ .../NotificationRemoteInputManagerTest.java | 13 +++++------- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index 406db18c43dd4..da84afef42c5c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -27,7 +27,6 @@ import android.content.pm.UserInfo; import android.os.PowerManager; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserManager; import android.service.notification.StatusBarNotification; @@ -52,6 +51,7 @@ import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.statusbar.dagger.CentralSurfacesDependenciesModule; import com.android.systemui.statusbar.notification.NotifPipelineFlags; import com.android.systemui.statusbar.notification.RemoteInputControllerLogger; @@ -60,19 +60,15 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry. import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; -import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.statusbar.policy.RemoteInputView; import com.android.systemui.util.DumpUtilsKt; import com.android.systemui.util.ListenerSet; -import dagger.Lazy; - import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import java.util.Optional; import java.util.function.Consumer; /** @@ -95,10 +91,8 @@ public class NotificationRemoteInputManager implements Dumpable { private final NotificationLockscreenUserManager mLockscreenUserManager; private final SmartReplyController mSmartReplyController; private final NotificationVisibilityProvider mVisibilityProvider; + private final PowerInteractor mPowerInteractor; private final ActionClickLogger mLogger; - - private final Lazy> mCentralSurfacesOptionalLazy; - protected final Context mContext; protected final NotifPipelineFlags mNotifPipelineFlags; private final UserManager mUserManager; @@ -122,10 +116,8 @@ public class NotificationRemoteInputManager implements Dumpable { @Override public boolean onInteraction( View view, PendingIntent pendingIntent, RemoteViews.RemoteResponse response) { - mCentralSurfacesOptionalLazy.get().ifPresent( - centralSurfaces -> centralSurfaces.wakeUpIfDozing( - SystemClock.uptimeMillis(), "NOTIFICATION_CLICK", - PowerManager.WAKE_REASON_GESTURE)); + mPowerInteractor.wakeUpIfDozing( + "NOTIFICATION_CLICK", PowerManager.WAKE_REASON_GESTURE); final NotificationEntry entry = getNotificationForParent(view.getParent()); mLogger.logInitialClick(entry, pendingIntent); @@ -259,7 +251,7 @@ public class NotificationRemoteInputManager implements Dumpable { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationVisibilityProvider visibilityProvider, - Lazy> centralSurfacesOptionalLazy, + PowerInteractor powerInteractor, StatusBarStateController statusBarStateController, RemoteInputUriController remoteInputUriController, RemoteInputControllerLogger remoteInputControllerLogger, @@ -271,7 +263,7 @@ public class NotificationRemoteInputManager implements Dumpable { mLockscreenUserManager = lockscreenUserManager; mSmartReplyController = smartReplyController; mVisibilityProvider = visibilityProvider; - mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; + mPowerInteractor = powerInteractor; mLogger = logger; mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java index 73eba0ee96755..075b41b91d970 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java @@ -28,6 +28,7 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.animation.AnimationFeatureFlags; import com.android.systemui.animation.DialogLaunchAnimator; +import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; @@ -35,10 +36,10 @@ import com.android.systemui.dump.DumpHandler; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; -import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.media.controls.pipeline.MediaDataManager; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.settings.DisplayTracker; import com.android.systemui.shade.carrier.ShadeCarrierGroupController; import com.android.systemui.statusbar.ActionClickLogger; @@ -79,14 +80,14 @@ import com.android.systemui.tracing.ProtoTracer; import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.time.SystemClock; -import java.util.Optional; -import java.util.concurrent.Executor; - import dagger.Binds; import dagger.Lazy; import dagger.Module; import dagger.Provides; +import java.util.Optional; +import java.util.concurrent.Executor; + /** * This module provides instances needed to construct {@link CentralSurfacesImpl}. These are moved to * this separate from {@link CentralSurfacesModule} module so that components that wish to build @@ -104,7 +105,7 @@ public interface CentralSurfacesDependenciesModule { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationVisibilityProvider visibilityProvider, - Lazy> centralSurfacesOptionalLazy, + PowerInteractor powerInteractor, StatusBarStateController statusBarStateController, RemoteInputUriController remoteInputUriController, RemoteInputControllerLogger remoteInputControllerLogger, @@ -117,7 +118,7 @@ public interface CentralSurfacesDependenciesModule { lockscreenUserManager, smartReplyController, visibilityProvider, - centralSurfacesOptionalLazy, + powerInteractor, statusBarStateController, remoteInputUriController, remoteInputControllerLogger, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java index ced07348c27a0..305f48b147f8b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java @@ -33,25 +33,21 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.statusbar.notification.NotifPipelineFlags; import com.android.systemui.statusbar.notification.RemoteInputControllerLogger; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; -import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.policy.RemoteInputUriController; -import dagger.Lazy; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import java.util.Optional; - @SmallTest @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper @@ -69,6 +65,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { @Mock private RemoteInputUriController mRemoteInputUriController; @Mock private NotificationClickNotifier mClickNotifier; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; + @Mock private PowerInteractor mPowerInteractor; private TestableNotificationRemoteInputManager mRemoteInputManager; private NotificationEntry mEntry; @@ -82,7 +79,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { mLockscreenUserManager, mSmartReplyController, mVisibilityProvider, - () -> Optional.of(mock(CentralSurfaces.class)), + mPowerInteractor, mStateController, mRemoteInputUriController, mock(RemoteInputControllerLogger.class), @@ -140,7 +137,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationVisibilityProvider visibilityProvider, - Lazy> centralSurfacesOptionalLazy, + PowerInteractor powerInteractor, StatusBarStateController statusBarStateController, RemoteInputUriController remoteInputUriController, RemoteInputControllerLogger remoteInputControllerLogger, @@ -153,7 +150,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { lockscreenUserManager, smartReplyController, visibilityProvider, - centralSurfacesOptionalLazy, + powerInteractor, statusBarStateController, remoteInputUriController, remoteInputControllerLogger, From 0dfd911049edb410ccbfb21b2716e64a4e08481a Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Wed, 7 Jun 2023 16:54:12 +0000 Subject: [PATCH 2/4] [Central Surfaces] Move SBNotifPresenter wake to PowerInteractor. Bug: 277764509 Test: receive notif that can be expanded while on AOD -> tap on expand button -> verify PowerInteractor#wakeUpIfDozing is called and device wakes Test: atest StatusBarNotificationPresenterTest Change-Id: I7452a61853bf974eb2028ae2aac64a24f544a94d Change-Id: Ide43c6140774003e3b9aba50a7a329630442a30b --- .../statusbar/phone/StatusBarNotificationPresenter.java | 9 +++++---- .../phone/StatusBarNotificationPresenterTest.java | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java index d366cbfaa39d0..35285b222f63c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java @@ -22,7 +22,6 @@ import android.content.Context; import android.os.PowerManager; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.SystemClock; import android.service.notification.StatusBarNotification; import android.service.vr.IVrManager; import android.service.vr.IVrStateCallbacks; @@ -36,6 +35,7 @@ import com.android.systemui.InitController; import com.android.systemui.R; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; +import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.shade.NotificationShadeWindowView; import com.android.systemui.shade.QuickSettingsController; import com.android.systemui.shade.ShadeViewController; @@ -86,6 +86,7 @@ class StatusBarNotificationPresenter implements NotificationPresenter, CommandQu private final CentralSurfaces mCentralSurfaces; private final NotificationsInteractor mNotificationsInteractor; private final LockscreenShadeTransitionController mShadeTransitionController; + private final PowerInteractor mPowerInteractor; private final CommandQueue mCommandQueue; private final AccessibilityManager mAccessibilityManager; @@ -115,6 +116,7 @@ class StatusBarNotificationPresenter implements NotificationPresenter, CommandQu CentralSurfaces centralSurfaces, NotificationsInteractor notificationsInteractor, LockscreenShadeTransitionController shadeTransitionController, + PowerInteractor powerInteractor, CommandQueue commandQueue, NotificationLockscreenUserManager lockscreenUserManager, SysuiStatusBarStateController sysuiStatusBarStateController, @@ -138,6 +140,7 @@ class StatusBarNotificationPresenter implements NotificationPresenter, CommandQu mCentralSurfaces = centralSurfaces; mNotificationsInteractor = notificationsInteractor; mShadeTransitionController = shadeTransitionController; + mPowerInteractor = powerInteractor; mCommandQueue = commandQueue; mLockscreenUserManager = lockscreenUserManager; mStatusBarStateController = sysuiStatusBarStateController; @@ -238,9 +241,7 @@ class StatusBarNotificationPresenter implements NotificationPresenter, CommandQu public void onExpandClicked(NotificationEntry clickedEntry, View clickedView, boolean nowExpanded) { mHeadsUpManager.setExpanded(clickedEntry, nowExpanded); - mCentralSurfaces.wakeUpIfDozing( - SystemClock.uptimeMillis(), "NOTIFICATION_CLICK", - PowerManager.WAKE_REASON_GESTURE); + mPowerInteractor.wakeUpIfDozing("NOTIFICATION_CLICK", PowerManager.WAKE_REASON_GESTURE); if (nowExpanded) { if (mStatusBarStateController.getState() == StatusBarState.KEYGUARD) { mShadeTransitionController.goToLockedShade(clickedEntry.getRow()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java index dfbe0471196ed..5bd6ff4e73f27 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java @@ -37,6 +37,7 @@ import com.android.systemui.InitController; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.settings.FakeDisplayTracker; import com.android.systemui.shade.NotificationShadeWindowView; import com.android.systemui.shade.QuickSettingsController; @@ -127,6 +128,7 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase { mCentralSurfaces, mNotificationsInteractor, mock(LockscreenShadeTransitionController.class), + mock(PowerInteractor.class), mCommandQueue, mock(NotificationLockscreenUserManager.class), mock(SysuiStatusBarStateController.class), From 31ec6e81778eb7c67b452467920deb7a5b20d912 Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Wed, 7 Jun 2023 16:58:31 +0000 Subject: [PATCH 3/4] [Central Surfaces] Move NotifShadeWVC wake to PowerInteractor. Bug: 277764509 Test: Have UDFPS enrolled; put device in lockdown mode (Power menu -> lockdown) -> go to AOD -> hold down on fingerprint sensor -> verify PowerInteractor notified and device wakes Test: atest NotificationShadeWindowViewTest NotificationShadeWindowViewControllerTest Change-Id: I2f85f5b5551f58c679f718ea4755c10811f1686b --- .../shade/NotificationShadeWindowViewController.java | 7 +++++-- .../shade/NotificationShadeWindowViewControllerTest.kt | 3 +++ .../systemui/shade/NotificationShadeWindowViewTest.kt | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java index ade59d7d85bb4..5c41d572149cc 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java @@ -58,6 +58,7 @@ import com.android.systemui.log.BouncerLogger; import com.android.systemui.multishade.domain.interactor.MultiShadeInteractor; import com.android.systemui.multishade.domain.interactor.MultiShadeMotionEventInteractor; import com.android.systemui.multishade.ui.view.MultiShadeView; +import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.shared.animation.DisableSubpixelTextTransitionListener; import com.android.systemui.statusbar.DragDownHelper; import com.android.systemui.statusbar.LockscreenShadeTransitionController; @@ -113,6 +114,7 @@ public class NotificationShadeWindowViewController { private PhoneStatusBarViewController mStatusBarViewController; private final CentralSurfaces mService; private final BackActionInteractor mBackActionInteractor; + private final PowerInteractor mPowerInteractor; private final NotificationShadeWindowController mNotificationShadeWindowController; private DragDownHelper mDragDownHelper; private boolean mExpandingBelowNotch; @@ -147,6 +149,7 @@ public class NotificationShadeWindowViewController { LockIconViewController lockIconViewController, CentralSurfaces centralSurfaces, BackActionInteractor backActionInteractor, + PowerInteractor powerInteractor, NotificationShadeWindowController controller, Optional unfoldTransitionProgressProvider, KeyguardUnlockAnimationController keyguardUnlockAnimationController, @@ -179,6 +182,7 @@ public class NotificationShadeWindowViewController { mBackActionInteractor = backActionInteractor; mLockIconViewController.init(); mService = centralSurfaces; + mPowerInteractor = powerInteractor; mNotificationShadeWindowController = controller; mKeyguardUnlockAnimationController = keyguardUnlockAnimationController; mAmbientState = ambientState; @@ -311,8 +315,7 @@ public class NotificationShadeWindowViewController { /* onGestureDetectedRunnable */ () -> { mService.userActivity(); - mService.wakeUpIfDozing( - mClock.uptimeMillis(), + mPowerInteractor.wakeUpIfDozing( "LOCK_ICON_TOUCH", PowerManager.WAKE_REASON_GESTURE); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt index c737a18ea8a26..2a9b403cb2e6e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt @@ -49,6 +49,7 @@ import com.android.systemui.multishade.data.remoteproxy.MultiShadeInputProxy import com.android.systemui.multishade.data.repository.MultiShadeRepository import com.android.systemui.multishade.domain.interactor.MultiShadeInteractor import com.android.systemui.multishade.domain.interactor.MultiShadeMotionEventInteractor +import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.shade.NotificationShadeWindowView.InteractionEventHandler import com.android.systemui.statusbar.LockscreenShadeTransitionController import com.android.systemui.statusbar.NotificationInsetsController @@ -93,6 +94,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { @Mock private lateinit var sysuiStatusBarStateController: SysuiStatusBarStateController @Mock private lateinit var centralSurfaces: CentralSurfaces @Mock private lateinit var backActionInteractor: BackActionInteractor + @Mock private lateinit var powerInteractor: PowerInteractor @Mock private lateinit var dockManager: DockManager @Mock private lateinit var notificationPanelViewController: NotificationPanelViewController @Mock private lateinit var notificationShadeDepthController: NotificationShadeDepthController @@ -174,6 +176,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { lockIconViewController, centralSurfaces, backActionInteractor, + powerInteractor, notificationShadeWindowController, unfoldTransitionProgressProvider, keyguardUnlockAnimationController, diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt index 1740284a26dd3..252a03bb07d2f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt @@ -48,6 +48,7 @@ import com.android.systemui.multishade.data.remoteproxy.MultiShadeInputProxy import com.android.systemui.multishade.data.repository.MultiShadeRepository import com.android.systemui.multishade.domain.interactor.MultiShadeInteractor import com.android.systemui.multishade.domain.interactor.MultiShadeMotionEventInteractor +import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.shade.NotificationShadeWindowView.InteractionEventHandler import com.android.systemui.statusbar.DragDownHelper import com.android.systemui.statusbar.LockscreenShadeTransitionController @@ -95,6 +96,7 @@ class NotificationShadeWindowViewTest : SysuiTestCase() { @Mock private lateinit var shadeController: ShadeController @Mock private lateinit var centralSurfaces: CentralSurfaces @Mock private lateinit var backActionInteractor: BackActionInteractor + @Mock private lateinit var powerInteractor: PowerInteractor @Mock private lateinit var dockManager: DockManager @Mock private lateinit var notificationPanelViewController: NotificationPanelViewController @Mock private lateinit var notificationStackScrollLayout: NotificationStackScrollLayout @@ -187,6 +189,7 @@ class NotificationShadeWindowViewTest : SysuiTestCase() { lockIconViewController, centralSurfaces, backActionInteractor, + powerInteractor, notificationShadeWindowController, unfoldTransitionProgressProvider, keyguardUnlockAnimationController, From 570617e9f1666adc7031de272a453edaa89b037a Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Wed, 7 Jun 2023 17:12:19 +0000 Subject: [PATCH 4/4] [Central Surfaces] Delete #wakeUpIfDozing. This moves the last #wakeUpIfDozing reference to PowerInteractor and removes the method. Bug: 277764509 Test: when bouncer shows, verify PowerInteractor is notified and device wakes up if necessary Test: atest CentralSurfacesImplTest Change-Id: I5dae113ffddfafd285aae7677dd2e0e770d51754 Change-Id: I98b76900c9b110ada4176f77aae2518c377950d1 --- .../statusbar/phone/CentralSurfaces.java | 10 ------- .../statusbar/phone/CentralSurfacesImpl.java | 21 +------------- .../phone/CentralSurfacesImplTest.java | 29 ------------------- 3 files changed, 1 insertion(+), 59 deletions(-) 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 630f1f43f8c75..d961263b50bf9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; -import android.os.PowerManager; import android.os.UserHandle; import android.view.KeyEvent; import android.view.MotionEvent; @@ -43,7 +42,6 @@ import com.android.systemui.Dumpable; import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.navigationbar.NavigationBarView; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; -import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.qs.QSPanelController; import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; @@ -196,14 +194,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner { @Override Lifecycle getLifecycle(); - /** - * Wakes up the device if the device was dozing. - * - * @deprecated Use {@link PowerInteractor#wakeUpIfDozing(String, int)} instead. - */ - @Deprecated - void wakeUpIfDozing(long time, String why, @PowerManager.WakeReason int wakeReason); - /** */ ShadeViewController getShadeViewController(); 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 9bae739af32b8..4247c30788af0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -1597,24 +1597,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mCommandQueue.disable(mDisplayId, state1, state2, false /* animate */); } - /** - * Ask the display to wake up if currently dozing, else do nothing - * - * @deprecated Use {@link PowerInteractor#wakeUpIfDozing(String, int)} instead. - * - * @param time when to wake up - * @param why the reason for the wake up - */ - @Override - @Deprecated - public void wakeUpIfDozing(long time, String why, @PowerManager.WakeReason int wakeReason) { - if (mDozing && mScreenOffAnimationController.allowWakeUpIfDozing()) { - mPowerManager.wakeUp( - time, wakeReason, "com.android.systemui:" + why); - mFalsingCollector.onScreenOnFromTouch(); - } - } - // TODO(b/117478341): This was left such that CarStatusBar can override this method. // Try to remove this. protected void createNavigationBar(@Nullable RegisterStatusBarResult result) { @@ -2907,8 +2889,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mStatusBarHideIconsForBouncerManager.setBouncerShowingAndTriggerUpdate(bouncerShowing); mCommandQueue.recomputeDisableFlags(mDisplayId, true /* animate */); if (mBouncerShowing) { - wakeUpIfDozing(SystemClock.uptimeMillis(), "BOUNCER_VISIBLE", - PowerManager.WAKE_REASON_GESTURE); + mPowerInteractor.wakeUpIfDozing("BOUNCER_VISIBLE", PowerManager.WAKE_REASON_GESTURE); } updateScrimController(); if (!mBouncerShowing) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index cc8324b220272..707b49c3ea960 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -29,7 +29,6 @@ import static junit.framework.TestCase.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.clearInvocations; @@ -1252,34 +1251,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase { verify(mStatusBarStateController).setState(SHADE); } - @Test - public void dozing_wakeUp() throws RemoteException { - // GIVEN can wakeup when dozing & is dozing - when(mScreenOffAnimationController.allowWakeUpIfDozing()).thenReturn(true); - setDozing(true); - - // WHEN wakeup is requested - final int wakeReason = PowerManager.WAKE_REASON_TAP; - mCentralSurfaces.wakeUpIfDozing(0, "", wakeReason); - - // THEN power manager receives wakeup - verify(mPowerManagerService).wakeUp(eq(0L), eq(wakeReason), anyString(), anyString()); - } - - @Test - public void notDozing_noWakeUp() throws RemoteException { - // GIVEN can wakeup when dozing and NOT dozing - when(mScreenOffAnimationController.allowWakeUpIfDozing()).thenReturn(true); - setDozing(false); - - // WHEN wakeup is requested - final int wakeReason = PowerManager.WAKE_REASON_TAP; - mCentralSurfaces.wakeUpIfDozing(0, "", wakeReason); - - // THEN power manager receives wakeup - verify(mPowerManagerService, never()).wakeUp(anyLong(), anyInt(), anyString(), anyString()); - } - @Test public void frpLockedDevice_shadeDisabled() { when(mDeviceProvisionedController.isFrpActive()).thenReturn(true);