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

Commit 4e44fced authored by Evan Rosky's avatar Evan Rosky
Browse files

Post setSwitchingUser to main thread

touching view hierarchy should only occur on UI thread

Bug: 37167272
Test: keyguard still works, used Log to see that switching
      still gets called
Change-Id: I45ed9894a8f08c38da40de44f84e99cddb683014
parent b827c523
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ public class KeyguardViewMediator extends SystemUI {
    private static final int NOTIFY_SCREEN_TURNED_ON = 15;
    private static final int NOTIFY_SCREEN_TURNED_OFF = 16;
    private static final int NOTIFY_STARTED_GOING_TO_SLEEP = 17;
    private static final int SET_SWITCHING_USER = 18;

    /**
     * The default amount of time we stay awake (used for all key input)
@@ -1393,7 +1394,11 @@ public class KeyguardViewMediator extends SystemUI {
    }

    public void setSwitchingUser(boolean switching) {
        KeyguardUpdateMonitor.getInstance(mContext).setSwitchingUser(switching);
        Trace.beginSection("KeyguardViewMediator#setSwitchingUser");
        mHandler.removeMessages(SET_SWITCHING_USER);
        Message msg = mHandler.obtainMessage(SET_SWITCHING_USER, switching ? 1 : 0, 0);
        mHandler.sendMessage(msg);
        Trace.endSection();
    }

    /**
@@ -1533,6 +1538,11 @@ public class KeyguardViewMediator extends SystemUI {
                    Log.w(TAG, "Timeout while waiting for activity drawn!");
                    Trace.endSection();
                    break;
                case SET_SWITCHING_USER:
                    Trace.beginSection("KeyguardViewMediator#handleMessage SET_SWITCHING_USER");
                    KeyguardUpdateMonitor.getInstance(mContext).setSwitchingUser(msg.arg1 != 0);
                    Trace.endSection();
                    break;
            }
        }
    };