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

Commit 24471425 authored by Jackal Guo's avatar Jackal Guo
Browse files

Honor app visibility for broadcasting PACKAGE_RESTARTED

Bug: 224976267
Test: atest -p services/core/java/com/android/server/am
Test: manually using the PoC in the buganizer to ensure the symptom
      no longer exists.

Change-Id: I42e10b8c2740455a7f3dbd42886fd6eb90f7c03d
parent 9a52759e
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -4273,12 +4273,19 @@ public class ActivityManagerService extends IActivityManager.Stub
            intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY
                    | Intent.FLAG_RECEIVER_FOREGROUND);
        }
        final int userId = UserHandle.getUserId(uid);
        final int[] broadcastAllowList =
                getPackageManagerInternal().getVisibilityAllowList(packageName, userId);
        intent.putExtra(Intent.EXTRA_UID, uid);
        intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(uid));
        broadcastIntentLocked(null, null, null, intent,
                null, null, 0, null, null, null, null, OP_NONE,
                null, false, false, MY_PID, SYSTEM_UID, Binder.getCallingUid(),
                Binder.getCallingPid(), UserHandle.getUserId(uid));
        intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
        broadcastIntentLocked(null /* callerApp */, null /* callerPackage */,
                null /* callerFeatureId */, intent, null /* resolvedType */, null /* resultTo */,
                0 /* resultCode */, null /* resultData */, null /* resultExtras */,
                null /* requiredPermissions */, null /* excludedPermissions */, OP_NONE,
                null /* bOptions */, false /* ordered */, false /* sticky */, MY_PID, SYSTEM_UID,
                Binder.getCallingUid(), Binder.getCallingPid(), userId,
                false /* allowBackgroundActivityStarts */, null /* backgroundActivityStartsToken */,
                broadcastAllowList);
    }
    private void cleanupDisabledPackageComponentsLocked(