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

Commit 82da37e4 authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Android (Google) Code Review
Browse files

Merge "Trigger time update when screen state changes to SCREEN_ON" into main

parents 179fc83c 4d325552
Loading
Loading
Loading
Loading
+5 −20
Original line number Diff line number Diff line
@@ -61,8 +61,6 @@ import com.android.systemui.plugins.clocks.ClockTickRate
import com.android.systemui.plugins.clocks.WeatherData
import com.android.systemui.plugins.clocks.ZenData
import com.android.systemui.plugins.clocks.ZenData.ZenMode
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.power.shared.model.ScreenPowerState
import com.android.systemui.res.R as SysuiR
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.settings.UserTracker
@@ -108,7 +106,6 @@ constructor(
    private val zenModeController: ZenModeController,
    private val zenModeInteractor: ZenModeInteractor,
    private val userTracker: UserTracker,
    private val powerInteractor: PowerInteractor,
) {
    var loggers =
        listOf(
@@ -380,12 +377,12 @@ constructor(
            override fun onTimeChanged() {
                refreshTime()
            }
        }

            private fun refreshTime() {
                clock?.smallClock?.events?.onTimeTick()
                clock?.largeClock?.events?.onTimeTick()
            }
        }

    @VisibleForTesting
    internal fun listenForDnd(scope: CoroutineScope): Job {
@@ -477,7 +474,6 @@ constructor(
                    listenForAnyStateToAodTransition(this)
                    listenForAnyStateToLockscreenTransition(this)
                    listenForAnyStateToDozingTransition(this)
                    listenForScreenPowerOn(this)
                }
            }
        smallTimeListener?.update(shouldTimeListenerRun)
@@ -647,17 +643,6 @@ constructor(
        }
    }

    @VisibleForTesting
    internal fun listenForScreenPowerOn(scope: CoroutineScope): Job {
        return scope.launch {
            powerInteractor.screenPowerState.collect { powerState ->
                if (powerState != ScreenPowerState.SCREEN_OFF) {
                    refreshTime()
                }
            }
        }
    }

    class TimeListener(val clockFace: ClockFaceController, val executor: DelayableExecutor) {
        val predrawListener =
            ViewTreeObserver.OnPreDrawListener {
+5 −0
Original line number Diff line number Diff line
@@ -3332,6 +3332,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }
    }

    /** Triggers an out of band time update */
    public void triggerTimeUpdate() {
        mHandler.sendEmptyMessage(MSG_TIME_UPDATE);
    }

    /**
     * Handle {@link #MSG_TIME_UPDATE}
     */
+7 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import com.android.internal.policy.IKeyguardDrawnCallback;
import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardService;
import com.android.internal.policy.IKeyguardStateCallback;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.mediator.ScreenOnCoordinator;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.dagger.qualifiers.Application;
@@ -331,6 +332,7 @@ public class KeyguardService extends Service {
        }
    };
    private final KeyguardServiceLockNowInteractor mKeyguardServiceLockNowInteractor;
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;

    @Inject
    public KeyguardService(
@@ -356,7 +358,8 @@ public class KeyguardService extends Service {
            KeyguardDismissInteractor keyguardDismissInteractor,
            Lazy<DeviceEntryInteractor> deviceEntryInteractorLazy,
            KeyguardStateCallbackInteractor keyguardStateCallbackInteractor,
            KeyguardServiceLockNowInteractor keyguardServiceLockNowInteractor) {
            KeyguardServiceLockNowInteractor keyguardServiceLockNowInteractor,
            KeyguardUpdateMonitor keyguardUpdateMonitor) {
        super();
        mKeyguardViewMediator = keyguardViewMediator;
        mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher;
@@ -389,6 +392,7 @@ public class KeyguardService extends Service {
        mKeyguardWakeDirectlyToGoneInteractor = keyguardWakeDirectlyToGoneInteractor;
        mKeyguardDismissInteractor = keyguardDismissInteractor;
        mKeyguardServiceLockNowInteractor = keyguardServiceLockNowInteractor;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
    }

    @Override
@@ -585,6 +589,7 @@ public class KeyguardService extends Service {
            mPowerInteractor.onScreenPowerStateUpdated(ScreenPowerState.SCREEN_TURNING_ON);
            mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.SCREEN_TURNING_ON,
                    callback);
            mKeyguardUpdateMonitor.triggerTimeUpdate();

            final String onDrawWaitingTraceTag = "Waiting for KeyguardDrawnCallback#onDrawn";
            final int traceCookie = System.identityHashCode(callback);
@@ -620,6 +625,7 @@ public class KeyguardService extends Service {
            checkPermission();
            mPowerInteractor.onScreenPowerStateUpdated(ScreenPowerState.SCREEN_ON);
            mKeyguardLifecyclesDispatcher.dispatch(KeyguardLifecyclesDispatcher.SCREEN_TURNED_ON);
            mKeyguardUpdateMonitor.triggerTimeUpdate();
            mScreenOnCoordinator.onScreenTurnedOn();
            Trace.endSection();
        }
+0 −3
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ import com.android.systemui.plugins.clocks.ClockTickRate
import com.android.systemui.plugins.clocks.ThemeConfig
import com.android.systemui.plugins.clocks.ZenData
import com.android.systemui.plugins.clocks.ZenData.ZenMode
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.res.R
import com.android.systemui.settings.UserTracker
import com.android.systemui.statusbar.policy.BatteryController
@@ -132,7 +131,6 @@ class ClockEventControllerTest : SysuiTestCase() {
    @Mock private lateinit var parentView: View
    @Mock private lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor
    @Mock private lateinit var userTracker: UserTracker
    @Mock private lateinit var powerInteractor: PowerInteractor

    @Mock private lateinit var zenModeController: ZenModeController
    private var zenModeControllerCallback: ZenModeController.Callback? = null
@@ -180,7 +178,6 @@ class ClockEventControllerTest : SysuiTestCase() {
                zenModeController,
                zenModeInteractor,
                userTracker,
                powerInteractor,
            )
        underTest.clock = clock