Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8719c9f1 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Automerger Merge Worker
Browse files

Merge changes from topic "caitlinshk-csi-wakeupifdozing" into udc-qpr-dev am:...

Merge changes from topic "caitlinshk-csi-wakeupifdozing" into udc-qpr-dev am: ac3b6993 am: cb656cad

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23604362



Change-Id: I88909cf6152b891efa755641b5099be84a45bbdd
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 91e19836 cb656cad
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -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();

+1 −20
Original line number Diff line number Diff line
@@ -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) {
+0 −29
Original line number Diff line number Diff line
@@ -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);