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

Commit 78c8709d authored by Hawkwood Glazier's avatar Hawkwood Glazier
Browse files

Migrate Jank Interaction clock id source to new interactor

Bug: 330708069
Test: Manually checked trace
Flag: ACONFIG com.android.systemui.migrate_clocks_to_blueprint STAGING
Change-Id: Ifc918069bde1ae29c188745144eb193d1b8eac33
parent cd8c6126
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ import com.android.keyguard.KeyguardClockSwitch;
import com.android.systemui.DejankUtils;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.deviceentry.domain.interactor.DeviceUnlockedInteractor;
import com.android.systemui.keyguard.MigrateClocksToBlueprint;
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor;
import com.android.systemui.plugins.clocks.ClockController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.res.R;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
@@ -108,6 +111,7 @@ public class StatusBarStateControllerImpl implements
    private final Lazy<ShadeInteractor> mShadeInteractorLazy;
    private final Lazy<DeviceUnlockedInteractor> mDeviceUnlockedInteractorLazy;
    private final Lazy<SceneInteractor> mSceneInteractorLazy;
    private final Lazy<KeyguardClockInteractor> mKeyguardClockInteractorLazy;
    private int mState;
    private int mLastState;
    private int mUpcomingState;
@@ -173,13 +177,15 @@ public class StatusBarStateControllerImpl implements
            JavaAdapter javaAdapter,
            Lazy<ShadeInteractor> shadeInteractorLazy,
            Lazy<DeviceUnlockedInteractor> deviceUnlockedInteractorLazy,
            Lazy<SceneInteractor> sceneInteractorLazy) {
            Lazy<SceneInteractor> sceneInteractorLazy,
            Lazy<KeyguardClockInteractor> keyguardClockInteractorLazy) {
        mUiEventLogger = uiEventLogger;
        mInteractionJankMonitor = interactionJankMonitor;
        mJavaAdapter = javaAdapter;
        mShadeInteractorLazy = shadeInteractorLazy;
        mDeviceUnlockedInteractorLazy = deviceUnlockedInteractorLazy;
        mSceneInteractorLazy = sceneInteractorLazy;
        mKeyguardClockInteractorLazy = keyguardClockInteractorLazy;
        for (int i = 0; i < HISTORY_SIZE; i++) {
            mHistoricalRecords[i] = new HistoricalState();
        }
@@ -461,6 +467,16 @@ public class StatusBarStateControllerImpl implements

    /** Returns the id of the currently rendering clock */
    public String getClockId() {
        if (MigrateClocksToBlueprint.isEnabled()) {
            ClockController clock = mKeyguardClockInteractorLazy.get()
                    .getCurrentClock().getValue();
            if (clock == null) {
                Log.e(TAG, "No clock is available");
                return KeyguardClockSwitch.MISSING_CLOCK_ID;
            }
            return clock.getConfig().getId();
        }

        if (mClockSwitchView == null) {
            Log.e(TAG, "Clock container was missing");
            return KeyguardClockSwitch.MISSING_CLOCK_ID;
+4 −2
Original line number Diff line number Diff line
@@ -443,7 +443,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                mJavaAdapter,
                () -> mShadeInteractor,
                () -> mKosmos.getDeviceUnlockedInteractor(),
                () -> mKosmos.getSceneInteractor());
                () -> mKosmos.getSceneInteractor(),
                () -> mKosmos.getKeyguardClockInteractor());

        KeyguardStatusView keyguardStatusView = new KeyguardStatusView(mContext);
        keyguardStatusView.setId(R.id.keyguard_status_view);
@@ -613,7 +614,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                                mJavaAdapter,
                                () -> mShadeInteractor,
                                () -> mKosmos.getDeviceUnlockedInteractor(),
                                () -> mKosmos.getSceneInteractor()),
                                () -> mKosmos.getSceneInteractor(),
                                () -> mKosmos.getKeyguardClockInteractor()),
                        mKeyguardBypassController,
                        mDozeParameters,
                        mScreenOffAnimationController,
+4 −5
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.domain.interactor.fromGoneTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.fromLockscreenTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.fromPrimaryBouncerTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.kosmos.testScope
import com.android.systemui.plugins.statusbar.StatusBarStateController
@@ -87,8 +88,8 @@ import org.mockito.ArgumentMatchers.eq
import org.mockito.Mockito
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
import org.mockito.Mockito.`when` as whenever
import org.mockito.MockitoAnnotations

@SmallTest
@RunWith(AndroidTestingRunner::class)
@@ -125,6 +126,7 @@ class StatusBarStateControllerImplTest : SysuiTestCase() {
                    { shadeInteractor },
                    { kosmos.deviceUnlockedInteractor },
                    { kosmos.sceneInteractor },
                    { kosmos.keyguardClockInteractor },
                ) {
                override fun createDarkAnimator(): ObjectAnimator {
                    return mockDarkAnimator
@@ -343,10 +345,7 @@ class StatusBarStateControllerImplTest : SysuiTestCase() {
            assertThat(currentScene).isEqualTo(Scenes.QuickSettings)
            assertThat(statusBarState).isEqualTo(StatusBarState.SHADE_LOCKED)

            kosmos.sceneInteractor.changeScene(
                toScene = Scenes.Communal,
                loggingReason = "reason"
            )
            kosmos.sceneInteractor.changeScene(toScene = Scenes.Communal, loggingReason = "reason")
            runCurrent()
            assertThat(currentScene).isEqualTo(Scenes.Communal)
            assertThat(statusBarState).isEqualTo(StatusBarState.KEYGUARD)
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepos
import com.android.systemui.keyguard.domain.interactor.fromGoneTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.fromLockscreenTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.fromPrimaryBouncerTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.model.sceneContainerPlugin
import com.android.systemui.plugins.statusbar.statusBarStateController
@@ -96,6 +97,7 @@ class KosmosJavaAdapter(
    val fromGoneTransitionInteractor by lazy { kosmos.fromGoneTransitionInteractor }
    val globalActionsInteractor by lazy { kosmos.globalActionsInteractor }
    val sceneDataSource by lazy { kosmos.sceneDataSource }
    val keyguardClockInteractor by lazy { kosmos.keyguardClockInteractor }

    init {
        kosmos.applicationContext = testCase.context
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.plugins.statusbar
import com.android.internal.logging.uiEventLogger
import com.android.systemui.deviceentry.domain.interactor.deviceUnlockedInteractor
import com.android.systemui.jank.interactionJankMonitor
import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.shade.domain.interactor.shadeInteractor
@@ -34,5 +35,6 @@ var Kosmos.statusBarStateController by
            { shadeInteractor },
            { deviceUnlockedInteractor },
            { sceneInteractor },
            { keyguardClockInteractor },
        )
    }