Loading core/java/android/content/IntentSender.java +21 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package android.content; import static android.os.Build.VERSION_CODES.BAKLAVA; import static android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM; import static com.android.window.flags.Flags.balCoverIntentSender; import android.annotation.FlaggedApi; import android.annotation.Nullable; import android.app.ActivityManager; Loading Loading @@ -75,6 +78,11 @@ public class IntentSender implements Parcelable { @EnabledAfter(targetSdkVersion = VANILLA_ICE_CREAM) private static final long REMOVE_HIDDEN_SEND_INTENT_METHOD = 356174596; /** If enabled PendingIntent hardening also applies to IntentSender. */ @ChangeId @EnabledAfter(targetSdkVersion = BAKLAVA) private static final long COVER_INTENT_SENDER = 405995292; private static final Bundle SEND_INTENT_DEFAULT_OPTIONS = ActivityOptions.makeBasic().setPendingIntentBackgroundActivityStartMode( ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_COMPAT).toBundle(); Loading Loading @@ -180,7 +188,7 @@ public class IntentSender implements Parcelable { */ public void sendIntent(Context context, int code, Intent intent, OnFinished onFinished, Handler handler) throws SendIntentException { sendIntent(context, code, intent, null, SEND_INTENT_DEFAULT_OPTIONS, sendIntent(context, code, intent, null, getSendIntentDefaultOptions(), handler == null ? null : handler::post, onFinished); } Loading Loading @@ -213,10 +221,21 @@ public class IntentSender implements Parcelable { public void sendIntent(Context context, int code, Intent intent, OnFinished onFinished, Handler handler, String requiredPermission) throws SendIntentException { sendIntent(context, code, intent, requiredPermission, SEND_INTENT_DEFAULT_OPTIONS, sendIntent(context, code, intent, requiredPermission, getSendIntentDefaultOptions(), handler == null ? null : handler::post, onFinished); } private Bundle getSendIntentDefaultOptions() { if (!balCoverIntentSender()) { return SEND_INTENT_DEFAULT_OPTIONS; } if (!CompatChanges.isChangeEnabled(COVER_INTENT_SENDER)) { return SEND_INTENT_DEFAULT_OPTIONS; } return null; } /** * Perform the operation associated with this IntentSender, allowing the * caller to specify information about the Intent to use and be notified Loading core/java/android/window/flags/responsible_apis.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -95,3 +95,10 @@ flag { description: "Enable additional logging." bug: "403398176" } flag { name: "bal_cover_intent_sender" namespace: "responsible_apis" description: "Cover IntentSender API in addition to PendingIntent." bug: "405995292" } Loading
core/java/android/content/IntentSender.java +21 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package android.content; import static android.os.Build.VERSION_CODES.BAKLAVA; import static android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM; import static com.android.window.flags.Flags.balCoverIntentSender; import android.annotation.FlaggedApi; import android.annotation.Nullable; import android.app.ActivityManager; Loading Loading @@ -75,6 +78,11 @@ public class IntentSender implements Parcelable { @EnabledAfter(targetSdkVersion = VANILLA_ICE_CREAM) private static final long REMOVE_HIDDEN_SEND_INTENT_METHOD = 356174596; /** If enabled PendingIntent hardening also applies to IntentSender. */ @ChangeId @EnabledAfter(targetSdkVersion = BAKLAVA) private static final long COVER_INTENT_SENDER = 405995292; private static final Bundle SEND_INTENT_DEFAULT_OPTIONS = ActivityOptions.makeBasic().setPendingIntentBackgroundActivityStartMode( ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_COMPAT).toBundle(); Loading Loading @@ -180,7 +188,7 @@ public class IntentSender implements Parcelable { */ public void sendIntent(Context context, int code, Intent intent, OnFinished onFinished, Handler handler) throws SendIntentException { sendIntent(context, code, intent, null, SEND_INTENT_DEFAULT_OPTIONS, sendIntent(context, code, intent, null, getSendIntentDefaultOptions(), handler == null ? null : handler::post, onFinished); } Loading Loading @@ -213,10 +221,21 @@ public class IntentSender implements Parcelable { public void sendIntent(Context context, int code, Intent intent, OnFinished onFinished, Handler handler, String requiredPermission) throws SendIntentException { sendIntent(context, code, intent, requiredPermission, SEND_INTENT_DEFAULT_OPTIONS, sendIntent(context, code, intent, requiredPermission, getSendIntentDefaultOptions(), handler == null ? null : handler::post, onFinished); } private Bundle getSendIntentDefaultOptions() { if (!balCoverIntentSender()) { return SEND_INTENT_DEFAULT_OPTIONS; } if (!CompatChanges.isChangeEnabled(COVER_INTENT_SENDER)) { return SEND_INTENT_DEFAULT_OPTIONS; } return null; } /** * Perform the operation associated with this IntentSender, allowing the * caller to specify information about the Intent to use and be notified Loading
core/java/android/window/flags/responsible_apis.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -95,3 +95,10 @@ flag { description: "Enable additional logging." bug: "403398176" } flag { name: "bal_cover_intent_sender" namespace: "responsible_apis" description: "Cover IntentSender API in addition to PendingIntent." bug: "405995292" }