Loading core/java/android/app/ApplicationPackageManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -1024,12 +1024,18 @@ public class ApplicationPackageManager extends PackageManager { } @Override @SuppressWarnings("unchecked") public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) { return queryContentProviders(processName, uid, flags, null); } @Override @SuppressWarnings("unchecked") public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags, String metaDataKey) { try { ParceledListSlice<ProviderInfo> slice = mPM.queryContentProviders(processName, uid, flags); mPM.queryContentProviders(processName, uid, flags, metaDataKey); return slice != null ? slice.getList() : Collections.<ProviderInfo>emptyList(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading core/java/android/content/pm/IPackageManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ interface IPackageManager { inout List<ProviderInfo> outInfo); ParceledListSlice queryContentProviders( String processName, int uid, int flags); String processName, int uid, int flags, String metaDataKey); InstrumentationInfo getInstrumentationInfo( in ComponentName className, int flags); Loading core/java/android/content/pm/PackageManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -4461,6 +4461,27 @@ public abstract class PackageManager { public abstract List<ProviderInfo> queryContentProviders( String processName, int uid, @ComponentInfoFlags int flags); /** * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null, * it only returns providers which have metadata with the {@code metaDataKey} key. * * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider. * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders} * instead. * * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata * to mark GAL providers, rather than intent filters, so we can't use * {@link #queryIntentContentProviders} for that. * * @hide */ public List<ProviderInfo> queryContentProviders( String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) { // Provide the default implementation for mocks. return queryContentProviders(processName, uid, flags); } /** * Retrieve all of the information we know about a particular * instrumentation class. Loading services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -10645,7 +10645,7 @@ public class ActivityManagerService extends IActivityManager.Stub providers = AppGlobals.getPackageManager() .queryContentProviders(app.processName, app.uid, STOCK_PM_FLAGS | PackageManager.GET_URI_PERMISSION_PATTERNS | MATCH_DEBUG_TRIAGED_MISSING) | MATCH_DEBUG_TRIAGED_MISSING, /*metadastaKey=*/ null) .getList(); } catch (RemoteException ex) { } Loading services/core/java/com/android/server/pm/PackageManagerService.java +9 −1 Original line number Diff line number Diff line Loading @@ -7469,7 +7469,7 @@ public class PackageManagerService extends IPackageManager.Stub { @Override public @NonNull ParceledListSlice<ProviderInfo> queryContentProviders(String processName, int uid, int flags) { int uid, int flags, String metaDataKey) { final int userId = processName != null ? UserHandle.getUserId(uid) : UserHandle.getCallingUserId(); if (!sUserManager.exists(userId)) return ParceledListSlice.emptyList(); Loading @@ -7487,6 +7487,14 @@ public class PackageManagerService extends IPackageManager.Stub { || (p.info.processName.equals(processName) && UserHandle.isSameApp(p.info.applicationInfo.uid, uid))) && mSettings.isEnabledAndMatchLPr(p.info, flags, userId)) { // See PM.queryContentProviders()'s javadoc for why we have the metaData // parameter. if (metaDataKey != null && (p.metaData == null || !p.metaData.containsKey(metaDataKey))) { continue; } if (finalList == null) { finalList = new ArrayList<ProviderInfo>(3); } Loading
core/java/android/app/ApplicationPackageManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -1024,12 +1024,18 @@ public class ApplicationPackageManager extends PackageManager { } @Override @SuppressWarnings("unchecked") public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) { return queryContentProviders(processName, uid, flags, null); } @Override @SuppressWarnings("unchecked") public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags, String metaDataKey) { try { ParceledListSlice<ProviderInfo> slice = mPM.queryContentProviders(processName, uid, flags); mPM.queryContentProviders(processName, uid, flags, metaDataKey); return slice != null ? slice.getList() : Collections.<ProviderInfo>emptyList(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading
core/java/android/content/pm/IPackageManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ interface IPackageManager { inout List<ProviderInfo> outInfo); ParceledListSlice queryContentProviders( String processName, int uid, int flags); String processName, int uid, int flags, String metaDataKey); InstrumentationInfo getInstrumentationInfo( in ComponentName className, int flags); Loading
core/java/android/content/pm/PackageManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -4461,6 +4461,27 @@ public abstract class PackageManager { public abstract List<ProviderInfo> queryContentProviders( String processName, int uid, @ComponentInfoFlags int flags); /** * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null, * it only returns providers which have metadata with the {@code metaDataKey} key. * * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider. * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders} * instead. * * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata * to mark GAL providers, rather than intent filters, so we can't use * {@link #queryIntentContentProviders} for that. * * @hide */ public List<ProviderInfo> queryContentProviders( String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) { // Provide the default implementation for mocks. return queryContentProviders(processName, uid, flags); } /** * Retrieve all of the information we know about a particular * instrumentation class. Loading
services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -10645,7 +10645,7 @@ public class ActivityManagerService extends IActivityManager.Stub providers = AppGlobals.getPackageManager() .queryContentProviders(app.processName, app.uid, STOCK_PM_FLAGS | PackageManager.GET_URI_PERMISSION_PATTERNS | MATCH_DEBUG_TRIAGED_MISSING) | MATCH_DEBUG_TRIAGED_MISSING, /*metadastaKey=*/ null) .getList(); } catch (RemoteException ex) { } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +9 −1 Original line number Diff line number Diff line Loading @@ -7469,7 +7469,7 @@ public class PackageManagerService extends IPackageManager.Stub { @Override public @NonNull ParceledListSlice<ProviderInfo> queryContentProviders(String processName, int uid, int flags) { int uid, int flags, String metaDataKey) { final int userId = processName != null ? UserHandle.getUserId(uid) : UserHandle.getCallingUserId(); if (!sUserManager.exists(userId)) return ParceledListSlice.emptyList(); Loading @@ -7487,6 +7487,14 @@ public class PackageManagerService extends IPackageManager.Stub { || (p.info.processName.equals(processName) && UserHandle.isSameApp(p.info.applicationInfo.uid, uid))) && mSettings.isEnabledAndMatchLPr(p.info, flags, userId)) { // See PM.queryContentProviders()'s javadoc for why we have the metaData // parameter. if (metaDataKey != null && (p.metaData == null || !p.metaData.containsKey(metaDataKey))) { continue; } if (finalList == null) { finalList = new ArrayList<ProviderInfo>(3); }