Loading services/core/java/com/android/server/content/ContentService.java +3 −1 Original line number Diff line number Diff line Loading @@ -807,12 +807,14 @@ public final class ContentService extends IContentService.Stub { public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) { enforceCrossUserPermission(userId, "no permission to read sync settings for user " + userId); final int callingUid = Binder.getCallingUid(); // This makes it so that future permission checks will be in the context of this // process rather than the caller's process. We will restore this before returning. final long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); return syncManager.getSyncAdapterPackagesForAuthorityAsUser(authority, userId); return syncManager.getSyncAdapterPackagesForAuthorityAsUser(authority, callingUid, userId); } finally { restoreCallingIdentity(identityToken); } Loading services/core/java/com/android/server/content/SyncManager.java +13 −2 Original line number Diff line number Diff line Loading @@ -1268,8 +1268,19 @@ public class SyncManager { return types.toArray(new SyncAdapterType[] {}); } public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) { return mSyncAdapters.getSyncAdapterPackagesForAuthority(authority, userId); public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int callingUid, int userId) { final String[] syncAdapterPackages = mSyncAdapters.getSyncAdapterPackagesForAuthority( authority, userId); final List<String> filteredResult = new ArrayList<>(syncAdapterPackages.length); for (String packageName : syncAdapterPackages) { if (TextUtils.isEmpty(packageName) || mPackageManagerInternal.filterAppAccess( packageName, callingUid, userId)) { continue; } filteredResult.add(packageName); } return filteredResult.toArray(new String[] {}); } private void sendSyncFinishedOrCanceledMessage(ActiveSyncContext syncContext, Loading Loading
services/core/java/com/android/server/content/ContentService.java +3 −1 Original line number Diff line number Diff line Loading @@ -807,12 +807,14 @@ public final class ContentService extends IContentService.Stub { public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) { enforceCrossUserPermission(userId, "no permission to read sync settings for user " + userId); final int callingUid = Binder.getCallingUid(); // This makes it so that future permission checks will be in the context of this // process rather than the caller's process. We will restore this before returning. final long identityToken = clearCallingIdentity(); try { SyncManager syncManager = getSyncManager(); return syncManager.getSyncAdapterPackagesForAuthorityAsUser(authority, userId); return syncManager.getSyncAdapterPackagesForAuthorityAsUser(authority, callingUid, userId); } finally { restoreCallingIdentity(identityToken); } Loading
services/core/java/com/android/server/content/SyncManager.java +13 −2 Original line number Diff line number Diff line Loading @@ -1268,8 +1268,19 @@ public class SyncManager { return types.toArray(new SyncAdapterType[] {}); } public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) { return mSyncAdapters.getSyncAdapterPackagesForAuthority(authority, userId); public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int callingUid, int userId) { final String[] syncAdapterPackages = mSyncAdapters.getSyncAdapterPackagesForAuthority( authority, userId); final List<String> filteredResult = new ArrayList<>(syncAdapterPackages.length); for (String packageName : syncAdapterPackages) { if (TextUtils.isEmpty(packageName) || mPackageManagerInternal.filterAppAccess( packageName, callingUid, userId)) { continue; } filteredResult.add(packageName); } return filteredResult.toArray(new String[] {}); } private void sendSyncFinishedOrCanceledMessage(ActiveSyncContext syncContext, Loading