[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
This commit is contained in:
Caitlin Shkuratov
2023-06-07 17:12:19 +00:00
parent 31ec6e8177
commit 570617e9f1
3 changed files with 1 additions and 59 deletions

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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);