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

Commit f82aba6b authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[CS] Remove CentralSurfaces#isOccluded.

Move clients of this method to ask KeyguardStateController directly for
the occluded status.

Bug: 277764509
Test: verified via logging that clients are still getting the correct
occluded status

Change-Id: Ibd920f6ab6236d77f4fedef6e366c83a4a40295c
parent c2d6b9d6
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.Di
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener;
import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider;
import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
import com.android.systemui.statusbar.phone.ScrimController;
@@ -74,6 +73,8 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.Utils;
import com.android.systemui.util.concurrency.DelayableExecutor;

import dagger.Lazy;

import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -87,8 +88,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import dagger.Lazy;

/**
 * Handles tasks and state related to media notifications. For example, there is a 'current' media
 * notification, which this class keeps track of.
@@ -133,7 +132,6 @@ public class NotificationMediaManager implements Dumpable {

    private final Context mContext;
    private final ArrayList<MediaListener> mMediaListeners;
    private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
    private final MediaArtworkProcessor mMediaArtworkProcessor;
    private final Set<AsyncTask<?, ?, ?>> mProcessArtworkTasks = new ArraySet<>();

@@ -186,7 +184,6 @@ public class NotificationMediaManager implements Dumpable {
     */
    public NotificationMediaManager(
            Context context,
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            Lazy<NotificationShadeWindowController> notificationShadeWindowController,
            NotificationVisibilityProvider visibilityProvider,
            MediaArtworkProcessor mediaArtworkProcessor,
@@ -205,8 +202,6 @@ public class NotificationMediaManager implements Dumpable {
        mMediaArtworkProcessor = mediaArtworkProcessor;
        mKeyguardBypassController = keyguardBypassController;
        mMediaListeners = new ArrayList<>();
        // TODO: use KeyguardStateController#isOccluded to remove this dependency
        mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
        mNotificationShadeWindowController = notificationShadeWindowController;
        mVisibilityProvider = visibilityProvider;
        mMainExecutor = mainExecutor;
@@ -619,9 +614,7 @@ public class NotificationMediaManager implements Dumpable {

        NotificationShadeWindowController windowController =
                mNotificationShadeWindowController.get();
        boolean hideBecauseOccluded =
                mCentralSurfacesOptionalLazy.get()
                        .map(CentralSurfaces::isOccluded).orElse(false);
        boolean hideBecauseOccluded = mKeyguardStateController.isOccluded();

        final boolean hasArtwork = artworkDrawable != null;
        mColorExtractor.setHasMediaArtwork(hasMediaArtwork);
+0 −3
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ import com.android.systemui.statusbar.notification.collection.NotifCollection;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.CentralSurfacesImpl;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.ManagedProfileController;
@@ -135,7 +134,6 @@ public interface CentralSurfacesDependenciesModule {
    @Provides
    static NotificationMediaManager provideNotificationMediaManager(
            Context context,
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            Lazy<NotificationShadeWindowController> notificationShadeWindowController,
            NotificationVisibilityProvider visibilityProvider,
            MediaArtworkProcessor mediaArtworkProcessor,
@@ -152,7 +150,6 @@ public interface CentralSurfacesDependenciesModule {
            DisplayManager displayManager) {
        return new NotificationMediaManager(
                context,
                centralSurfacesOptionalLazy,
                notificationShadeWindowController,
                visibilityProvider,
                mediaArtworkProcessor,
+0 −2
Original line number Diff line number Diff line
@@ -200,8 +200,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {

    void onKeyguardViewManagerStatesUpdated();

    boolean isOccluded();

    boolean isDeviceInVrMode();

    NotificationPresenter getPresenter();
+0 −1
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ abstract class CentralSurfacesEmptyImpl : CentralSurfaces {
    override fun getKeyguardMessageArea(): AuthKeyguardMessageArea? = null
    override fun isLaunchingActivityOverLockscreen() = false
    override fun onKeyguardViewManagerStatesUpdated() {}
    override fun isOccluded() = false
    override fun isDeviceInVrMode() = false
    override fun getPresenter(): NotificationPresenter? = null
    override fun onInputFocusTransfer(start: Boolean, cancel: Boolean, velocity: Float) {}
+9 −17
Original line number Diff line number Diff line
@@ -1480,7 +1480,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        // - Shade is in QQS over keyguard - swiping up should take us back to keyguard
        if (!isKeyguardShowing()
                || mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()
                || isOccluded()
                || mKeyguardStateController.isOccluded()
                || !mKeyguardStateController.canDismissLockScreen()
                || mKeyguardViewMediator.isAnySimPinSecure()
                || (mQsController.getExpanded() && trackingTouch)
@@ -1708,17 +1708,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        logStateToEventlog();
    }

    /**
     * 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
     */
    @Override
    public boolean isOccluded() {
        return mKeyguardStateController.isOccluded();
    }

    @Override
    public boolean isDeviceInVrMode() {
        return mPresenter.isDeviceInVrMode();
@@ -2320,11 +2309,12 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        // there's no surface we can show to the user. Note that the device goes fully interactive
        // late in the transition, so we also allow the device to start dozing once the screen has
        // turned off fully.
        boolean keyguardShowingUnOccluded =
                mKeyguardStateController.isShowing() && !mKeyguardStateController.isOccluded();
        boolean keyguardForDozing = mDozeServiceHost.getDozingRequested()
                && (!mDeviceInteractive || (isGoingToSleep()
                    && (isScreenFullyOff()
                        || (mKeyguardStateController.isShowing() && !isOccluded()))));
        boolean isWakingAndOccluded = isOccluded() && isWakingOrAwake();
                && (isScreenFullyOff() || keyguardShowingUnOccluded)));
        boolean isWakingAndOccluded = mKeyguardStateController.isOccluded() && isWakingOrAwake();
        boolean shouldBeKeyguard = (mStatusBarStateController.isKeyguardRequested()
                || keyguardForDozing) && !wakeAndUnlocking && !isWakingAndOccluded;
        if (keyguardForDozing) {
@@ -3123,7 +3113,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mScrimController.setExpansionAffectsAlpha(!unlocking);

        if (mAlternateBouncerInteractor.isVisibleState()) {
            if ((!isOccluded() || mShadeSurface.isPanelExpanded())
            if ((!mKeyguardStateController.isOccluded() || mShadeSurface.isPanelExpanded())
                    && (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED
                    || mTransitionToFullShadeProgress > 0f)) {
                mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED_SHADE);
@@ -3159,7 +3149,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
            // This will cancel the keyguardFadingAway animation if it is running. We need to do
            // this as otherwise it can remain pending and leave keyguard in a weird state.
            mUnlockScrimCallback.onCancelled();
        } else if (mKeyguardStateController.isShowing() && !isOccluded() && !unlocking) {
        } else if (mKeyguardStateController.isShowing()
                && !mKeyguardStateController.isOccluded()
                && !unlocking) {
            mScrimController.transitionTo(ScrimState.KEYGUARD);
        } else if (mKeyguardStateController.isShowing() && mKeyguardUpdateMonitor.isDreaming()
                && !unlocking) {