summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt24
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt16
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java5
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt5
9 files changed, 42 insertions, 29 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
index 4c9049370c41..77f19795eaf7 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt
@@ -326,26 +326,14 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
@Test
fun isKeyguardGoingAway() =
testScope.runTest {
- whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(false)
- var latest: Boolean? = null
- val job = underTest.isKeyguardGoingAway.onEach { latest = it }.launchIn(this)
- runCurrent()
- assertThat(latest).isFalse()
-
- val captor = argumentCaptor<KeyguardStateController.Callback>()
- verify(keyguardStateController, atLeastOnce()).addCallback(captor.capture())
+ val isGoingAway by collectLastValue(underTest.isKeyguardGoingAway)
+ assertThat(isGoingAway).isFalse()
- whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(true)
- captor.value.onKeyguardGoingAwayChanged()
- runCurrent()
- assertThat(latest).isTrue()
-
- whenever(keyguardStateController.isKeyguardGoingAway).thenReturn(false)
- captor.value.onKeyguardGoingAwayChanged()
- runCurrent()
- assertThat(latest).isFalse()
+ underTest.isKeyguardGoingAway.value = true
+ assertThat(isGoingAway).isTrue()
- job.cancel()
+ underTest.isKeyguardGoingAway.value = false
+ assertThat(isGoingAway).isFalse()
}
@Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt
index 3b6e5d09a37c..df44425d4b49 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt
@@ -90,6 +90,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT
private lateinit var powerInteractor: PowerInteractor
private lateinit var transitionRepository: FakeKeyguardTransitionRepository
+ private lateinit var keyguardInteractor: KeyguardInteractor
companion object {
@JvmStatic
@@ -106,6 +107,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT
@Before
fun setup() {
powerInteractor = kosmos.powerInteractor
+ keyguardInteractor = kosmos.keyguardInteractor
transitionRepository = kosmos.fakeKeyguardTransitionRepositorySpy
underTest = kosmos.fromDozingTransitionInteractor
@@ -137,6 +139,20 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT
}
@Test
+ @DisableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
+ fun testTransitionToGone_onWakeup_whenGoingAway() =
+ testScope.runTest {
+ keyguardInteractor.setIsKeyguardGoingAway(true)
+ runCurrent()
+
+ powerInteractor.setAwakeForTest()
+ advanceTimeBy(60L)
+
+ assertThat(transitionRepository)
+ .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.GONE)
+ }
+
+ @Test
@EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
@DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
fun testTransitionToLockscreen_onWake_canDream_glanceableHubAvailable() =
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java
index aed9af6df454..406ca0585dd9 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java
@@ -33,6 +33,7 @@ import androidx.test.filters.SmallTest;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
+import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.keyguard.logging.KeyguardUpdateMonitorLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.dump.DumpManager;
@@ -67,6 +68,8 @@ public class KeyguardStateControllerTest extends SysuiTestCase {
@Mock
private Lazy<KeyguardUnlockAnimationController> mKeyguardUnlockAnimationControllerLazy;
@Mock
+ private Lazy<KeyguardInteractor> mKeyguardInteractorLazy;
+ @Mock
private SelectedUserInteractor mSelectedUserInteractor;
@Mock
private KeyguardUpdateMonitorLogger mLogger;
@@ -86,6 +89,7 @@ public class KeyguardStateControllerTest extends SysuiTestCase {
mKeyguardUnlockAnimationControllerLazy,
mLogger,
mDumpManager,
+ mKeyguardInteractorLazy,
mFeatureFlags,
mSelectedUserInteractor);
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index fbc76c587be2..60a306b3e245 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2975,7 +2975,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
@Override
public void run() {
Trace.beginSection("KeyguardViewMediator.mKeyGuardGoingAwayRunnable");
- if (DEBUG) Log.d(TAG, "keyguardGoingAway");
+ Log.d(TAG, "keyguardGoingAwayRunnable");
mKeyguardViewControllerLazy.get().keyguardGoingAway();
int flags = 0;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
index 23c6a4f82e73..9e99a879be41 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt
@@ -114,7 +114,7 @@ interface KeyguardRepository {
"away' is isInTransitionToState(GONE), but consider using more specific flows " +
"whenever possible."
)
- val isKeyguardGoingAway: Flow<Boolean>
+ val isKeyguardGoingAway: MutableStateFlow<Boolean>
/**
* Whether the keyguard is enabled, per [KeyguardService]. If the keyguard is not enabled, the
@@ -647,10 +647,6 @@ constructor(
override fun onUnlockedChanged() {
isKeyguardDismissible.value = keyguardStateController.isUnlocked
}
-
- override fun onKeyguardGoingAwayChanged() {
- isKeyguardGoingAway.value = keyguardStateController.isKeyguardGoingAway
- }
}
keyguardStateController.addCallback(callback)
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt
index 8c7fe5f87a3f..0c2d5778079b 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt
@@ -131,12 +131,13 @@ constructor(
.collect { (_, isCommunalAvailable, isIdleOnCommunal) ->
val isKeyguardOccludedLegacy = keyguardInteractor.isKeyguardOccluded.value
val primaryBouncerShowing = keyguardInteractor.primaryBouncerShowing.value
+ val isKeyguardGoingAway = keyguardInteractor.isKeyguardGoingAway.value
if (!deviceEntryInteractor.isLockscreenEnabled()) {
if (!SceneContainerFlag.isEnabled) {
startTransitionTo(KeyguardState.GONE)
}
- } else if (canDismissLockscreen()) {
+ } else if (canDismissLockscreen() || isKeyguardGoingAway) {
if (!SceneContainerFlag.isEnabled) {
startTransitionTo(KeyguardState.GONE)
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
index 5369b53b5f8f..0d5ad547f15f 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
@@ -241,7 +241,7 @@ constructor(
/** Whether the keyguard is going away. */
@Deprecated("Use KeyguardTransitionInteractor + KeyguardState.GONE")
- val isKeyguardGoingAway: Flow<Boolean> = repository.isKeyguardGoingAway
+ val isKeyguardGoingAway: StateFlow<Boolean> = repository.isKeyguardGoingAway.asStateFlow()
/** Keyguard can be clipped at the top as the shade is dragged */
val topClippingBounds: Flow<Int?> by lazy {
@@ -542,6 +542,10 @@ constructor(
repository.setShortcutAbsoluteTop(top)
}
+ fun setIsKeyguardGoingAway(isGoingAway: Boolean) {
+ repository.isKeyguardGoingAway.value = isGoingAway
+ }
+
companion object {
private const val TAG = "KeyguardInteractor"
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java
index c256e6430af9..00116aa71246 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java
@@ -40,6 +40,7 @@ import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
+import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.res.R;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
@@ -71,6 +72,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController {
new UpdateMonitorCallback();
private final Lazy<KeyguardUnlockAnimationController> mUnlockAnimationControllerLazy;
private final KeyguardUpdateMonitorLogger mLogger;
+ private final Lazy<KeyguardInteractor> mKeyguardInteractorLazy;
private boolean mCanDismissLockScreen;
private boolean mShowing;
@@ -123,6 +125,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController {
Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationController,
KeyguardUpdateMonitorLogger logger,
DumpManager dumpManager,
+ Lazy<KeyguardInteractor> keyguardInteractor,
FeatureFlags featureFlags,
SelectedUserInteractor userInteractor) {
mContext = context;
@@ -133,6 +136,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController {
mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
mUnlockAnimationControllerLazy = keyguardUnlockAnimationController;
mFeatureFlags = featureFlags;
+ mKeyguardInteractorLazy = keyguardInteractor;
dumpManager.registerDumpable(getClass().getSimpleName(), this);
@@ -354,6 +358,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController {
Trace.traceCounter(Trace.TRACE_TAG_APP, "keyguardGoingAway",
keyguardGoingAway ? 1 : 0);
mKeyguardGoingAway = keyguardGoingAway;
+ mKeyguardInteractorLazy.get().setIsKeyguardGoingAway(keyguardGoingAway);
invokeForEachCallback(Callback::onKeyguardGoingAwayChanged);
}
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
index 0e69a6722af9..08786495eca4 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt
@@ -99,8 +99,7 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository {
private val _isUdfpsSupported = MutableStateFlow(false)
- private val _isKeyguardGoingAway = MutableStateFlow(false)
- override val isKeyguardGoingAway: Flow<Boolean> = _isKeyguardGoingAway
+ override val isKeyguardGoingAway = MutableStateFlow(false)
private val _biometricUnlockState =
MutableStateFlow(BiometricUnlockModel(BiometricUnlockMode.NONE, null))
@@ -166,7 +165,7 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository {
}
fun setKeyguardGoingAway(isGoingAway: Boolean) {
- _isKeyguardGoingAway.value = isGoingAway
+ isKeyguardGoingAway.value = isGoingAway
}
fun setKeyguardOccluded(isOccluded: Boolean) {