Workaround of Slice not pinned bug when using SliceCallback
When a client registers a SliceCallback, it starts to observe Slice changes. The observer is running in the main looper and binds Slice in AsyncTask. However, when the client unregisters the callback, it unpins the Slice in the client's thread. Thus, if the AsyncTask has pinned the slice but hasn't bound it yet, it may be unpinned by the client, and an exception occurs. This fix is to unpin the Slice in the same SerialExecutor of AsyncTask, which is to ensure bindSlice() and unpinSlice() are called in the same thread one after another without the race condition. Bug: 157387583 Test: robotest Change-Id: If5f4b4bc0d8c5a2800cad8ff2afd7084426a6c96
Loading