Loading core/java/android/content/ContentResolver.java +1 −1 Original line number Diff line number Diff line Loading @@ -1219,7 +1219,7 @@ public abstract class ContentResolver { public final void registerContentObserver(Uri uri, boolean notifyForDescendents, ContentObserver observer) { registerContentObserver(uri, notifyForDescendents, observer, UserHandle.getCallingUserId()); registerContentObserver(uri, notifyForDescendents, observer, UserHandle.myUserId()); } /** @hide - designated user version */ Loading core/java/android/database/AbstractCursor.java +7 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.database; import android.content.ContentResolver; import android.net.Uri; import android.os.Bundle; import android.os.UserHandle; import android.util.Log; import java.lang.ref.WeakReference; Loading Loading @@ -350,6 +351,11 @@ public abstract class AbstractCursor implements CrossProcessCursor { * specific row URI, or a base URI for a whole class of content. */ public void setNotificationUri(ContentResolver cr, Uri notifyUri) { setNotificationUri(cr, notifyUri, UserHandle.myUserId()); } /** @hide - set the notification uri but with an observer for a particular user's view */ public void setNotificationUri(ContentResolver cr, Uri notifyUri, int userHandle) { synchronized (mSelfObserverLock) { mNotifyUri = notifyUri; mContentResolver = cr; Loading @@ -357,7 +363,7 @@ public abstract class AbstractCursor implements CrossProcessCursor { mContentResolver.unregisterContentObserver(mSelfObserver); } mSelfObserver = new SelfContentObserver(this); mContentResolver.registerContentObserver(mNotifyUri, true, mSelfObserver); mContentResolver.registerContentObserver(mNotifyUri, true, mSelfObserver, userHandle); mSelfObserverRegistered = true; } } Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +11 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.AssetFileDescriptor; import android.database.AbstractCursor; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; Loading Loading @@ -685,7 +686,16 @@ public class SettingsProvider extends ContentProvider { qb.setTables(args.table); Cursor ret = qb.query(db, select, args.where, args.args, null, null, sort); ret.setNotificationUri(getContext().getContentResolver(), url); // the default Cursor interface does not support per-user observation try { AbstractCursor c = (AbstractCursor) ret; c.setNotificationUri(getContext().getContentResolver(), url, forUser); } catch (ClassCastException e) { // details of the concrete Cursor implementation have changed and this code has // not been updated to match -- complain and fail hard. Log.wtf(TAG, "Incompatible cursor derivation!"); throw e; } return ret; } Loading Loading
core/java/android/content/ContentResolver.java +1 −1 Original line number Diff line number Diff line Loading @@ -1219,7 +1219,7 @@ public abstract class ContentResolver { public final void registerContentObserver(Uri uri, boolean notifyForDescendents, ContentObserver observer) { registerContentObserver(uri, notifyForDescendents, observer, UserHandle.getCallingUserId()); registerContentObserver(uri, notifyForDescendents, observer, UserHandle.myUserId()); } /** @hide - designated user version */ Loading
core/java/android/database/AbstractCursor.java +7 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.database; import android.content.ContentResolver; import android.net.Uri; import android.os.Bundle; import android.os.UserHandle; import android.util.Log; import java.lang.ref.WeakReference; Loading Loading @@ -350,6 +351,11 @@ public abstract class AbstractCursor implements CrossProcessCursor { * specific row URI, or a base URI for a whole class of content. */ public void setNotificationUri(ContentResolver cr, Uri notifyUri) { setNotificationUri(cr, notifyUri, UserHandle.myUserId()); } /** @hide - set the notification uri but with an observer for a particular user's view */ public void setNotificationUri(ContentResolver cr, Uri notifyUri, int userHandle) { synchronized (mSelfObserverLock) { mNotifyUri = notifyUri; mContentResolver = cr; Loading @@ -357,7 +363,7 @@ public abstract class AbstractCursor implements CrossProcessCursor { mContentResolver.unregisterContentObserver(mSelfObserver); } mSelfObserver = new SelfContentObserver(this); mContentResolver.registerContentObserver(mNotifyUri, true, mSelfObserver); mContentResolver.registerContentObserver(mNotifyUri, true, mSelfObserver, userHandle); mSelfObserverRegistered = true; } } Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +11 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.AssetFileDescriptor; import android.database.AbstractCursor; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; Loading Loading @@ -685,7 +686,16 @@ public class SettingsProvider extends ContentProvider { qb.setTables(args.table); Cursor ret = qb.query(db, select, args.where, args.args, null, null, sort); ret.setNotificationUri(getContext().getContentResolver(), url); // the default Cursor interface does not support per-user observation try { AbstractCursor c = (AbstractCursor) ret; c.setNotificationUri(getContext().getContentResolver(), url, forUser); } catch (ClassCastException e) { // details of the concrete Cursor implementation have changed and this code has // not been updated to match -- complain and fail hard. Log.wtf(TAG, "Incompatible cursor derivation!"); throw e; } return ret; } Loading