Skip to content

Commit 2c21449

Browse files
Brian ColonnaAndroid (Google) Code Review
authored andcommitted
Merge "Added checks to make sure FUL functions are on UI thread" into jb-dev
2 parents 2f4b10e + 22001c1 commit 2c21449

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

policy/src/com/android/internal/policy/impl/FaceUnlock.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import android.content.ServiceConnection;
2929
import android.os.Handler;
3030
import android.os.IBinder;
31+
import android.os.Looper;
3132
import android.os.Message;
3233
import android.os.RemoteException;
3334
import android.telephony.TelephonyManager;
@@ -112,10 +113,14 @@ public boolean isRunning() {
112113

113114
/**
114115
* Sets the Face Unlock view to visible, hiding it after the specified amount of time. If
115-
* timeoutMillis is 0, no hide is performed.
116+
* timeoutMillis is 0, no hide is performed. Called on the UI thread.
116117
*/
117118
public void show(long timeoutMillis) {
118119
if (DEBUG) Log.d(TAG, "show()");
120+
if (mHandler.getLooper() != Looper.myLooper()) {
121+
Log.e(TAG, "show() called off of the UI thread");
122+
}
123+
119124
removeDisplayMessages();
120125
if (mFaceUnlockView != null) {
121126
mFaceUnlockView.setVisibility(View.VISIBLE);
@@ -138,9 +143,14 @@ public void hide() {
138143
/**
139144
* Binds to the Face Unlock service. Face Unlock will be started when the bind completes. The
140145
* Face Unlock view is displayed to hide the backup lock while the service is starting up.
146+
* Called on the UI thread.
141147
*/
142148
public boolean start() {
143149
if (DEBUG) Log.d(TAG, "start()");
150+
if (mHandler.getLooper() != Looper.myLooper()) {
151+
Log.e(TAG, "start() called off of the UI thread");
152+
}
153+
144154
if (mIsRunning) {
145155
Log.w(TAG, "start() called when already running");
146156
}
@@ -170,10 +180,14 @@ public boolean start() {
170180
}
171181

172182
/**
173-
* Stops Face Unlock and unbinds from the service.
183+
* Stops Face Unlock and unbinds from the service. Called on the UI thread.
174184
*/
175185
public boolean stop() {
176186
if (DEBUG) Log.d(TAG, "stop()");
187+
if (mHandler.getLooper() != Looper.myLooper()) {
188+
Log.e(TAG, "stop() called off of the UI thread");
189+
}
190+
177191
boolean mWasRunning = mIsRunning;
178192
stopUi();
179193

0 commit comments

Comments
 (0)