2828import android .content .ServiceConnection ;
2929import android .os .Handler ;
3030import android .os .IBinder ;
31+ import android .os .Looper ;
3132import android .os .Message ;
3233import android .os .RemoteException ;
3334import 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