Merge "Using an intent-action instead of a fixed compoenent for quick-step service" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-27 21:46:56 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 9 deletions

View File

@@ -45,9 +45,6 @@
interface. This name is in the ComponentName flattened format (package/class) --> interface. This name is in the ComponentName flattened format (package/class) -->
<string name="config_statusBarComponent" translatable="false">com.android.systemui.statusbar.phone.StatusBar</string> <string name="config_statusBarComponent" translatable="false">com.android.systemui.statusbar.phone.StatusBar</string>
<!-- Component name of launcher service for overview to connect to -->
<string name="config_overviewServiceComponent" translatable="false">com.android.launcher3/com.android.quickstep.TouchInteractionService</string>
<!-- Whether or not we show the number in the bar. --> <!-- Whether or not we show the number in the bar. -->
<bool name="config_statusBarShowNumber">false</bool> <bool name="config_statusBarShowNumber">false</bool>

View File

@@ -57,6 +57,8 @@ import static com.android.systemui.shared.system.NavigationBarCompat.Interaction
*/ */
public class OverviewProxyService implements CallbackController<OverviewProxyListener>, Dumpable { public class OverviewProxyService implements CallbackController<OverviewProxyListener>, Dumpable {
private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
public static final String TAG_OPS = "OverviewProxyService"; public static final String TAG_OPS = "OverviewProxyService";
public static final boolean DEBUG_OVERVIEW_PROXY = false; public static final boolean DEBUG_OVERVIEW_PROXY = false;
private static final long BACKOFF_MILLIS = 5000; private static final long BACKOFF_MILLIS = 5000;
@@ -64,7 +66,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
private final Context mContext; private final Context mContext;
private final Handler mHandler; private final Handler mHandler;
private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser; private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser;
private final ComponentName mLauncherComponentName; private final ComponentName mRecentsComponentName;
private final DeviceProvisionedController mDeviceProvisionedController private final DeviceProvisionedController mDeviceProvisionedController
= Dependency.get(DeviceProvisionedController.class); = Dependency.get(DeviceProvisionedController.class);
private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>(); private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>();
@@ -191,8 +193,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
mContext = context; mContext = context;
mHandler = new Handler(); mHandler = new Handler();
mConnectionBackoffAttempts = 0; mConnectionBackoffAttempts = 0;
mLauncherComponentName = ComponentName mRecentsComponentName = ComponentName.unflattenFromString(context.getString(
.unflattenFromString(context.getString(R.string.config_overviewServiceComponent)); com.android.internal.R.string.config_recentsComponentName));
// Listen for the package update changes. // Listen for the package update changes.
if (SystemServicesProxy.getInstance(context) if (SystemServicesProxy.getInstance(context)
@@ -200,7 +202,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
mDeviceProvisionedController.addCallback(mDeviceProvisionedCallback); mDeviceProvisionedController.addCallback(mDeviceProvisionedCallback);
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
filter.addDataScheme("package"); filter.addDataScheme("package");
filter.addDataSchemeSpecificPart(mLauncherComponentName.getPackageName(), filter.addDataSchemeSpecificPart(mRecentsComponentName.getPackageName(),
PatternMatcher.PATTERN_LITERAL); PatternMatcher.PATTERN_LITERAL);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
mContext.registerReceiver(mLauncherAddedReceiver, filter); mContext.registerReceiver(mLauncherAddedReceiver, filter);
@@ -223,8 +225,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
return; return;
} }
mHandler.removeCallbacks(mConnectionRunnable); mHandler.removeCallbacks(mConnectionRunnable);
Intent launcherServiceIntent = new Intent(); Intent launcherServiceIntent = new Intent(ACTION_QUICKSTEP)
launcherServiceIntent.setComponent(mLauncherComponentName); .setPackage(mRecentsComponentName.getPackageName());
boolean bound = mContext.bindServiceAsUser(launcherServiceIntent, boolean bound = mContext.bindServiceAsUser(launcherServiceIntent,
mOverviewServiceConnection, Context.BIND_AUTO_CREATE, mOverviewServiceConnection, Context.BIND_AUTO_CREATE,
UserHandle.of(mDeviceProvisionedController.getCurrentUser())); UserHandle.of(mDeviceProvisionedController.getCurrentUser()));