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

Commit e9f4e96c authored by Heemin Seog's avatar Heemin Seog
Browse files

Move dozing related methods out of ShadeController

isDozing is already provided by StatusBarStateController.
wakeUpIfDozing doesn't need to be in ShadeController and can stay in
StatusBar for now (potentially move into a dozing related controller in
the future?)

Bug: 144702768
Test: manual, atest SystemUITests
Change-Id: I8f7d6a452388308de5fdd1adfbcd200fd3076a2f
parent 3f9ba67f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ public interface StatusBarStateController {
    int getState();

    /**
     * Is device dozing
     * Is device dozing. Dozing is when the screen is in AOD or asleep given that
     * {@link com.android.systemui.doze.DozeService} is configured.
     */
    boolean isDozing();

+3 −11
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ScrimState;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
@@ -105,9 +104,6 @@ public class NotificationMediaManager implements Dumpable {

    private final NotificationEntryManager mEntryManager;

    // Late binding, also @Nullable due to being in com.android.systemui.statusbar.phone package
    @Nullable
    private Lazy<ShadeController> mShadeController;
    @Nullable
    private Lazy<StatusBarWindowController> mStatusBarWindowController;

@@ -183,7 +179,6 @@ public class NotificationMediaManager implements Dumpable {
    @Inject
    public NotificationMediaManager(
            Context context,
            Lazy<ShadeController> shadeController,
            Lazy<StatusBar> statusBarLazy,
            Lazy<StatusBarWindowController> statusBarWindowController,
            NotificationEntryManager notificationEntryManager,
@@ -193,11 +188,10 @@ public class NotificationMediaManager implements Dumpable {
        mMediaArtworkProcessor = mediaArtworkProcessor;
        mKeyguardBypassController = keyguardBypassController;
        mMediaListeners = new ArrayList<>();
        mMediaSessionManager
                = (MediaSessionManager) mContext.getSystemService(Context.MEDIA_SESSION_SERVICE);
        // TODO: use MediaSessionManager.SessionListener to hook us up to future updates
        // in session state
        mShadeController = shadeController;
        mMediaSessionManager = (MediaSessionManager) mContext.getSystemService(
                Context.MEDIA_SESSION_SERVICE);
        // TODO: use KeyguardStateController#isOccluded to remove this dependency
        mStatusBarLazy = statusBarLazy;
        mStatusBarWindowController = statusBarWindowController;
@@ -603,9 +597,7 @@ public class NotificationMediaManager implements Dumpable {
                if (DEBUG_MEDIA) {
                    Log.v(TAG, "DEBUG_MEDIA: Fading out album artwork");
                }
                ShadeController shadeController = mShadeController.get();
                boolean cannotAnimateDoze = shadeController != null
                        && shadeController.isDozing()
                boolean cannotAnimateDoze = mStatusBarStateController.isDozing()
                        && !ScrimState.AOD.getAnimateChange();
                boolean needsBypassFading = mKeyguardStateController.isBypassFadingAnimation();
                if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode()
+5 −5
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry.EditedSuggestionInfo;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.RemoteInputView;

@@ -116,7 +116,7 @@ public class NotificationRemoteInputManager implements Dumpable {
    private final NotificationEntryManager mEntryManager;
    private final Handler mMainHandler;

    private final Lazy<ShadeController> mShadeController;
    private final Lazy<StatusBar> mStatusBarLazy;

    protected final Context mContext;
    private final UserManager mUserManager;
@@ -136,7 +136,7 @@ public class NotificationRemoteInputManager implements Dumpable {
        @Override
        public boolean onClickHandler(
                View view, PendingIntent pendingIntent, RemoteViews.RemoteResponse response) {
            mShadeController.get().wakeUpIfDozing(SystemClock.uptimeMillis(), view,
            mStatusBarLazy.get().wakeUpIfDozing(SystemClock.uptimeMillis(), view,
                    "NOTIFICATION_CLICK");

            if (handleRemoteInput(view, pendingIntent)) {
@@ -261,7 +261,7 @@ public class NotificationRemoteInputManager implements Dumpable {
            NotificationLockscreenUserManager lockscreenUserManager,
            SmartReplyController smartReplyController,
            NotificationEntryManager notificationEntryManager,
            Lazy<ShadeController> shadeController,
            Lazy<StatusBar> statusBarLazy,
            StatusBarStateController statusBarStateController,
            @MainHandler Handler mainHandler,
            RemoteInputUriController remoteInputUriController) {
@@ -269,7 +269,7 @@ public class NotificationRemoteInputManager implements Dumpable {
        mLockscreenUserManager = lockscreenUserManager;
        mSmartReplyController = smartReplyController;
        mEntryManager = notificationEntryManager;
        mShadeController = shadeController;
        mStatusBarLazy = statusBarLazy;
        mMainHandler = mainHandler;
        mBarService = IStatusBarService.Stub.asInterface(
                ServiceManager.getService(Context.STATUS_BAR_SERVICE));
+1 −1
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ constructor(
            setUserLocked(mStartingChild!!, false)
            mStartingChild = null
        }
        if (shadeController.isDozing) {
        if (statusBarStateController.isDozing) {
            isWakingToShadeLocked = true
            wakeUpCoordinator.willWakeUp = true
            mPowerManager!!.wakeUp(SystemClock.uptimeMillis(), WAKE_REASON_GESTURE,
+5 −7
Original line number Diff line number Diff line
@@ -24,18 +24,16 @@ import android.service.notification.StatusBarNotification;
import android.util.Log;

import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.policy.HeadsUpManager;

import javax.inject.Inject;
import javax.inject.Singleton;

import dagger.Lazy;

/** Handles heads-up and pulsing behavior driven by notification changes. */
@Singleton
public class NotificationAlertingManager {
@@ -44,7 +42,7 @@ public class NotificationAlertingManager {

    private final NotificationRemoteInputManager mRemoteInputManager;
    private final VisualStabilityManager mVisualStabilityManager;
    private final Lazy<ShadeController> mShadeController;
    private final StatusBarStateController mStatusBarStateController;
    private final NotificationInterruptionStateProvider mNotificationInterruptionStateProvider;
    private final NotificationListener mNotificationListener;

@@ -55,12 +53,12 @@ public class NotificationAlertingManager {
            NotificationEntryManager notificationEntryManager,
            NotificationRemoteInputManager remoteInputManager,
            VisualStabilityManager visualStabilityManager,
            Lazy<ShadeController> shadeController,
            StatusBarStateController statusBarStateController,
            NotificationInterruptionStateProvider notificationInterruptionStateProvider,
            NotificationListener notificationListener) {
        mRemoteInputManager = remoteInputManager;
        mVisualStabilityManager = visualStabilityManager;
        mShadeController = shadeController;
        mStatusBarStateController = statusBarStateController;
        mNotificationInterruptionStateProvider = notificationInterruptionStateProvider;
        mNotificationListener = notificationListener;

@@ -102,7 +100,7 @@ public class NotificationAlertingManager {
            // If it does and we no longer need to heads up, we should free the view.
            if (mNotificationInterruptionStateProvider.shouldHeadsUp(entry)) {
                mHeadsUpManager.showNotification(entry);
                if (!mShadeController.get().isDozing()) {
                if (!mStatusBarStateController.isDozing()) {
                    // Mark as seen immediately
                    setNotificationShown(entry.getSbn());
                }
Loading