[automerge] Checking if package belongs to UID before registering broadcast receiver 2p: 8460609f01

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20640805

Bug: 242040055
Change-Id: Ibcdb5d4a9a9d45bfd835141309e33dc1b54c8cfd
Merged-In: Ia525f218a46f8bf7fff660cec0d6432f09fdf24d
This commit is contained in:
Presubmit Automerger Backend
2023-01-05 20:47:54 +00:00

View File

@@ -3200,6 +3200,11 @@ public final class ActiveServices {
throw new SecurityException("BIND_EXTERNAL_SERVICE failed, "
+ className + " is not an isolatedProcess");
}
if (AppGlobals.getPackageManager().getPackageUid(callingPackage,
0, userId) != callingUid) {
throw new SecurityException("BIND_EXTERNAL_SERVICE failed, "
+ "calling package not owned by calling UID ");
}
// Run the service under the calling package's application.
ApplicationInfo aInfo = AppGlobals.getPackageManager().getApplicationInfo(
callingPackage, ActivityManagerService.STOCK_PM_FLAGS, userId);