From f842dc1a310156729a3ae39c3fcb304c1cc07dd9 Mon Sep 17 00:00:00 2001 From: Achim Thesmann Date: Wed, 31 May 2023 01:41:46 +0000 Subject: Opt in to allow BAL The changed code is responsible to send requests to registered plugins and should allow BAL based on the currently visible app to the pending intent. Test: manual test Bug: 284621682 Change-Id: I9cdd0654c6772e3dd73485e24a3f2d2bfdcd0d7b --- core/java/android/view/textclassifier/TextClassification.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/textclassifier/TextClassification.java b/core/java/android/view/textclassifier/TextClassification.java index 8b04d35734ec..63bf5622fbb8 100644 --- a/core/java/android/view/textclassifier/TextClassification.java +++ b/core/java/android/view/textclassifier/TextClassification.java @@ -21,6 +21,7 @@ import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; +import android.app.ActivityOptions; import android.app.PendingIntent; import android.app.RemoteAction; import android.content.Context; @@ -301,7 +302,8 @@ public final class TextClassification implements Parcelable { Objects.requireNonNull(intent); return v -> { try { - intent.send(); + intent.send(ActivityOptions.makeBasic().setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED).toBundle()); } catch (PendingIntent.CanceledException e) { Log.e(LOG_TAG, "Error sending PendingIntent", e); } -- cgit v1.2.3-59-g8ed1b