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

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

[Central Surfaces] Move NotifRemoteInputManager wake to PowerInteractor. am: c21fbef2

parents 2705f30b c21fbef2
Loading
Loading
Loading
Loading
+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,
+5 −8
Original line number Diff line number Diff line
@@ -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<Optional<CentralSurfaces>> 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,