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

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

Merge "Remove USE_REPOS_FOR_BOUNCER_SHOWING flag." into main

parents 8ca4abde 98fa7edb
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -474,12 +474,6 @@ object Flags {
    @JvmField val DECOUPLE_REMOTE_INPUT_DELEGATE_AND_CALLBACK_UPDATE =
            unreleasedFlag("decouple_remote_input_delegate_and_callback_update")

    // 2900 - CentralSurfaces-related flags

    // TODO(b/285174336): Tracking Bug
    @JvmField
    val USE_REPOS_FOR_BOUNCER_SHOWING = releasedFlag("use_repos_for_bouncer_showing")

    /** TODO(b/296223317): Enables the new keyguard presentation containing a clock. */
    @JvmField
    val ENABLE_CLOCK_KEYGUARD_PRESENTATION = releasedFlag("enable_clock_keyguard_presentation")
+1 −33
Original line number Diff line number Diff line
@@ -68,8 +68,6 @@ import com.android.systemui.classifier.Classifier;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlagsClassic;
import com.android.systemui.flags.Flags;
import com.android.systemui.keyguard.MigrateClocksToBlueprint;
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository;
import com.android.systemui.keyguard.shared.model.KeyguardState;
@@ -210,11 +208,9 @@ public class NotificationStackScrollLayoutController implements Dumpable {
    @Nullable
    private Boolean mHistoryEnabled;
    private int mBarState;
    private boolean mIsBouncerShowingFromCentralSurfaces;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;
    private boolean mIsInTransitionToAod = false;

    private final FeatureFlagsClassic mFeatureFlags;
    private final NotificationTargetsHelper mNotificationTargetsHelper;
    private final SecureSettings mSecureSettings;
    private final NotificationDismissibilityProvider mDismissibilityProvider;
@@ -745,7 +741,6 @@ public class NotificationStackScrollLayoutController implements Dumpable {
            StackStateLogger stackLogger,
            NotificationStackScrollLogger logger,
            NotificationStackSizeCalculator notificationStackSizeCalculator,
            FeatureFlagsClassic featureFlags,
            NotificationTargetsHelper notificationTargetsHelper,
            SecureSettings secureSettings,
            NotificationDismissibilityProvider dismissibilityProvider,
@@ -793,7 +788,6 @@ public class NotificationStackScrollLayoutController implements Dumpable {
        mSeenNotificationsInteractor = seenNotificationsInteractor;
        mShadeController = shadeController;
        mWindowRootView = windowRootView;
        mFeatureFlags = featureFlags;
        mNotificationTargetsHelper = notificationTargetsHelper;
        mSecureSettings = secureSettings;
        mDismissibilityProvider = dismissibilityProvider;
@@ -1390,14 +1384,6 @@ public class NotificationStackScrollLayoutController implements Dumpable {
        mView.setPanelFlinging(flinging);
    }

    /**
     * Sets whether the bouncer is currently showing. Should only be called from
     * {@link CentralSurfaces}.
     */
    public void setBouncerShowingFromCentralSurfaces(boolean bouncerShowing) {
        mIsBouncerShowingFromCentralSurfaces = bouncerShowing;
    }

    /**
     * Set the visibility of the view, and propagate it to specific children.
     *
@@ -1435,31 +1421,13 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                // For more details, see: b/228790482
                && !mIsInTransitionToAod
                // Don't show any notification content if the bouncer is showing. See b/267060171.
                && !isBouncerShowing();
                && !mPrimaryBouncerInteractor.isBouncerShowing();

        mView.updateEmptyShadeView(shouldShow, mZenModeController.areNotificationsHiddenInShade());

        Trace.endSection();
    }

    /**
     * Returns whether the bouncer is currently showing.
     *
     * There's a possible timing difference between when CentralSurfaces marks the bouncer as not
     * showing and when PrimaryBouncerInteractor marks the bouncer as not showing. (CentralSurfaces
     * appears to mark the bouncer as showing for 10-200ms longer than PrimaryBouncerInteractor.)
     *
     * This timing difference could be load bearing, which is why we have a feature flag protecting
     * where we fetch the value from. This flag is intended to be short-lived.
     */
    private boolean isBouncerShowing() {
        if (mFeatureFlags.isEnabled(Flags.USE_REPOS_FOR_BOUNCER_SHOWING)) {
            return mPrimaryBouncerInteractor.isBouncerShowing();
        } else {
            return mIsBouncerShowingFromCentralSurfaces;
        }
    }

    /**
     * Update the importantForAccessibility of NotificationStackScrollLayout.
     * <p>
+0 −1
Original line number Diff line number Diff line
@@ -2416,7 +2416,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mBouncerShowing = bouncerShowing;
        mKeyguardBypassController.setBouncerShowing(bouncerShowing);
        mPulseExpansionHandler.setBouncerShowing(bouncerShowing);
        mStackScrollerController.setBouncerShowingFromCentralSurfaces(bouncerShowing);
        setBouncerShowingForStatusBarComponents(bouncerShowing);
        mStatusBarHideIconsForBouncerManager.setBouncerShowingAndTriggerUpdate(bouncerShowing);
        mCommandQueue.recomputeDisableFlags(mDisplayId, true /* animate */);
+4 −60
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.StatusBarState.SHADE;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;

import static kotlinx.coroutines.flow.FlowKt.emptyFlow;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -36,8 +38,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

import static kotlinx.coroutines.flow.FlowKt.emptyFlow;

import android.metrics.LogMaker;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
@@ -56,8 +56,6 @@ import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor;
import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FakeFeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository;
import com.android.systemui.keyguard.shared.model.KeyguardState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
@@ -126,7 +124,6 @@ import javax.inject.Provider;
public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {

    protected KosmosJavaAdapter mKosmos = new KosmosJavaAdapter(this);
    private final FakeFeatureFlags mFeatureFlags = new FakeFeatureFlags();
    @Mock private NotificationGutsManager mNotificationGutsManager;
    @Mock private NotificationsController mNotificationsController;
    @Mock private NotificationVisibilityProvider mVisibilityProvider;
@@ -193,8 +190,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
        allowTestableLooperAsMainThread();
        MockitoAnnotations.initMocks(this);

        mFeatureFlags.set(Flags.USE_REPOS_FOR_BOUNCER_SHOWING, true);

        when(mNotificationSwipeHelperBuilder.build()).thenReturn(mNotificationSwipeHelper);
        when(mKeyguardTransitionRepo.getTransitions()).thenReturn(emptyFlow());
    }
@@ -299,36 +294,11 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    public void testUpdateEmptyShadeView_bouncerShowing_flagOff_hideEmptyView() {
    public void testUpdateEmptyShadeView_bouncerShowing_hideEmptyView() {
        when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
        initController(/* viewIsAttached= */ true);

        // WHEN the flag is off and *only* CentralSurfaces has bouncer as showing
        mFeatureFlags.set(Flags.USE_REPOS_FOR_BOUNCER_SHOWING, false);
        mController.setBouncerShowingFromCentralSurfaces(true);
        when(mPrimaryBouncerInteractor.isBouncerShowing()).thenReturn(false);

        setupShowEmptyShadeViewState(true);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();

        // THEN the CentralSurfaces value is used. Since the bouncer is showing, we hide the empty
        // view.
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                /* visible= */ false,
                /* areNotificationsHiddenInShade= */ false);
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    public void testUpdateEmptyShadeView_bouncerShowing_flagOn_hideEmptyView() {
        when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
        initController(/* viewIsAttached= */ true);

        // WHEN the flag is on and *only* PrimaryBouncerInteractor has bouncer as showing
        mFeatureFlags.set(Flags.USE_REPOS_FOR_BOUNCER_SHOWING, true);
        when(mPrimaryBouncerInteractor.isBouncerShowing()).thenReturn(true);
        mController.setBouncerShowingFromCentralSurfaces(false);

        setupShowEmptyShadeViewState(true);
        reset(mNotificationStackScrollLayout);
@@ -343,36 +313,11 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    public void testUpdateEmptyShadeView_bouncerNotShowing_flagOff_showEmptyView() {
        when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
        initController(/* viewIsAttached= */ true);

        // WHEN the flag is off and *only* CentralSurfaces has bouncer as not showing
        mFeatureFlags.set(Flags.USE_REPOS_FOR_BOUNCER_SHOWING, false);
        mController.setBouncerShowingFromCentralSurfaces(false);
        when(mPrimaryBouncerInteractor.isBouncerShowing()).thenReturn(true);

        setupShowEmptyShadeViewState(true);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();

        // THEN the CentralSurfaces value is used. Since the bouncer isn't showing, we can show the
        // empty view.
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                /* visible= */ true,
                /* areNotificationsHiddenInShade= */ false);
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    public void testUpdateEmptyShadeView_bouncerNotShowing_flagOn_showEmptyView() {
    public void testUpdateEmptyShadeView_bouncerNotShowing_showEmptyView() {
        when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
        initController(/* viewIsAttached= */ true);

        // WHEN the flag is on and *only* PrimaryBouncerInteractor has bouncer as not showing
        mFeatureFlags.set(Flags.USE_REPOS_FOR_BOUNCER_SHOWING, true);
        when(mPrimaryBouncerInteractor.isBouncerShowing()).thenReturn(false);
        mController.setBouncerShowingFromCentralSurfaces(true);

        setupShowEmptyShadeViewState(true);
        reset(mNotificationStackScrollLayout);
@@ -1018,7 +963,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
                mStackLogger,
                mLogger,
                mNotificationStackSizeCalculator,
                mFeatureFlags,
                mNotificationTargetsHelper,
                mSecureSettings,
                mock(NotificationDismissibilityProvider.class),