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

Commit f2b3d5ce authored by Matt Pietal's avatar Matt Pietal
Browse files

Revert "Delay handler messages until class is fully initialized"

This reverts commit 24c38549.

Reason for revert: No longer needed, ag/26153274 Fixed it the right way

Change-Id: Ib75815761c9a1dfafab325a06e959779a56a207d
parent 24c38549
Loading
Loading
Loading
Loading
+4 −24
Original line number Diff line number Diff line
@@ -2507,18 +2507,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);
                    }
                    break;
                case HIDE:
                    message = "HIDE";
@@ -2605,18 +2595,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();
                    }
                    break;
            }
            Log.d(TAG, "KeyguardViewMediator queue processing message: " + message);
+0 −29
Original line number Diff line number Diff line
@@ -307,28 +307,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() {
@@ -1161,11 +1139,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);

@@ -1216,9 +1189,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
                mSelectedUserInteractor,
                mKeyguardInteractor);
        mViewMediator.start();
    }

    private void register() {
        mViewMediator.registerCentralSurfaces(mCentralSurfaces, null, null, null, null, null);
    }