Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 011805bf authored by Jackal Guo's avatar Jackal Guo Committed by Android (Google) Code Review
Browse files

Merge "Apply package visibility to LauncherApps.Callback" into sc-dev

parents b63dedbb a3e316fb
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -2568,6 +2568,32 @@ public class Intent implements Parcelable, Cloneable {
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
    /**
     * Broadcast Action: An existing application package has been removed from
     * the device. The data contains the name of the package and the visibility
     * allow list. The package that is being removed does <em>not</em> receive
     * this Intent.
     * <ul>
     * <li> {@link #EXTRA_UID} containing the integer uid previously assigned
     * to the package.
     * <li> {@link #EXTRA_DATA_REMOVED} is set to true if the entire
     * application -- data and code -- is being removed.
     * <li> {@link #EXTRA_REPLACING} is set to true if this will be followed
     * by an {@link #ACTION_PACKAGE_ADDED} broadcast for the same package.
     * <li> {@link #EXTRA_USER_INITIATED} containing boolean field to signal
     * that the application was removed with the user-initiated action.
     * <li> {@link #EXTRA_VISIBILITY_ALLOW_LIST} containing an int array to
     * indicate the visibility allow list.
     * </ul>
     *
     * <p class="note">This is a protected intent that can only be sent
     * by the system.
     *
     * @hide This broadcast is used internally by the system.
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_PACKAGE_REMOVED_INTERNAL =
            "android.intent.action.PACKAGE_REMOVED_INTERNAL";
    /**
     * Broadcast Action: An existing application package has been completely
     * removed from the device.  The data contains the name of the package.
@@ -6122,6 +6148,16 @@ public class Intent implements Parcelable, Cloneable {
     */
    public static final String EXTRA_LOCUS_ID = "android.intent.extra.LOCUS_ID";

    /**
     * Used as an int array extra field in
     * {@link android.content.Intent#ACTION_PACKAGE_REMOVED_INTERNAL}
     * intents to indicate that visibility allow list of this removed package.
     *
     * @hide
     */
    public static final String EXTRA_VISIBILITY_ALLOW_LIST =
            "android.intent.extra.VISIBILITY_ALLOW_LIST";

    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // Intent flags (see mFlags variable).
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
    <protected-broadcast android:name="android.intent.action.PACKAGE_REPLACED" />
    <protected-broadcast android:name="android.intent.action.MY_PACKAGE_REPLACED" />
    <protected-broadcast android:name="android.intent.action.PACKAGE_REMOVED" />
    <protected-broadcast android:name="android.intent.action.PACKAGE_REMOVED_INTERNAL" />
    <protected-broadcast android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />
    <protected-broadcast android:name="android.intent.action.PACKAGE_CHANGED" />
    <protected-broadcast android:name="android.intent.action.PACKAGE_FULLY_LOADED" />
+197 −97

File changed.

Preview size limit exceeded, changes collapsed.

+7 −0
Original line number Diff line number Diff line
@@ -15033,6 +15033,9 @@ public class PackageManagerService extends IPackageManager.Stub
                uid = UserHandle.getUid(id, UserHandle.getAppId(uid));
                intent.putExtra(Intent.EXTRA_UID, uid);
            }
            if (broadcastAllowList != null && PLATFORM_PACKAGE_NAME.equals(targetPkg)) {
                intent.putExtra(Intent.EXTRA_VISIBILITY_ALLOW_LIST, broadcastAllowList.get(id));
            }
            intent.putExtra(Intent.EXTRA_USER_HANDLE, id);
            intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | flags);
            if (DEBUG_BROADCASTS) {
@@ -21001,6 +21004,10 @@ public class PackageManagerService extends IPackageManager.Stub
                            removedPackage, extras, 0 /*flags*/,
                            installerPackageName, null, broadcastUsers, instantUserIds, null, null);
                }
                packageSender.sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED_INTERNAL,
                        removedPackage, extras, 0 /*flags*/, PLATFORM_PACKAGE_NAME,
                        null /*finishedReceiver*/, broadcastUsers, instantUserIds,
                        broadcastAllowList, null /*bOptions*/);
                if (dataRemoved && !isRemovedPackageSystemUpdate) {
                    packageSender.sendPackageBroadcast(Intent.ACTION_PACKAGE_FULLY_REMOVED,
                            removedPackage, extras, Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND, null,