Don't dispatch Uris with appended user handle

This change fixes a bug where we started appending the user id
to the changing Uri for observers to know what user's Uri changed.
This is problematic as it changes the Uri structure expected by
observers. Also there are no public APIs to factor out the user
id from the Uri. If a system component needs to know for which
user a Uri changed it can use ContentObserver#onChange(boolean,
Uri, int) where the last argument is the user id.

bug:19312280

Change-Id: I5f0982ac3c8d6b6eab060bab65d3b53182660ac7
This commit is contained in:
Svet Ganov
2016-06-15 16:57:32 -07:00
parent 91131f459c
commit 3138a9938b

View File

@@ -393,18 +393,9 @@ public final class ContentService extends IContentService.Stub {
for (int i=0; i<numCalls; i++) {
ObserverCall oc = calls.get(i);
try {
// If the uri does not belong to the same user as the observer: we must add
// the userId to the uri. Otherewise the observer would think the uri belongs
// to his user.
final Uri tempUri;
if (oc.mObserverUserId != userHandle) {
tempUri = ContentProvider.maybeAddUserId(uri, userHandle);
} else {
tempUri = uri;
}
oc.mObserver.onChange(oc.mSelfChange, tempUri, userHandle);
oc.mObserver.onChange(oc.mSelfChange, uri, userHandle);
if (DEBUG) Slog.d(TAG, "Notified " + oc.mObserver + " of " + "update at "
+ tempUri);
+ uri);
} catch (RemoteException ex) {
synchronized (mRootNode) {
Log.w(TAG, "Found dead observer, removing");