From 0052078d76ac8491a7bde80e9997b253d3069c7c Mon Sep 17 00:00:00 2001 From: Joshua Trask Date: Tue, 23 Nov 2021 10:46:05 -0500 Subject: New Chooser report AppPrediction availability The unbundled ChooserActivity can't query the App Prediction Service availability directly, but as of ag/16306725 the "bundled" (system) implementation performs the query and includes the result in the handoff to the unbundled version. This CL overrides the query method so that the unbundled implementation instead just reports the value of this bit. Test: Manually confirmed service now found to be available Change-Id: I2a5bf8e2e8c644ca82eaf7b81061ec7de2d523b6 --- java/src/com/android/intentresolver/ChooserActivity.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'java') diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java index 32455513..ad9fe022 100644 --- a/java/src/com/android/intentresolver/ChooserActivity.java +++ b/java/src/com/android/intentresolver/ChooserActivity.java @@ -34,10 +34,10 @@ import android.util.Log; * for notes on performing that refactoring step. */ public final class ChooserActivity extends com.android.internal.app.ChooserActivity { - private static final String TAG = "ChooserActivity"; private IBinder mPermissionToken; + private boolean mIsAppPredictionServiceAvailable; /* TODO: the first section of this file contains overrides for ChooserActivity methods that need * to be implemented differently in the delegated version. When the two classes are merged @@ -68,6 +68,11 @@ public final class ChooserActivity extends com.android.internal.app.ChooserActiv } } + @Override + public boolean isAppPredictionServiceAvailable() { + return mIsAppPredictionServiceAvailable; + } + /** * Process the intent that was used to launch the unbundled chooser, and return true if the * chooser should continue to initialize as in the full Sharesheet UI, or false if the activity @@ -76,6 +81,8 @@ public final class ChooserActivity extends com.android.internal.app.ChooserActiv private boolean processIntent() { mPermissionToken = getIntent().getExtras().getBinder( ActivityTaskManager.EXTRA_PERMISSION_TOKEN); + mIsAppPredictionServiceAvailable = getIntent().getExtras().getBoolean( + EXTRA_IS_APP_PREDICTION_SERVICE_AVAILABLE); if (mPermissionToken == null) { Log.e(TAG, "No permission token to launch activities from chooser"); -- cgit v1.2.3-59-g8ed1b