Empty message queue on TileService#onDestroy

onDestroy is called by system_server asynchronously on the main thread.
If there are queued messages (from the binder interface), remove them.
This follows the contract that methods in the service will not be called
after onDestroy

Test: manual with test tile
Fixes: 172511340

Change-Id: I7d46c065d5a9597ce1d44bc5707e79b302b201f6
This commit is contained in:
Fabian Kozynski
2020-11-17 16:58:02 -05:00
parent f48a5e3d13
commit 83be4ae5ad

View File

@@ -176,6 +176,9 @@ public class TileService extends Service {
@Override
public void onDestroy() {
// As this call will come asynchronously in the main thread, prevent calls from the binder
// being processed after this.
mHandler.removeCallbacksAndMessages(null);
if (mListening) {
onStopListening();
mListening = false;