Rebind OverviewProxyService for only TouchInteractionService component
* Currently we re-bind for all launcher package changes * We don't need to for tests (ex. component TestInformationProvider) Bug: 266716173 Test: Added logging and disabled/enabled TIS via adb shell pm disable com.google.android.apps.nexuslauncher/com.android.quickstep.TouchInteractionService Change-Id: Idcc8ac5129881ddd78145b3d365728f92cdf7b3c
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.systemui.recents;
|
||||
|
||||
import static android.content.Intent.ACTION_PACKAGE_ADDED;
|
||||
import static android.content.Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST;
|
||||
import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
|
||||
import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
@@ -48,6 +49,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.Region;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.hardware.input.InputManagerGlobal;
|
||||
@@ -114,6 +116,7 @@ import dagger.Lazy;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
@@ -393,20 +396,29 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
||||
private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
StringBuilder extraComponentList = new StringBuilder(" components: ");
|
||||
if (intent.hasExtra(EXTRA_CHANGED_COMPONENT_NAME_LIST)) {
|
||||
String[] comps = intent.getStringArrayExtra(EXTRA_CHANGED_COMPONENT_NAME_LIST);
|
||||
if (comps != null) {
|
||||
for (String c : comps) {
|
||||
extraComponentList.append(c).append(", ");
|
||||
}
|
||||
// If adding, bind immediately
|
||||
if (Objects.equals(intent.getAction(), ACTION_PACKAGE_ADDED)) {
|
||||
updateEnabledAndBinding();
|
||||
return;
|
||||
}
|
||||
|
||||
// ACTION_PACKAGE_CHANGED
|
||||
String[] compsList = intent.getStringArrayExtra(EXTRA_CHANGED_COMPONENT_NAME_LIST);
|
||||
if (compsList == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only rebind for TouchInteractionService component from launcher
|
||||
ResolveInfo ri = context.getPackageManager()
|
||||
.resolveService(new Intent(ACTION_QUICKSTEP), 0);
|
||||
String interestingComponent = ri.serviceInfo.name;
|
||||
for (String component : compsList) {
|
||||
if (interestingComponent.equals(component)) {
|
||||
Log.i(TAG_OPS, "Rebinding for component [" + component + "] change");
|
||||
updateEnabledAndBinding();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Log.d(TAG_OPS, "launcherStateChanged intent: " + intent + extraComponentList);
|
||||
updateEnabledState();
|
||||
|
||||
// Reconnect immediately, instead of waiting for resume to arrive.
|
||||
startConnectionToCurrentUser();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -621,8 +633,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
||||
screenLifecycle.addObserver(mScreenLifecycleObserver);
|
||||
wakefulnessLifecycle.addObserver(mWakefulnessLifecycleObserver);
|
||||
// Connect to the service
|
||||
updateEnabledState();
|
||||
startConnectionToCurrentUser();
|
||||
updateEnabledAndBinding();
|
||||
|
||||
// Listen for assistant changes
|
||||
assistUtils.registerVoiceInteractionSessionListener(mVoiceInteractionSessionListener);
|
||||
@@ -651,6 +662,11 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEnabledAndBinding() {
|
||||
updateEnabledState();
|
||||
startConnectionToCurrentUser();
|
||||
}
|
||||
|
||||
private void updateSystemUiStateFlags() {
|
||||
final NavigationBar navBarFragment =
|
||||
mNavBarControllerLazy.get().getDefaultNavigationBar();
|
||||
|
||||
Reference in New Issue
Block a user