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

Commit ac3b6993 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

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

* changes:
  [Central Surfaces] Delete #wakeUpIfDozing.
  [Central Surfaces] Move NotifShadeWVC wake to PowerInteractor.
  [Central Surfaces] Move SBNotifPresenter wake to PowerInteractor.
  [Central Surfaces] Move NotifRemoteInputManager wake to PowerInteractor.
parents 07d1de00 570617e9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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> 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);
                        }
+6 −14
Original line number Diff line number Diff line
@@ -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<Optional<CentralSurfaces>> 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<Optional<CentralSurfaces>> 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));
+7 −6
Original line number Diff line number Diff line
@@ -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<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            PowerInteractor powerInteractor,
            StatusBarStateController statusBarStateController,
            RemoteInputUriController remoteInputUriController,
            RemoteInputControllerLogger remoteInputControllerLogger,
@@ -117,7 +118,7 @@ public interface CentralSurfacesDependenciesModule {
                lockscreenUserManager,
                smartReplyController,
                visibilityProvider,
                centralSurfacesOptionalLazy,
                powerInteractor,
                statusBarStateController,
                remoteInputUriController,
                remoteInputControllerLogger,
+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) {
Loading