Loading services/core/java/com/android/server/content/ContentService.java +12 −1 Original line number Diff line number Diff line Loading @@ -838,7 +838,7 @@ public final class ContentService extends IContentService.Stub { SyncManager syncManager = getSyncManager(); if (syncManager != null) { return syncManager.computeSyncable( account, userId, providerName); account, userId, providerName, false); } } finally { restoreCallingIdentity(identityToken); Loading @@ -854,6 +854,8 @@ public final class ContentService extends IContentService.Stub { mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS, "no permission to write the sync settings"); syncable = normalizeSyncable(syncable); int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { Loading Loading @@ -1156,6 +1158,15 @@ public final class ContentService extends IContentService.Stub { } } private static int normalizeSyncable(int syncable) { if (syncable > 0) { return SyncStorageEngine.AuthorityInfo.SYNCABLE; } else if (syncable == 0) { return SyncStorageEngine.AuthorityInfo.NOT_SYNCABLE; } return SyncStorageEngine.AuthorityInfo.UNDEFINED; } /** * Hide this class since it is not part of api, * but current unittest framework requires it to be public Loading services/core/java/com/android/server/content/SyncManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -1001,7 +1001,12 @@ public class SyncManager { } } public int computeSyncable(Account account, int userId, String authority) { private int computeSyncable(Account account, int userId, String authority) { return computeSyncable(account, userId, authority, true); } public int computeSyncable(Account account, int userId, String authority, boolean checkAccountAccess) { final int status = getIsSyncable(account, userId, authority); if (status == AuthorityInfo.NOT_SYNCABLE) { return AuthorityInfo.NOT_SYNCABLE; Loading @@ -1025,7 +1030,7 @@ public class SyncManager { } catch (RemoteException e) { /* ignore - local call */ } if (!canAccessAccount(account, owningPackage, owningUid)) { if (checkAccountAccess && !canAccessAccount(account, owningPackage, owningUid)) { Log.w(TAG, "Access to " + account + " denied for package " + owningPackage + " in UID " + syncAdapterInfo.uid); return AuthorityInfo.SYNCABLE_NO_ACCOUNT_ACCESS; Loading Loading
services/core/java/com/android/server/content/ContentService.java +12 −1 Original line number Diff line number Diff line Loading @@ -838,7 +838,7 @@ public final class ContentService extends IContentService.Stub { SyncManager syncManager = getSyncManager(); if (syncManager != null) { return syncManager.computeSyncable( account, userId, providerName); account, userId, providerName, false); } } finally { restoreCallingIdentity(identityToken); Loading @@ -854,6 +854,8 @@ public final class ContentService extends IContentService.Stub { mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS, "no permission to write the sync settings"); syncable = normalizeSyncable(syncable); int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { Loading Loading @@ -1156,6 +1158,15 @@ public final class ContentService extends IContentService.Stub { } } private static int normalizeSyncable(int syncable) { if (syncable > 0) { return SyncStorageEngine.AuthorityInfo.SYNCABLE; } else if (syncable == 0) { return SyncStorageEngine.AuthorityInfo.NOT_SYNCABLE; } return SyncStorageEngine.AuthorityInfo.UNDEFINED; } /** * Hide this class since it is not part of api, * but current unittest framework requires it to be public Loading
services/core/java/com/android/server/content/SyncManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -1001,7 +1001,12 @@ public class SyncManager { } } public int computeSyncable(Account account, int userId, String authority) { private int computeSyncable(Account account, int userId, String authority) { return computeSyncable(account, userId, authority, true); } public int computeSyncable(Account account, int userId, String authority, boolean checkAccountAccess) { final int status = getIsSyncable(account, userId, authority); if (status == AuthorityInfo.NOT_SYNCABLE) { return AuthorityInfo.NOT_SYNCABLE; Loading @@ -1025,7 +1030,7 @@ public class SyncManager { } catch (RemoteException e) { /* ignore - local call */ } if (!canAccessAccount(account, owningPackage, owningUid)) { if (checkAccountAccess && !canAccessAccount(account, owningPackage, owningUid)) { Log.w(TAG, "Access to " + account + " denied for package " + owningPackage + " in UID " + syncAdapterInfo.uid); return AuthorityInfo.SYNCABLE_NO_ACCOUNT_ACCESS; Loading