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

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

Move isOccluded out of ShadeController

Eventually isOccluded should be removed from StatusBar in favor of
KeyguardStateController#isOccluded.

Bug: 145702729
Bug: 144702768
Test: build, atest SystemUITests
Change-Id: Ie906bf994e501bc53bd88ebeadd8c28ff9966225
parent 57253a47
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ 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;

@@ -122,6 +123,7 @@ public class NotificationMediaManager implements Dumpable {
    private final Context mContext;
    private final MediaSessionManager mMediaSessionManager;
    private final ArrayList<MediaListener> mMediaListeners;
    private final Lazy<StatusBar> mStatusBarLazy;
    private final MediaArtworkProcessor mMediaArtworkProcessor;
    private final Set<AsyncTask<?, ?, ?>> mProcessArtworkTasks = new ArraySet<>();

@@ -182,6 +184,7 @@ public class NotificationMediaManager implements Dumpable {
    public NotificationMediaManager(
            Context context,
            Lazy<ShadeController> shadeController,
            Lazy<StatusBar> statusBarLazy,
            Lazy<StatusBarWindowController> statusBarWindowController,
            NotificationEntryManager notificationEntryManager,
            MediaArtworkProcessor mediaArtworkProcessor,
@@ -195,6 +198,8 @@ public class NotificationMediaManager implements Dumpable {
        // TODO: use MediaSessionManager.SessionListener to hook us up to future updates
        // in session state
        mShadeController = shadeController;
        // TODO: use KeyguardStateController#isOccluded to remove this dependency
        mStatusBarLazy = statusBarLazy;
        mStatusBarWindowController = statusBarWindowController;
        mEntryManager = notificationEntryManager;
        notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@@ -526,9 +531,8 @@ public class NotificationMediaManager implements Dumpable {
            }
        }

        ShadeController shadeController = mShadeController.get();
        StatusBarWindowController windowController = mStatusBarWindowController.get();
        boolean hideBecauseOccluded = shadeController != null && shadeController.isOccluded();
        boolean hideBecauseOccluded = mStatusBarLazy.get().isOccluded();

        final boolean hasArtwork = artworkDrawable != null;
        mColorExtractor.setHasMediaArtwork(hasMediaArtwork);
@@ -599,6 +603,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()
                        && !ScrimState.AOD.getAnimateChange();
+0 −8
Original line number Diff line number Diff line
@@ -76,14 +76,6 @@ public interface ShadeController {
     */
    void goToKeyguard();

    /**
     * When the keyguard is showing and covered by something (bouncer, keyguard activity, etc.) it
     * is occluded. This is controlled by {@link com.android.server.policy.PhoneWindowManager}
     *
     * @return whether the keyguard is currently occluded
     */
    boolean isOccluded();

    /**
     * Notify the shade controller that the current user changed
     *
+9 −3
Original line number Diff line number Diff line
@@ -1233,7 +1233,8 @@ public class StatusBar extends SystemUI implements DemoMode,
        mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanel,
                mHeadsUpManager, mStatusBarWindow, mStackScroller, mDozeScrimController,
                mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController,
                mNotificationAlertingManager, rowBinder, mKeyguardStateController, mCommandQueue);
                mNotificationAlertingManager, rowBinder, mKeyguardStateController,
                this /* statusBar */, mCommandQueue);

        mNotificationListController =
                new NotificationListController(
@@ -1246,7 +1247,7 @@ public class StatusBar extends SystemUI implements DemoMode,

        mNotificationActivityStarter =
                mStatusBarNotificationActivityStarterBuilder
                        .setShadeController(this)
                        .setStatusBar(this)
                        .setActivityLaunchAnimator(mActivityLaunchAnimator)
                        .setNotificationPresenter(mPresenter)
                        .build();
@@ -1751,7 +1752,12 @@ public class StatusBar extends SystemUI implements DemoMode,
        return mAmbientIndicationContainer;
    }

    @Override
    /**
     * When the keyguard is showing and covered by a "showWhenLocked" activity it
     * is occluded. This is controlled by {@link com.android.server.policy.PhoneWindowManager}
     *
     * @return whether the keyguard is currently occluded
     */
    public boolean isOccluded() {
        return mIsOccluded;
    }
+15 −6
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
    private final NotificationRemoteInputManager mRemoteInputManager;
    private final NotificationLockscreenUserManager mLockscreenUserManager;
    private final ShadeController mShadeController;
    private final StatusBar mStatusBar;
    private final KeyguardStateController mKeyguardStateController;
    private final ActivityStarter mActivityStarter;
    private final NotificationEntryManager mEntryManager;
@@ -125,7 +126,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
            IDreamManager dreamManager, NotificationRemoteInputManager remoteInputManager,
            StatusBarRemoteInputCallback remoteInputCallback, NotificationGroupManager groupManager,
            NotificationLockscreenUserManager lockscreenUserManager,
            ShadeController shadeController, KeyguardStateController keyguardStateController,
            ShadeController shadeController, StatusBar statusBar,
            KeyguardStateController keyguardStateController,
            NotificationInterruptionStateProvider notificationInterruptionStateProvider,
            MetricsLogger metricsLogger, LockPatternUtils lockPatternUtils,
            Handler mainThreadHandler, Handler backgroundHandler,
@@ -142,6 +144,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
        mRemoteInputManager = remoteInputManager;
        mLockscreenUserManager = lockscreenUserManager;
        mShadeController = shadeController;
        // TODO: use KeyguardStateController#isOccluded to remove this dependency
        mStatusBar = statusBar;
        mKeyguardStateController = keyguardStateController;
        mActivityStarter = activityStarter;
        mEntryManager = entryManager;
@@ -198,7 +202,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
        final boolean afterKeyguardGone = isActivityIntent
                && mActivityIntentHelper.wouldLaunchResolverActivity(intent.getIntent(),
                mLockscreenUserManager.getCurrentUserId());
        final boolean wasOccluded = mShadeController.isOccluded();
        final boolean wasOccluded = mStatusBar.isOccluded();
        boolean showOverLockscreen = mKeyguardStateController.isShowing() && intent != null
                && mActivityIntentHelper.wouldShowOverLockscreen(intent.getIntent(),
                mLockscreenUserManager.getCurrentUserId());
@@ -253,7 +257,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
            mShadeController.addPostCollapseAction(runnable);
            mShadeController.collapsePanel(true /* animate */);
        } else if (mKeyguardStateController.isShowing()
                && mShadeController.isOccluded()) {
                && mStatusBar.isOccluded()) {
            mShadeController.addAfterKeyguardGoneRunnable(runnable);
            mShadeController.collapsePanel();
        } else {
@@ -384,7 +388,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
                        .addNextIntentWithParentStack(intent)
                        .startActivities(getActivityOptions(
                                mActivityLaunchAnimator.getLaunchAnimation(
                                        row, mShadeController.isOccluded())),
                                        row, mStatusBar.isOccluded())),
                                new UserHandle(UserHandle.getUserId(appUid)));
                mActivityLaunchAnimator.setLaunchResult(launchResult, true /* isActivityIntent */);
                if (shouldCollapse()) {
@@ -518,6 +522,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
        private ShadeController mShadeController;
        private NotificationPresenter mNotificationPresenter;
        private ActivityLaunchAnimator mActivityLaunchAnimator;
        private StatusBar mStatusBar;

        @Inject
        public Builder(Context context,
@@ -567,8 +572,11 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
            mBubbleController = bubbleController;
            mSuperStatusBarViewFactory = superStatusBarViewFactory;
        }
        public Builder setShadeController(ShadeController shadeController) {
            mShadeController = shadeController;

        /** Sets the status bar to use as {@link StatusBar} and {@link ShadeController}. */
        public Builder setStatusBar(StatusBar statusBar) {
            mStatusBar = statusBar;
            mShadeController = statusBar;
            return this;
        }

@@ -600,6 +608,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
                    mGroupManager,
                    mLockscreenUserManager,
                    mShadeController,
                    mStatusBar,
                    mKeyguardStateController,
                    mNotificationInterruptionStateProvider,
                    mMetricsLogger,
+6 −2
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
    private final DozeScrimController mDozeScrimController;
    private final ScrimController mScrimController;
    private final Context mContext;
    private final StatusBar mStatusBar;
    private final CommandQueue mCommandQueue;

    private final AccessibilityManager mAccessibilityManager;
@@ -140,12 +141,15 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
            NotificationAlertingManager notificationAlertingManager,
            NotificationRowBinderImpl notificationRowBinder,
            KeyguardStateController keyguardStateController,
            StatusBar statusBar,
            CommandQueue commandQueue) {
        mContext = context;
        mKeyguardStateController = keyguardStateController;
        mNotificationPanel = panel;
        mHeadsUpManager = headsUp;
        mDynamicPrivacyController = dynamicPrivacyController;
        // TODO: use KeyguardStateController#isOccluded to remove this dependency
        mStatusBar = statusBar;
        mCommandQueue = commandQueue;
        mAboveShelfObserver = new AboveShelfObserver(stackScroller);
        mActivityLaunchAnimator = activityLaunchAnimator;
@@ -330,7 +334,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
    }

    public boolean canHeadsUp(NotificationEntry entry, StatusBarNotification sbn) {
        if (mShadeController.isOccluded()) {
        if (mStatusBar.isOccluded()) {
            boolean devicePublic = mLockscreenUserManager.
                    isLockscreenPublicMode(mLockscreenUserManager.getCurrentUserId());
            boolean userPublic = devicePublic
@@ -356,7 +360,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
            } else {
                // we only allow head-up on the lockscreen if it doesn't have a fullscreen intent
                return !mKeyguardStateController.isShowing()
                        || mShadeController.isOccluded();
                        || mStatusBar.isOccluded();
            }
        }
        return true;
Loading