Merge "Post setSwitchingUser to main thread" into oc-dev

This commit is contained in:
Evan Rosky
2017-05-15 20:52:40 +00:00
committed by Android (Google) Code Review

View File

@@ -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)
@@ -1398,7 +1399,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();
}
/**
@@ -1538,6 +1543,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;
}
}
};