From e761777323444e900ab683137a1e4d6abecdc728 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 27 Apr 2016 17:03:52 -0700 Subject: [PATCH] Fix issue #28431297: Crash in system process Don't allow null URIs to get put into the notification path. Change-Id: I4f68f438960c8a90c7b417feaa2e19968a3a200a --- core/java/android/content/ContentResolver.java | 4 ++-- .../core/java/com/android/server/content/ContentService.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 4db45670dd85b..aeda7a24066d8 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -1748,7 +1748,7 @@ public abstract class ContentResolver { * * @hide */ - public void notifyChange(Uri uri, ContentObserver observer, boolean syncToNetwork, + public void notifyChange(@NonNull Uri uri, ContentObserver observer, boolean syncToNetwork, @UserIdInt int userHandle) { try { getContentService().notifyChange( @@ -1765,7 +1765,7 @@ public abstract class ContentResolver { * * @hide */ - public void notifyChange(Uri uri, ContentObserver observer, @NotifyFlags int flags, + public void notifyChange(@NonNull Uri uri, ContentObserver observer, @NotifyFlags int flags, @UserIdInt int userHandle) { try { getContentService().notifyChange( diff --git a/services/core/java/com/android/server/content/ContentService.java b/services/core/java/com/android/server/content/ContentService.java index 03eb019bd3f87..2103cce63233e 100644 --- a/services/core/java/com/android/server/content/ContentService.java +++ b/services/core/java/com/android/server/content/ContentService.java @@ -352,6 +352,10 @@ public final class ContentService extends IContentService.Stub { if (DEBUG) Slog.d(TAG, "Notifying update of " + uri + " for user " + userHandle + " from observer " + observer + ", flags " + Integer.toHexString(flags)); + if (uri == null) { + throw new NullPointerException("Uri must not be null"); + } + final int uid = Binder.getCallingUid(); final int pid = Binder.getCallingPid(); final int callingUserHandle = UserHandle.getCallingUserId();