From 74f972e215fcb3d33791a6a08b9201e9d84e735c Mon Sep 17 00:00:00 2001 From: Xiaoyu Jin Date: Mon, 27 Dec 2021 01:13:29 +0000 Subject: [PATCH] Add documents for the required permission In order to registerContentObserver as other user, callers need to hold the INTERACT_ACROSS_USERS_FULL permission. Bug: 206743591 Test: CtsContentTestCases Change-Id: I2f373a3f064718cc87bdda35a5854b6a6fd2e7aa --- core/java/android/content/ContentResolver.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 01d231c517515..7b9d37e7136de 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -2670,6 +2670,9 @@ public abstract class ContentResolver implements ContentInterface { * {@link ContentObserver#onChange(boolean, Collection, int, UserHandle)} should be * overwritten to get the corresponding {@link UserHandle} for that notification. * + *

If you don't hold the {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} + * permission, you can register the {@link ContentObserver} only for current user. + * * @param uri The URI to watch for changes. This can be a specific row URI, * or a base URI for a whole class of content. * @param notifyForDescendants When false, the observer will be notified