Not calling startUi() if no longer bound
After the bind to the FUL service is complete, an onServiceConnected() callback is received. This callback is asynchronous - bindService() does not block while we are waiting for the service to finish binding. Therefore, when rapidly turning the screen on and off, it is possible to call bindService() and then call unbindService() before the onServiceConnected() callback is received. When onServiceConnected() is received, startUi() is called. If the service is no longer bound, a runtime restart occurs when calling startUi(). Note that onServiceConnected() actually has its work done via a handler. The delay of calling the handler increases the possibility of unbindService() being called before trying to call startUi(). But since this problem still happens without using the handler, eliminating using the handler would not solve the problem and would just create the problems that come with performing operations on different threads since onServiceConnected() is not called on the main thread. Also note that a new instance of FaceUnlock is created in LockPatternKeyguardView with each iteration. So, if we bind/stop/bind before getting onServiceConnected(), the second bind happens in a new instance of FaceUnlock and therefore does not lead to a problem when onServiceConnected() returns as a result of the first bind. This fixes some occurrences of bug 6409767. However, this fixes the problem when turned the device on and off rapidly. It seems there are some reports of bug 6409767 where this is not the case, so I can't be sure this has any affect on those cases. This change also cleans up some debugging and modifies other debugging to try to get just the information that is useful for tracking down the bug. Change-Id: Ifa59107b9974acaa8a18b74b5d47e4cf3a794b8e
Loading
Please register or sign in to comment