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

Commit 084ae854 authored by burakov's avatar burakov
Browse files

[Dual Shade] Refactor: Remove isShadeLayoutWide from ShadeInteractor.

This consolidates usages of `isShadeLayoutWide` (which will soon be
renamed) and prevents users from unnecessarily injecting the additional
dependencies of `shadeInteractor`.

Bug: 354926927
Test: Existing unit tests still pass.
Test: Manually by opening and closing the notifications shade and quick
 settings shade.
Flag: com.android.systemui.scene_container
Change-Id: I1faf6d4939340ef3d5060b389bc88f7da07d6327
parent e9e87666
Loading
Loading
Loading
Loading
+1 −22
Original line number Diff line number Diff line
@@ -41,16 +41,12 @@ import static org.mockito.Mockito.when;

import android.animation.Animator;
import android.annotation.IdRes;
import android.content.ContentResolver;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.os.UserManager;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -65,10 +61,8 @@ import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.testing.UiEventLoggerFake;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.util.LatencyTracker;
import com.android.keyguard.KeyguardSliceViewController;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.dagger.KeyguardStatusBarViewComponent;
import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor;
import com.android.systemui.classifier.FalsingCollectorFake;
@@ -142,7 +136,6 @@ import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.notification.stack.NotificationStackSizeCalculator;
import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.ConfigurationControllerImpl;
@@ -164,9 +157,7 @@ import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.ResourcesSplitShadeStateController;
import com.android.systemui.statusbar.policy.SplitShadeStateController;
import com.android.systemui.statusbar.policy.data.repository.FakeUserSetupRepository;
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
import com.android.systemui.unfold.SysUIUnfoldComponent;
import com.android.systemui.user.domain.interactor.UserSwitcherInteractor;
import com.android.systemui.util.kotlin.JavaAdapter;
@@ -214,7 +205,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
    @Mock protected DozeParameters mDozeParameters;
    @Mock protected ScreenOffAnimationController mScreenOffAnimationController;
    @Mock protected NotificationPanelView mView;
    @Mock protected LayoutInflater mLayoutInflater;
    @Mock protected DynamicPrivacyController mDynamicPrivacyController;
    @Mock protected ShadeTouchableRegionManager mShadeTouchableRegionManager;
    @Mock protected KeyguardStateController mKeyguardStateController;
@@ -223,7 +213,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
    @Mock protected CommandQueue mCommandQueue;
    @Mock protected VibratorHelper mVibratorHelper;
    @Mock protected LatencyTracker mLatencyTracker;
    @Mock protected PowerManager mPowerManager;
    @Mock protected AccessibilityManager mAccessibilityManager;
    @Mock protected MetricsLogger mMetricsLogger;
    @Mock protected Resources mResources;
@@ -242,14 +231,12 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
    @Mock protected ScrimController mScrimController;
    @Mock protected MediaDataManager mMediaDataManager;
    @Mock protected AmbientState mAmbientState;
    @Mock protected UserManager mUserManager;
    @Mock protected UiEventLogger mUiEventLogger;
    @Mock protected KeyguardMediaController mKeyguardMediaController;
    @Mock protected NavigationModeController mNavigationModeController;
    @Mock protected NavigationBarController mNavigationBarController;
    @Mock protected QuickSettingsControllerImpl mQsController;
    @Mock protected ShadeHeaderController mShadeHeaderController;
    @Mock protected ContentResolver mContentResolver;
    @Mock protected TapAgainViewController mTapAgainViewController;
    @Mock protected KeyguardIndicationController mKeyguardIndicationController;
    @Mock protected FragmentService mFragmentService;
@@ -261,12 +248,10 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
    @Mock protected DumpManager mDumpManager;
    @Mock protected NotificationsQSContainerController mNotificationsQSContainerController;
    @Mock protected QsFrameTranslateController mQsFrameTranslateController;
    @Mock protected StatusBarWindowStateController mStatusBarWindowStateController;
    @Mock protected KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
    @Mock protected NotificationShadeWindowController mNotificationShadeWindowController;
    @Mock protected SysUiState mSysUiState;
    @Mock protected NotificationListContainer mNotificationListContainer;
    @Mock protected NotificationStackSizeCalculator mNotificationStackSizeCalculator;
    @Mock protected UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
    @Mock protected QS mQs;
    @Mock protected QSFragmentLegacy mQSFragment;
@@ -281,8 +266,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
    @Mock protected AlternateBouncerInteractor mAlternateBouncerInteractor;
    @Mock protected MotionEvent mDownMotionEvent;
    @Mock protected CoroutineDispatcher mMainDispatcher;
    @Mock protected KeyguardSliceViewController mKeyguardSliceViewController;
    private final KeyguardLogger mKeyguardLogger = new KeyguardLogger(logcatLogBuffer());
    @Captor
    protected ArgumentCaptor<NotificationStackScrollLayout.OnEmptySpaceClickListener>
            mEmptySpaceClickListenerCaptor;
@@ -363,9 +346,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                mock(DeviceEntryUdfpsInteractor.class);
        when(deviceEntryUdfpsInteractor.isUdfpsSupported()).thenReturn(MutableStateFlow(false));

        final SplitShadeStateController splitShadeStateController =
                new ResourcesSplitShadeStateController();

        mShadeInteractor = new ShadeInteractorImpl(
                mTestScope.getBackgroundScope(),
                mKosmos.getDeviceProvisioningInteractor(),
@@ -380,8 +360,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                        mTestScope.getBackgroundScope(),
                        mFakeKeyguardRepository,
                        mShadeRepository
                ),
                mKosmos.getShadeModeInteractor());
                ));
        SystemClock systemClock = new FakeSystemClock();
        mStatusBarStateController = new StatusBarStateControllerImpl(
                mUiEventLogger,
+1 −2
Original line number Diff line number Diff line
@@ -199,8 +199,7 @@ public class QuickSettingsControllerImplBaseTest extends SysuiTestCase {
                        mTestScope.getBackgroundScope(),
                        mKeyguardRepository,
                        mShadeRepository
                ),
                mKosmos.getShadeModeInteractor());
                ));

        when(mResources.getDimensionPixelSize(
                R.dimen.lockscreen_shade_qs_transition_distance)).thenReturn(DEFAULT_HEIGHT);
+3 −3
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.Intra
import com.android.systemui.keyguard.ui.view.layout.sections.SmartspaceSection
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shade.domain.interactor.ShadeModeInteractor
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.StateFlow
@@ -45,7 +45,7 @@ class KeyguardBlueprintInteractor
constructor(
    private val keyguardBlueprintRepository: KeyguardBlueprintRepository,
    @Application private val applicationScope: CoroutineScope,
    shadeInteractor: ShadeInteractor,
    shadeModeInteractor: ShadeModeInteractor,
    @ShadeDisplayAware private val configurationInteractor: ConfigurationInteractor,
    private val fingerprintPropertyInteractor: FingerprintPropertyInteractor,
    private val smartspaceSection: SmartspaceSection,
@@ -61,7 +61,7 @@ constructor(

    /** Current BlueprintId */
    val blueprintId =
        shadeInteractor.isShadeLayoutWide.map { isShadeLayoutWide ->
        shadeModeInteractor.isShadeLayoutWide.map { isShadeLayoutWide ->
            val useSplitShade = isShadeLayoutWide && !SceneContainerFlag.isEnabled
            when {
                useSplitShade -> SplitShadeKeyguardBlueprint.ID
+4 −7
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ import com.android.systemui.plugins.clocks.ThemeConfig
import com.android.systemui.plugins.clocks.WeatherData
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shade.domain.interactor.ShadeModeInteractor
import com.android.systemui.shared.clocks.ClockRegistry
import com.android.systemui.shared.clocks.shared.model.ClockPreviewConstants
import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots
@@ -113,7 +113,7 @@ constructor(
    private val udfpsOverlayInteractor: UdfpsOverlayInteractor,
    private val indicationController: KeyguardIndicationController,
    @Assisted bundle: Bundle,
    private val shadeInteractor: ShadeInteractor,
    private val shadeModeInteractor: ShadeModeInteractor,
    private val secureSettings: SecureSettings,
    private val defaultShortcutsSection: DefaultShortcutsSection,
    private val keyguardQuickAffordanceViewBinder: KeyguardQuickAffordanceViewBinder,
@@ -415,10 +415,7 @@ constructor(
            setUpClock(previewContext, rootView)
            if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
                setUpSmartspace(previewContext, keyguardRootView)
                KeyguardPreviewSmartspaceViewBinder.bind(
                    keyguardRootView,
                    smartspaceViewModel,
                )
                KeyguardPreviewSmartspaceViewBinder.bind(keyguardRootView, smartspaceViewModel)
            }
            KeyguardPreviewClockViewBinder.bind(
                keyguardRootView,
@@ -591,7 +588,7 @@ constructor(

    private fun getPreviewShadeLayoutWide(display: Display): Boolean {
        return if (display.displayId == 0) {
            shadeInteractor.isShadeLayoutWide.value
            shadeModeInteractor.isShadeLayoutWide.value
        } else {
            // For the unfolded preview in a folded screen; it's landscape by default
            // For the folded preview in an unfolded screen; it's portrait by default
+3 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardSection
import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel
import com.android.systemui.res.R
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shade.domain.interactor.ShadeModeInteractor
import com.android.systemui.statusbar.notification.icon.ui.viewbinder.AlwaysOnDisplayNotificationIconViewStore
import com.android.systemui.statusbar.notification.icon.ui.viewbinder.NotificationIconContainerViewBinder
import com.android.systemui.statusbar.notification.icon.ui.viewbinder.StatusBarIconViewBindingFailureTracker
@@ -56,7 +56,7 @@ constructor(
    private val nicAodIconViewStore: AlwaysOnDisplayNotificationIconViewStore,
    private val systemBarUtilsState: SystemBarUtilsState,
    private val rootViewModel: KeyguardRootViewModel,
    private val shadeInteractor: ShadeInteractor,
    private val shadeModeInteractor: ShadeModeInteractor,
) : KeyguardSection() {

    private var nicBindingDisposable: DisposableHandle? = null
@@ -99,7 +99,7 @@ constructor(
            context.resources.getDimensionPixelSize(customR.dimen.status_view_margin_horizontal)
        val height = context.resources.getDimensionPixelSize(R.dimen.notification_shelf_height)
        val isVisible = rootViewModel.isNotifIconContainerVisible.value
        val isShadeLayoutWide = shadeInteractor.isShadeLayoutWide.value
        val isShadeLayoutWide = shadeModeInteractor.isShadeLayoutWide.value

        constraintSet.apply {
            if (PromotedNotificationUiAod.isEnabled) {
Loading