Loading core/java/android/service/credentials/CredentialProviderInfoFactory.java +11 −31 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, @UserIdInt int userId, boolean disableSystemAppVerificationForTests, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { requireNonNull(context, "context must not be null"); final List<CredentialProviderInfo> providerInfos = new ArrayList<>(); Loading @@ -342,7 +342,7 @@ public final class CredentialProviderInfoFactory { si, /* isSystemProvider= */ true, disableSystemAppVerificationForTests, enabledServices.contains(si)); enabledServices.contains(si.getComponentName())); if (cpi.isSystemProvider()) { providerInfos.add(cpi); } else { Loading Loading @@ -370,31 +370,6 @@ public final class CredentialProviderInfoFactory { return null; } /** * Returns a valid credential provider that has the given package name. Returns null if no * match is found. */ @Nullable public static CredentialProviderInfo getCredentialProviderFromPackageName( @NonNull Context context, int userId, @NonNull String packageName, int providerFilter, @NonNull Set<ServiceInfo> enabledServices) { requireNonNull(context, "context must not be null"); requireNonNull(packageName, "package name must not be null"); requireNonNull(enabledServices, "enabledServices must not be null"); for (CredentialProviderInfo credentialProviderInfo : getCredentialProviderServices(context, userId, providerFilter, enabledServices)) { if (credentialProviderInfo.getServiceInfo() .packageName.equals(packageName)) { return credentialProviderInfo; } } return null; } /** * Returns the valid credential provider services available for the user with the given {@code * userId}. Loading @@ -404,7 +379,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, int userId, int providerFilter, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { requireNonNull(context, "context must not be null"); // Get the device policy. Loading Loading @@ -433,7 +408,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, int userId, int providerFilter, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { requireNonNull(context, "context must not be null"); // Get the device policy. Loading Loading @@ -539,7 +514,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, @UserIdInt int userId, boolean disableSystemAppVerificationForTests, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { final List<CredentialProviderInfo> services = new ArrayList<>(); final List<ResolveInfo> resolveInfos = context.getPackageManager() Loading @@ -549,6 +524,11 @@ public final class CredentialProviderInfoFactory { userId); for (ResolveInfo resolveInfo : resolveInfos) { final ServiceInfo serviceInfo = resolveInfo.serviceInfo; if (serviceInfo == null) { Log.i(TAG, "No serviceInfo found for resolveInfo so skipping this provider"); continue; } try { CredentialProviderInfo cpi = CredentialProviderInfoFactory.create( Loading @@ -556,7 +536,7 @@ public final class CredentialProviderInfoFactory { serviceInfo, /* isSystemProvider= */ false, disableSystemAppVerificationForTests, enabledServices.contains(serviceInfo)); enabledServices.contains(serviceInfo.getComponentName())); if (!cpi.isSystemProvider()) { services.add(cpi); } Loading services/credentials/java/com/android/server/credentials/CredentialManagerService.java +11 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.credentials.ClearCredentialStateRequest; import android.credentials.CreateCredentialException; import android.credentials.CreateCredentialRequest; Loading Loading @@ -696,13 +695,20 @@ public final class CredentialManagerService @SuppressWarnings("GuardedBy") // ErrorProne requires service.mLock which is the same // this.mLock private Set<ServiceInfo> getEnabledProviders() { Set<ServiceInfo> enabledProviders = new HashSet<>(); private Set<ComponentName> getEnabledProviders() { Set<ComponentName> enabledProviders = new HashSet<>(); synchronized (mLock) { runForUser( (service) -> { try { enabledProviders.add( service.getCredentialProviderInfo().getServiceInfo()); service.getCredentialProviderInfo() .getServiceInfo().getComponentName()); } catch (NullPointerException e) { // Safe check Log.i(TAG, "Skipping provider as either the providerInfo" + "or serviceInfo is null - weird"); } }); } return enabledProviders; Loading Loading
core/java/android/service/credentials/CredentialProviderInfoFactory.java +11 −31 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, @UserIdInt int userId, boolean disableSystemAppVerificationForTests, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { requireNonNull(context, "context must not be null"); final List<CredentialProviderInfo> providerInfos = new ArrayList<>(); Loading @@ -342,7 +342,7 @@ public final class CredentialProviderInfoFactory { si, /* isSystemProvider= */ true, disableSystemAppVerificationForTests, enabledServices.contains(si)); enabledServices.contains(si.getComponentName())); if (cpi.isSystemProvider()) { providerInfos.add(cpi); } else { Loading Loading @@ -370,31 +370,6 @@ public final class CredentialProviderInfoFactory { return null; } /** * Returns a valid credential provider that has the given package name. Returns null if no * match is found. */ @Nullable public static CredentialProviderInfo getCredentialProviderFromPackageName( @NonNull Context context, int userId, @NonNull String packageName, int providerFilter, @NonNull Set<ServiceInfo> enabledServices) { requireNonNull(context, "context must not be null"); requireNonNull(packageName, "package name must not be null"); requireNonNull(enabledServices, "enabledServices must not be null"); for (CredentialProviderInfo credentialProviderInfo : getCredentialProviderServices(context, userId, providerFilter, enabledServices)) { if (credentialProviderInfo.getServiceInfo() .packageName.equals(packageName)) { return credentialProviderInfo; } } return null; } /** * Returns the valid credential provider services available for the user with the given {@code * userId}. Loading @@ -404,7 +379,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, int userId, int providerFilter, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { requireNonNull(context, "context must not be null"); // Get the device policy. Loading Loading @@ -433,7 +408,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, int userId, int providerFilter, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { requireNonNull(context, "context must not be null"); // Get the device policy. Loading Loading @@ -539,7 +514,7 @@ public final class CredentialProviderInfoFactory { @NonNull Context context, @UserIdInt int userId, boolean disableSystemAppVerificationForTests, Set<ServiceInfo> enabledServices) { Set<ComponentName> enabledServices) { final List<CredentialProviderInfo> services = new ArrayList<>(); final List<ResolveInfo> resolveInfos = context.getPackageManager() Loading @@ -549,6 +524,11 @@ public final class CredentialProviderInfoFactory { userId); for (ResolveInfo resolveInfo : resolveInfos) { final ServiceInfo serviceInfo = resolveInfo.serviceInfo; if (serviceInfo == null) { Log.i(TAG, "No serviceInfo found for resolveInfo so skipping this provider"); continue; } try { CredentialProviderInfo cpi = CredentialProviderInfoFactory.create( Loading @@ -556,7 +536,7 @@ public final class CredentialProviderInfoFactory { serviceInfo, /* isSystemProvider= */ false, disableSystemAppVerificationForTests, enabledServices.contains(serviceInfo)); enabledServices.contains(serviceInfo.getComponentName())); if (!cpi.isSystemProvider()) { services.add(cpi); } Loading
services/credentials/java/com/android/server/credentials/CredentialManagerService.java +11 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.credentials.ClearCredentialStateRequest; import android.credentials.CreateCredentialException; import android.credentials.CreateCredentialRequest; Loading Loading @@ -696,13 +695,20 @@ public final class CredentialManagerService @SuppressWarnings("GuardedBy") // ErrorProne requires service.mLock which is the same // this.mLock private Set<ServiceInfo> getEnabledProviders() { Set<ServiceInfo> enabledProviders = new HashSet<>(); private Set<ComponentName> getEnabledProviders() { Set<ComponentName> enabledProviders = new HashSet<>(); synchronized (mLock) { runForUser( (service) -> { try { enabledProviders.add( service.getCredentialProviderInfo().getServiceInfo()); service.getCredentialProviderInfo() .getServiceInfo().getComponentName()); } catch (NullPointerException e) { // Safe check Log.i(TAG, "Skipping provider as either the providerInfo" + "or serviceInfo is null - weird"); } }); } return enabledProviders; Loading