diff options
author | Alexandra Gherghina <alexgherghina@google.com> | 2014-07-15 23:11:48 +0100 |
---|---|---|
committer | Alexandra Gherghina <alexgherghina@google.com> | 2014-07-22 20:15:45 +0000 |
commit | 0e9ac20d7e0c9aca8cd342d97465adfac4c7e6e1 (patch) | |
tree | 57e755963135f2ddbc58d02f6de9c1619c4df211 | |
parent | b192a1762a15fd2f0ac8340fef572bd1717c24a7 (diff) | |
download | frameworks_base-0e9ac20d7e0c9aca8cd342d97465adfac4c7e6e1.zip frameworks_base-0e9ac20d7e0c9aca8cd342d97465adfac4c7e6e1.tar.gz frameworks_base-0e9ac20d7e0c9aca8cd342d97465adfac4c7e6e1.tar.bz2 |
Do Not Merge Per-user API for master sync
Change-Id: I6a8088eb3bfddae4c8e38904dd26baf3c7c09c9e
(cherry picked from commit 222aea8bd997807784dc99ca53f63280d384fdf0)
-rw-r--r-- | core/java/android/content/ContentResolver.java | 10 | ||||
-rw-r--r-- | core/java/android/content/IContentService.aidl | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/content/ContentService.java | 8 |
3 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index de3b881..87d14b9 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -2153,8 +2153,16 @@ public abstract class ContentResolver { * @param sync the master auto-sync setting that applies to all the providers and accounts */ public static void setMasterSyncAutomatically(boolean sync) { + setMasterSyncAutomaticallyAsUser(sync, UserHandle.getCallingUserId()); + } + + /** + * @see #setMasterSyncAutomatically(boolean) + * @hide + */ + public static void setMasterSyncAutomaticallyAsUser(boolean sync, int userId) { try { - getContentService().setMasterSyncAutomatically(sync); + getContentService().setMasterSyncAutomaticallyAsUser(sync, userId); } catch (RemoteException e) { // exception ignored; if this is thrown then it means the runtime is in the midst of // being restarted diff --git a/core/java/android/content/IContentService.aidl b/core/java/android/content/IContentService.aidl index d363ad1..9998f08 100644 --- a/core/java/android/content/IContentService.aidl +++ b/core/java/android/content/IContentService.aidl @@ -128,6 +128,7 @@ interface IContentService { void setIsSyncable(in Account account, String providerName, int syncable); void setMasterSyncAutomatically(boolean flag); + void setMasterSyncAutomaticallyAsUser(boolean flag, int userId); boolean getMasterSyncAutomatically(); boolean getMasterSyncAutomaticallyAsUser(int userId); diff --git a/services/core/java/com/android/server/content/ContentService.java b/services/core/java/com/android/server/content/ContentService.java index 1279c6e..64d3dc5 100644 --- a/services/core/java/com/android/server/content/ContentService.java +++ b/services/core/java/com/android/server/content/ContentService.java @@ -719,10 +719,16 @@ public final class ContentService extends IContentService.Stub { @Override public void setMasterSyncAutomatically(boolean flag) { + setMasterSyncAutomaticallyAsUser(flag, UserHandle.getCallingUserId()); + } + + @Override + public void setMasterSyncAutomaticallyAsUser(boolean flag, int userId) { + enforceCrossUserPermission(userId, + "no permission to set the sync status for user " + userId); mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS, "no permission to write the sync settings"); - int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); |