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

Commit cb656cad 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: ac3b6993

parents 5958d921 ac3b6993
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.UserHandle;
import android.os.UserHandle;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.MotionEvent;
@@ -43,7 +42,6 @@ import com.android.systemui.Dumpable;
import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.navigationbar.NavigationBarView;
import com.android.systemui.navigationbar.NavigationBarView;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
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.qs.QSPanelController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
@@ -196,14 +194,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {
    @Override
    @Override
    Lifecycle getLifecycle();
    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();
    ShadeViewController getShadeViewController();


+1 −20
Original line number Original line Diff line number Diff line
@@ -1597,24 +1597,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mCommandQueue.disable(mDisplayId, state1, state2, false /* animate */);
        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.
    // TODO(b/117478341): This was left such that CarStatusBar can override this method.
    // Try to remove this.
    // Try to remove this.
    protected void createNavigationBar(@Nullable RegisterStatusBarResult result) {
    protected void createNavigationBar(@Nullable RegisterStatusBarResult result) {
@@ -2907,8 +2889,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mStatusBarHideIconsForBouncerManager.setBouncerShowingAndTriggerUpdate(bouncerShowing);
        mStatusBarHideIconsForBouncerManager.setBouncerShowingAndTriggerUpdate(bouncerShowing);
        mCommandQueue.recomputeDisableFlags(mDisplayId, true /* animate */);
        mCommandQueue.recomputeDisableFlags(mDisplayId, true /* animate */);
        if (mBouncerShowing) {
        if (mBouncerShowing) {
            wakeUpIfDozing(SystemClock.uptimeMillis(), "BOUNCER_VISIBLE",
            mPowerInteractor.wakeUpIfDozing("BOUNCER_VISIBLE", PowerManager.WAKE_REASON_GESTURE);
                    PowerManager.WAKE_REASON_GESTURE);
        }
        }
        updateScrimController();
        updateScrimController();
        if (!mBouncerShowing) {
        if (!mBouncerShowing) {
+0 −29
Original line number Original line 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.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.clearInvocations;
@@ -1252,34 +1251,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
        verify(mStatusBarStateController).setState(SHADE);
        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
    @Test
    public void frpLockedDevice_shadeDisabled() {
    public void frpLockedDevice_shadeDisabled() {
        when(mDeviceProvisionedController.isFrpActive()).thenReturn(true);
        when(mDeviceProvisionedController.isFrpActive()).thenReturn(true);