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

Commit 8a14cfba authored by Liam, Lee Pong Lam's avatar Liam, Lee Pong Lam
Browse files

[aconfig] Refactor WakefulnessLifecyle to PowerInteractor

Part1: Guard WakefulnessLifecycle with flag

Flag: NONE
Test: Unit tests / Manual
Bug: 331451011
Change-Id: Idec75be8f236c53469f8ef70185db779e8e12649
parent 8517bf06
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -524,6 +524,13 @@ flag {
   bug: "326292691"
}

flag {
   name: "smartspace_lockscreen_viewmodel"
   namespace: "systemui"
   description: "Indicate Smartspace lockscreen viewmodel"
   bug: "331451011"
}

flag {
   name: "pin_input_field_styled_focus_state"
   namespace: "systemui"
+7 −2
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import androidx.annotation.VisibleForTesting
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.settingslib.Utils
import com.android.systemui.Dumpable
import com.android.systemui.Flags.smartspaceLockscreenViewmodel
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
@@ -466,7 +467,9 @@ constructor(
        configurationController.addCallback(configChangeListener)
        statusBarStateController.addCallback(statusBarStateListener)
        bypassController.registerOnBypassStateChangedListener(bypassStateChangedListener)
        if (!smartspaceLockscreenViewmodel()) {
            wakefulnessLifecycle.addObserver(wakefulnessLifecycleObserver)
        }

        datePlugin?.registerSmartspaceEventNotifier { e -> session?.notifySmartspaceEvent(e) }
        weatherPlugin?.registerSmartspaceEventNotifier { e -> session?.notifySmartspaceEvent(e) }
@@ -509,7 +512,9 @@ constructor(
        configurationController.removeCallback(configChangeListener)
        statusBarStateController.removeCallback(statusBarStateListener)
        bypassController.unregisterOnBypassStateChangedListener(bypassStateChangedListener)
        if (!smartspaceLockscreenViewmodel()) {
            wakefulnessLifecycle.removeObserver(wakefulnessLifecycleObserver)
        }
        session = null

        datePlugin?.registerSmartspaceEventNotifier(null)
+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.os.UserHandle
import android.platform.test.annotations.DisableFlags
import android.provider.Settings
import android.view.View
import android.widget.FrameLayout
@@ -785,6 +786,7 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.Flags.FLAG_SMARTSPACE_LOCKSCREEN_VIEWMODEL)
    fun testWakefulnessLifecycleDispatch_wake_setsSmartspaceScreenOnTrue() {
        // Connect session
        connectSession()
@@ -801,6 +803,7 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.Flags.FLAG_SMARTSPACE_LOCKSCREEN_VIEWMODEL)
    fun testWakefulnessLifecycleDispatch_sleep_setsSmartspaceScreenOnFalse() {
        // Connect session
        connectSession()