Check caller's uid before allowing notification policy access.

Bug: 29421441
Change-Id: I7460268595e932d54660b02007bcd68b95fe8aec
This commit is contained in:
Julia Reynolds
2016-06-28 15:16:21 -04:00
parent d061c3abfa
commit f4811159f3

View File

@@ -1642,6 +1642,7 @@ public class NotificationManagerService extends SystemService {
}
private void enforcePolicyAccess(String pkg, String method) {
checkCallerIsSameApp(pkg);
if (!checkPolicyAccess(pkg)) {
Slog.w(TAG, "Notification policy access denied calling " + method);
throw new SecurityException("Notification policy access denied");
@@ -3130,6 +3131,10 @@ public class NotificationManagerService extends SystemService {
if (isCallerSystem()) {
return;
}
checkCallerIsSameApp(pkg);
}
private static void checkCallerIsSameApp(String pkg) {
final int uid = Binder.getCallingUid();
try {
ApplicationInfo ai = AppGlobals.getPackageManager().getApplicationInfo(