summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matt Pietal <mpietal@google.com> 2024-03-27 00:08:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-03-27 00:08:26 +0000
commit709a358c1e08e5534a6b07ba6e35d3ec4716c82a (patch)
tree4ad89d3fafb0146168f089c391a714779b8aad03
parent797e3f8783fb430f94f168a4adae1f89a091dc6b (diff)
parentf2b3d5ce7a966e99b8ecd00c8d337c0440de43f6 (diff)
Merge "Revert "Delay handler messages until class is fully initialized"" into main
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java28
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java29
2 files changed, 4 insertions, 53 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 182798e097d3..53aee5da0793 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2520,18 +2520,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
String message = "";
switch (msg.what) {
case SHOW:
- // There is a potential race condition when SysUI starts up. CentralSurfaces
- // must invoke #registerCentralSurfaces on this class before any messages can be
- // processed. If this happens, repost the message with a small delay and try
- // again.
- if (mCentralSurfaces == null) {
- message = "DELAYING SHOW";
- Message newMsg = mHandler.obtainMessage(SHOW, (Bundle) msg.obj);
- mHandler.sendMessageDelayed(newMsg, 100);
- } else {
- message = "SHOW";
- handleShow((Bundle) msg.obj);
- }
+ message = "SHOW";
+ handleShow((Bundle) msg.obj);
break;
case HIDE:
message = "HIDE";
@@ -2618,18 +2608,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
Trace.endSection();
break;
case SYSTEM_READY:
- // There is a potential race condition when SysUI starts up. CentralSurfaces
- // must invoke #registerCentralSurfaces on this class before any messages can be
- // processed. If this happens, repost the message with a small delay and try
- // again.
- if (mCentralSurfaces == null) {
- message = "DELAYING SYSTEM_READY";
- Message newMsg = mHandler.obtainMessage(SYSTEM_READY);
- mHandler.sendMessageDelayed(newMsg, 100);
- } else {
- message = "SYSTEM_READY";
- handleSystemReady();
- }
+ message = "SYSTEM_READY";
+ handleSystemReady();
break;
}
Log.d(TAG, "KeyguardViewMediator queue processing message: " + message);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
index 272b48876a37..11ec417fc5f8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -306,28 +306,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
@Test
@TestableLooper.RunWithLooper(setAsMainLooper = true)
- public void testRaceCondition_doNotRegisterCentralSurfacesImmediately() {
- create(false);
-
- // GIVEN central surfaces is not registered with KeyguardViewMediator, but a call to enable
- // keyguard comes in
- mViewMediator.onSystemReady();
- mViewMediator.setKeyguardEnabled(true);
- TestableLooper.get(this).processAllMessages();
-
- // If this step has been reached, then system ui has not crashed. Now register
- // CentralSurfaces
- assertFalse(mViewMediator.isShowingAndNotOccluded());
- register();
- TestableLooper.get(this).moveTimeForward(100);
- TestableLooper.get(this).processAllMessages();
-
- // THEN keyguard is shown
- assertTrue(mViewMediator.isShowingAndNotOccluded());
- }
-
- @Test
- @TestableLooper.RunWithLooper(setAsMainLooper = true)
public void onLockdown_showKeyguard_evenIfKeyguardIsNotEnabledExternally() {
// GIVEN keyguard is not enabled and isn't showing
mViewMediator.onSystemReady();
@@ -1206,11 +1184,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
}
private void createAndStartViewMediator(boolean orderUnlockAndWake) {
- create(orderUnlockAndWake);
- register();
- }
-
- private void create(boolean orderUnlockAndWake) {
mContext.getOrCreateTestableResources().addOverride(
com.android.internal.R.bool.config_orderUnlockAndWake, orderUnlockAndWake);
@@ -1262,9 +1235,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
mKeyguardInteractor,
mock(WindowManagerOcclusionManager.class));
mViewMediator.start();
- }
- private void register() {
mViewMediator.registerCentralSurfaces(mCentralSurfaces, null, null, null, null, null);
}