OSDN Git Service

Don't get application info for the system
authorJulia Reynolds <juliacr@google.com>
Mon, 11 Apr 2016 18:52:32 +0000 (14:52 -0400)
committerJulia Reynolds <juliacr@google.com>
Mon, 11 Apr 2016 18:53:42 +0000 (14:53 -0400)
Bug: 28107178
Change-Id: Ic1a75a7d6d6e80e0df8f3017fb8737cf18f4dd3a

services/core/java/com/android/server/notification/NotificationManagerService.java

index f20d0a1..3cd194b 100644 (file)
@@ -2459,10 +2459,12 @@ public class NotificationManagerService extends SystemService {
 
         // Fix the notification as best we can.
         try {
-            Notification.addFieldsFromContext(getContext().createApplicationContext(
-                    getContext().getPackageManager().getApplicationInfoAsUser(
-                            pkg, PackageManager.MATCH_UNINSTALLED_PACKAGES, userId),
-                    Context.CONTEXT_RESTRICTED), notification);
+            if (!"android".equals(pkg) && !"system".equals(pkg)) {
+                Notification.addFieldsFromContext(getContext().createApplicationContext(
+                        getContext().getPackageManager().getApplicationInfoAsUser(
+                                pkg, PackageManager.MATCH_UNINSTALLED_PACKAGES, userId),
+                        Context.CONTEXT_RESTRICTED), notification);
+            }
         } catch (NameNotFoundException e) {
             Slog.e(TAG, "Cannot create a context for sending app", e);
             return;