Add onUnbind from OverviewProxyService, and destroy taskbar
When unbound, destroy taskbar immediately instead of waiting for
TIS#onDestroy. And then send the reply back to OverviewProxyService
so it can bind to a new TIS.
Fixes: 375315062
Test: Switch users 10 times, no crash (also check logs)
Flag: EXEMPT bug fix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:54d06ff61ab5f4c574296dc78163aa2be8ca411f)
Merged-In: I737c47c7df87e11608672a4e16eb3e9fd645e487
Change-Id: I737c47c7df87e11608672a4e16eb3e9fd645e487
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index c8e53ab..6c7fb2a 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -48,7 +48,9 @@
import android.hardware.input.InputManager;
import android.os.Bundle;
import android.os.IBinder;
+import android.os.IRemoteCallback;
import android.os.Looper;
+import android.os.RemoteException;
import android.os.SystemClock;
import android.os.Trace;
import android.util.ArraySet;
@@ -400,6 +402,20 @@
taskbarManager.onNavigationBarLumaSamplingEnabled(displayId, enable));
}
+ @Override
+ public void onUnbind(IRemoteCallback reply) {
+ // Run everything in the same main thread block to ensure the cleanup happens before
+ // sending the reply.
+ MAIN_EXECUTOR.execute(() -> {
+ executeForTaskbarManager(TaskbarManager::destroy);
+ try {
+ reply.sendResult(null);
+ } catch (RemoteException e) {
+ Log.w(TAG, "onUnbind: Failed to reply to OverviewProxyService", e);
+ }
+ });
+ }
+
private void executeForTouchInteractionService(
@NonNull Consumer<TouchInteractionService> tisConsumer) {
TouchInteractionService tis = mTis.get();