System->Unbundled, AppPrediction availability bit.
The current logic in ChooserActivity depends on checking for the presence of a particular AppPredictionService component in AiAi, but that check always fails in the unbundled Chooser. Instead, only check when we're running on the system side, and hand off the bit in an extra on the delegation intent. Test: trivial (needs other changes for meaningful behavior) Bug: 206831012 Change-Id: I86919d962ac25fc1a4dd4a25d672d400abc64ff2
This commit is contained in:
@@ -185,6 +185,17 @@ public class ChooserActivity extends ResolverActivity implements
|
||||
public static final String EXTRA_PRIVATE_RETAIN_IN_ON_STOP
|
||||
= "com.android.internal.app.ChooserActivity.EXTRA_PRIVATE_RETAIN_IN_ON_STOP";
|
||||
|
||||
/**
|
||||
* Boolean extra added to "unbundled Sharesheet" delegation intents to signal whether the app
|
||||
* prediction service is available. Our query of the service <em>availability</em> depends on
|
||||
* privileges that are only available in the system, even though the service itself would then
|
||||
* be available to the unbundled component. For now, we just include the query result as part of
|
||||
* the handover intent.
|
||||
* TODO: investigate whether the privileged query is necessary to determine the availability.
|
||||
*/
|
||||
protected static final String EXTRA_IS_APP_PREDICTION_SERVICE_AVAILABLE =
|
||||
"com.android.internal.app.ChooserActivity.EXTRA_IS_APP_PREDICTION_SERVICE_AVAILABLE";
|
||||
|
||||
/**
|
||||
* Transition name for the first image preview.
|
||||
* To be used for shared element transition into this activity.
|
||||
@@ -757,6 +768,11 @@ public class ChooserActivity extends ResolverActivity implements
|
||||
delegationIntent.setComponent(delegateActivity);
|
||||
delegationIntent.putExtra(Intent.EXTRA_INTENT, getIntent());
|
||||
delegationIntent.putExtra(ActivityTaskManager.EXTRA_PERMISSION_TOKEN, permissionToken);
|
||||
|
||||
// Query prediction availability; mIsAppPredictorComponentAvailable isn't initialized.
|
||||
delegationIntent.putExtra(
|
||||
EXTRA_IS_APP_PREDICTION_SERVICE_AVAILABLE, isAppPredictionServiceAvailable());
|
||||
|
||||
delegationIntent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
|
||||
|
||||
// Don't close until the delegate finishes, or the token will be invalidated.
|
||||
@@ -971,7 +987,8 @@ public class ChooserActivity extends ResolverActivity implements
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the app prediction component actually exists on the device.
|
||||
// Check if the app prediction component actually exists on the device. The component is
|
||||
// only visible when this is running in a system activity; otherwise this check will fail.
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(appPredictionComponentName);
|
||||
if (getPackageManager().resolveService(intent, PackageManager.MATCH_ALL) == null) {
|
||||
|
||||
Reference in New Issue
Block a user