Loading core/java/android/content/IntentSender.java +40 −3 Original line number Diff line number Diff line Loading @@ -18,9 +18,10 @@ package android.content; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManager.PendingIntentInfo; import android.app.ActivityOptions; import android.app.ActivityThread; import android.app.IApplicationThread; import android.app.ActivityManager.PendingIntentInfo; import android.compat.annotation.UnsupportedAppUsage; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -160,7 +161,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, onFinished, handler, null); sendIntent(context, code, intent, onFinished, handler, null, null /* options */); } /** Loading Loading @@ -192,6 +193,42 @@ 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, onFinished, handler, requiredPermission, null /* options */); } /** * Perform the operation associated with this IntentSender, allowing the * caller to specify information about the Intent to use and be notified * when the send has completed. * * @param context The Context of the caller. This may be null if * <var>intent</var> is also null. * @param code Result code to supply back to the IntentSender's target. * @param intent Additional Intent data. See {@link Intent#fillIn * Intent.fillIn()} for information on how this is applied to the * original Intent. Use null to not modify the original Intent. * @param onFinished The object to call back on when the send has * completed, or null for no callback. * @param handler Handler identifying the thread on which the callback * should happen. If null, the callback will happen from the thread * pool of the process. * @param requiredPermission Name of permission that a recipient of the PendingIntent * is required to hold. This is only valid for broadcast intents, and * corresponds to the permission argument in * {@link Context#sendBroadcast(Intent, String) Context.sendOrderedBroadcast(Intent, String)}. * If null, no permission is required. * @param options Additional options the caller would like to provide to modify the sending * behavior. May be built from an {@link ActivityOptions} to apply to an activity start. * * @throws SendIntentException Throws CanceledIntentException if the IntentSender * is no longer allowing more intents to be sent through it. * @hide */ public void sendIntent(Context context, int code, Intent intent, OnFinished onFinished, Handler handler, String requiredPermission, @Nullable Bundle options) throws SendIntentException { try { String resolvedType = intent != null ? intent.resolveTypeIfNeeded(context.getContentResolver()) Loading @@ -203,7 +240,7 @@ public class IntentSender implements Parcelable { onFinished != null ? new FinishedDispatcher(this, onFinished, handler) : null, requiredPermission, null); requiredPermission, options); if (res < 0) { throw new SendIntentException(); } Loading services/core/java/com/android/server/pm/InstallPackageHelper.java +5 −1 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ import android.annotation.UserIdInt; import android.apex.ApexInfo; import android.app.AppOpsManager; import android.app.ApplicationPackageManager; import android.app.BroadcastOptions; import android.app.backup.IBackupManager; import android.content.ContentResolver; import android.content.Context; Loading Loading @@ -687,7 +688,10 @@ final class InstallPackageHelper { fillIn.putExtra(PackageInstaller.EXTRA_STATUS, PackageManager.installStatusToPublicStatus(returnCode)); try { target.sendIntent(context, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, fillIn, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading services/core/java/com/android/server/pm/PackageInstallerService.java +13 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.annotation.Nullable; import android.app.ActivityManager; import android.app.AppGlobals; import android.app.AppOpsManager; import android.app.BroadcastOptions; import android.app.Notification; import android.app.NotificationManager; import android.app.PackageDeleteObserver; Loading Loading @@ -1314,7 +1315,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements intent.putExtra(PackageInstaller.EXTRA_INSTALL_CONSTRAINTS, constraints); intent.putExtra(PackageInstaller.EXTRA_INSTALL_CONSTRAINTS_RESULT, result); try { callback.sendIntent(mContext, 0, intent, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); callback.sendIntent(mContext, 0, intent, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException ignore) { } }); Loading Loading @@ -1477,7 +1481,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements PackageInstaller.STATUS_PENDING_USER_ACTION); fillIn.putExtra(Intent.EXTRA_INTENT, intent); try { mTarget.sendIntent(mContext, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); mTarget.sendIntent(mContext, 0, fillIn, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException ignored) { } } Loading @@ -1502,7 +1509,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements PackageManager.deleteStatusToString(returnCode, msg)); fillIn.putExtra(PackageInstaller.EXTRA_LEGACY_STATUS, returnCode); try { mTarget.sendIntent(mContext, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); mTarget.sendIntent(mContext, 0, fillIn, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException ignored) { } } Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +16 −4 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.WorkerThread; import android.app.AppOpsManager; import android.app.BroadcastOptions; import android.app.Notification; import android.app.NotificationManager; import android.app.admin.DevicePolicyEventLogger; Loading Loading @@ -4495,8 +4496,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { intent.putExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_SUCCESS); intent.putExtra(PackageInstaller.EXTRA_PRE_APPROVAL, true); try { final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(mContext, 0 /* code */, intent, null /* onFinished */, null /* handler */); null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading Loading @@ -4763,7 +4766,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { PackageInstaller.ACTION_CONFIRM_PRE_APPROVAL.equals(intent.getAction())); fillIn.putExtra(Intent.EXTRA_INTENT, intent); try { target.sendIntent(context, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, fillIn, null /* onFinished */, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading Loading @@ -4805,7 +4811,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } } try { target.sendIntent(context, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, fillIn, null /* onFinished */, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading Loading @@ -4839,7 +4848,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { intent.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, "Staging Image Not Ready"); } try { target.sendIntent(context, 0, intent, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, intent, null /* onFinished */, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading services/core/java/com/android/server/pm/PackageManagerService.java +6 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import android.annotation.WorkerThread; import android.app.ActivityManager; import android.app.AppOpsManager; import android.app.ApplicationPackageManager; import android.app.BroadcastOptions; import android.app.IActivityManager; import android.app.admin.IDevicePolicyManager; import android.app.admin.SecurityLog; Loading Loading @@ -4948,7 +4949,11 @@ public class PackageManagerService implements PackageSender, TestUtilityService } if (pi != null) { try { pi.sendIntent(null, success ? 1 : 0, null, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); pi.sendIntent(null, success ? 1 : 0, null /* intent */, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException e) { Slog.w(TAG, e); } Loading Loading
core/java/android/content/IntentSender.java +40 −3 Original line number Diff line number Diff line Loading @@ -18,9 +18,10 @@ package android.content; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManager.PendingIntentInfo; import android.app.ActivityOptions; import android.app.ActivityThread; import android.app.IApplicationThread; import android.app.ActivityManager.PendingIntentInfo; import android.compat.annotation.UnsupportedAppUsage; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -160,7 +161,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, onFinished, handler, null); sendIntent(context, code, intent, onFinished, handler, null, null /* options */); } /** Loading Loading @@ -192,6 +193,42 @@ 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, onFinished, handler, requiredPermission, null /* options */); } /** * Perform the operation associated with this IntentSender, allowing the * caller to specify information about the Intent to use and be notified * when the send has completed. * * @param context The Context of the caller. This may be null if * <var>intent</var> is also null. * @param code Result code to supply back to the IntentSender's target. * @param intent Additional Intent data. See {@link Intent#fillIn * Intent.fillIn()} for information on how this is applied to the * original Intent. Use null to not modify the original Intent. * @param onFinished The object to call back on when the send has * completed, or null for no callback. * @param handler Handler identifying the thread on which the callback * should happen. If null, the callback will happen from the thread * pool of the process. * @param requiredPermission Name of permission that a recipient of the PendingIntent * is required to hold. This is only valid for broadcast intents, and * corresponds to the permission argument in * {@link Context#sendBroadcast(Intent, String) Context.sendOrderedBroadcast(Intent, String)}. * If null, no permission is required. * @param options Additional options the caller would like to provide to modify the sending * behavior. May be built from an {@link ActivityOptions} to apply to an activity start. * * @throws SendIntentException Throws CanceledIntentException if the IntentSender * is no longer allowing more intents to be sent through it. * @hide */ public void sendIntent(Context context, int code, Intent intent, OnFinished onFinished, Handler handler, String requiredPermission, @Nullable Bundle options) throws SendIntentException { try { String resolvedType = intent != null ? intent.resolveTypeIfNeeded(context.getContentResolver()) Loading @@ -203,7 +240,7 @@ public class IntentSender implements Parcelable { onFinished != null ? new FinishedDispatcher(this, onFinished, handler) : null, requiredPermission, null); requiredPermission, options); if (res < 0) { throw new SendIntentException(); } Loading
services/core/java/com/android/server/pm/InstallPackageHelper.java +5 −1 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ import android.annotation.UserIdInt; import android.apex.ApexInfo; import android.app.AppOpsManager; import android.app.ApplicationPackageManager; import android.app.BroadcastOptions; import android.app.backup.IBackupManager; import android.content.ContentResolver; import android.content.Context; Loading Loading @@ -687,7 +688,10 @@ final class InstallPackageHelper { fillIn.putExtra(PackageInstaller.EXTRA_STATUS, PackageManager.installStatusToPublicStatus(returnCode)); try { target.sendIntent(context, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, fillIn, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading
services/core/java/com/android/server/pm/PackageInstallerService.java +13 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.annotation.Nullable; import android.app.ActivityManager; import android.app.AppGlobals; import android.app.AppOpsManager; import android.app.BroadcastOptions; import android.app.Notification; import android.app.NotificationManager; import android.app.PackageDeleteObserver; Loading Loading @@ -1314,7 +1315,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements intent.putExtra(PackageInstaller.EXTRA_INSTALL_CONSTRAINTS, constraints); intent.putExtra(PackageInstaller.EXTRA_INSTALL_CONSTRAINTS_RESULT, result); try { callback.sendIntent(mContext, 0, intent, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); callback.sendIntent(mContext, 0, intent, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException ignore) { } }); Loading Loading @@ -1477,7 +1481,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements PackageInstaller.STATUS_PENDING_USER_ACTION); fillIn.putExtra(Intent.EXTRA_INTENT, intent); try { mTarget.sendIntent(mContext, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); mTarget.sendIntent(mContext, 0, fillIn, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException ignored) { } } Loading @@ -1502,7 +1509,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements PackageManager.deleteStatusToString(returnCode, msg)); fillIn.putExtra(PackageInstaller.EXTRA_LEGACY_STATUS, returnCode); try { mTarget.sendIntent(mContext, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); mTarget.sendIntent(mContext, 0, fillIn, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException ignored) { } } Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +16 −4 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.WorkerThread; import android.app.AppOpsManager; import android.app.BroadcastOptions; import android.app.Notification; import android.app.NotificationManager; import android.app.admin.DevicePolicyEventLogger; Loading Loading @@ -4495,8 +4496,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { intent.putExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_SUCCESS); intent.putExtra(PackageInstaller.EXTRA_PRE_APPROVAL, true); try { final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(mContext, 0 /* code */, intent, null /* onFinished */, null /* handler */); null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading Loading @@ -4763,7 +4766,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { PackageInstaller.ACTION_CONFIRM_PRE_APPROVAL.equals(intent.getAction())); fillIn.putExtra(Intent.EXTRA_INTENT, intent); try { target.sendIntent(context, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, fillIn, null /* onFinished */, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading Loading @@ -4805,7 +4811,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } } try { target.sendIntent(context, 0, fillIn, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, fillIn, null /* onFinished */, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading Loading @@ -4839,7 +4848,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { intent.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, "Staging Image Not Ready"); } try { target.sendIntent(context, 0, intent, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); target.sendIntent(context, 0, intent, null /* onFinished */, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (IntentSender.SendIntentException ignored) { } } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +6 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import android.annotation.WorkerThread; import android.app.ActivityManager; import android.app.AppOpsManager; import android.app.ApplicationPackageManager; import android.app.BroadcastOptions; import android.app.IActivityManager; import android.app.admin.IDevicePolicyManager; import android.app.admin.SecurityLog; Loading Loading @@ -4948,7 +4949,11 @@ public class PackageManagerService implements PackageSender, TestUtilityService } if (pi != null) { try { pi.sendIntent(null, success ? 1 : 0, null, null, null); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); pi.sendIntent(null, success ? 1 : 0, null /* intent */, null /* onFinished*/, null /* handler */, null /* requiredPermission */, options.toBundle()); } catch (SendIntentException e) { Slog.w(TAG, e); } Loading