Use context's userId in ContentResolver class.
- When registering and notifying observers, we should use the user in the
context as opposed to current user.
- Relax the permission check while registering and notifying content observers
to use INTERACT_ACROSS_USERS instead of INTERACT_ACROSS_USERS_FULL permission.
Change-Id: I973936903d4a2272c5722f3b98a057a40c0402be
Fixes: 32955100
Test: Created managed profile and verified that there are not failures.
runtest -x core/tests/coretests/src/android/content/SecondaryUserContentResolverTest.java
runtest -x core/tests/coretests/src/android/content/ManagedUserContentResolverTest.java
This commit is contained in:
@@ -1886,7 +1886,7 @@ public abstract class ContentResolver {
|
||||
ContentProvider.getUriWithoutUserId(uri),
|
||||
notifyForDescendants,
|
||||
observer,
|
||||
ContentProvider.getUserIdFromUri(uri, UserHandle.myUserId()));
|
||||
ContentProvider.getUserIdFromUri(uri, mContext.getUserId()));
|
||||
}
|
||||
|
||||
/** @hide - designated user version */
|
||||
@@ -1956,7 +1956,7 @@ public abstract class ContentResolver {
|
||||
ContentProvider.getUriWithoutUserId(uri),
|
||||
observer,
|
||||
syncToNetwork,
|
||||
ContentProvider.getUserIdFromUri(uri, UserHandle.myUserId()));
|
||||
ContentProvider.getUserIdFromUri(uri, mContext.getUserId()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1982,7 +1982,7 @@ public abstract class ContentResolver {
|
||||
ContentProvider.getUriWithoutUserId(uri),
|
||||
observer,
|
||||
flags,
|
||||
ContentProvider.getUserIdFromUri(uri, UserHandle.myUserId()));
|
||||
ContentProvider.getUserIdFromUri(uri, mContext.getUserId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user