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();