From 66e89d3e89bc3eb2511c58d5378e94b56042466f Mon Sep 17 00:00:00 2001 From: Becca Hughes Date: Wed, 22 Mar 2023 22:11:27 +0000 Subject: [PATCH] Remove deprected capability API As per request of API council remove this API. Test: CTS & make Bug: 274510418 Merged-In: I65b7a24ed0170233dd6f3cc85961d5b61de2f42d Change-Id: I65b7a24ed0170233dd6f3cc85961d5b61de2f42d --- core/api/current.txt | 1 - .../CredentialProviderInfoFactory.java | 40 ------------------- .../CredentialProviderService.java | 8 ---- 3 files changed, 49 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index b91144b3a0457..3d771c0d5e27d 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -40732,7 +40732,6 @@ package android.service.credentials { method public abstract void onBeginGetCredential(@NonNull android.service.credentials.BeginGetCredentialRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver); method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent); method public abstract void onClearCredentialState(@NonNull android.service.credentials.ClearCredentialStateRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver); - field @Deprecated public static final String CAPABILITY_META_DATA_KEY = "android.credentials.capabilities"; field public static final String EXTRA_BEGIN_GET_CREDENTIAL_REQUEST = "android.service.credentials.extra.BEGIN_GET_CREDENTIAL_REQUEST"; field public static final String EXTRA_BEGIN_GET_CREDENTIAL_RESPONSE = "android.service.credentials.extra.BEGIN_GET_CREDENTIAL_RESPONSE"; field public static final String EXTRA_CREATE_CREDENTIAL_EXCEPTION = "android.service.credentials.extra.CREATE_CREDENTIAL_EXCEPTION"; diff --git a/core/java/android/service/credentials/CredentialProviderInfoFactory.java b/core/java/android/service/credentials/CredentialProviderInfoFactory.java index 8069414c3e6e7..b9249a5e50e41 100644 --- a/core/java/android/service/credentials/CredentialProviderInfoFactory.java +++ b/core/java/android/service/credentials/CredentialProviderInfoFactory.java @@ -240,14 +240,6 @@ public final class CredentialProviderInfoFactory { Log.e(TAG, "Failed to get XML metadata", e); } - // 5. Extract the legacy metadata. - try { - builder.addCapabilities( - populateLegacyProviderCapabilities(resources, metadata, serviceInfo)); - } catch (Exception e) { - Log.e(TAG, "Failed to get legacy metadata ", e); - } - return builder; } @@ -341,38 +333,6 @@ public final class CredentialProviderInfoFactory { return capabilities; } - private static Set populateLegacyProviderCapabilities( - Resources resources, Bundle metadata, ServiceInfo serviceInfo) { - Set output = new HashSet<>(); - Set capabilities = new HashSet<>(); - - try { - String[] discovered = - resources.getStringArray( - metadata.getInt(CredentialProviderService.CAPABILITY_META_DATA_KEY)); - if (discovered != null) { - capabilities.addAll(Arrays.asList(discovered)); - } - } catch (Resources.NotFoundException | NullPointerException e) { - Log.e(TAG, "Failed to get capabilities: ", e); - } - - if (capabilities.size() == 0) { - Log.e(TAG, "No capabilities found for provider:" + serviceInfo); - return output; - } - - for (String capability : capabilities) { - if (capability == null || capability.isEmpty()) { - Log.w(TAG, "Skipping empty/null capability"); - continue; - } - Log.i(TAG, "Capabilities found for provider: " + capability); - output.add(capability); - } - return output; - } - private static ServiceInfo getServiceInfoOrThrow( @NonNull ComponentName serviceComponent, int userId) throws PackageManager.NameNotFoundException { diff --git a/core/java/android/service/credentials/CredentialProviderService.java b/core/java/android/service/credentials/CredentialProviderService.java index 6824159706cd3..b977606560596 100644 --- a/core/java/android/service/credentials/CredentialProviderService.java +++ b/core/java/android/service/credentials/CredentialProviderService.java @@ -156,14 +156,6 @@ public abstract class CredentialProviderService extends Service { private static final String TAG = "CredProviderService"; - /** - * The list of capabilities exposed by a credential provider. - * - * @deprecated Replaced with {@link android.service.credentials#SERVICE_META_DATA} - */ - @Deprecated - public static final String CAPABILITY_META_DATA_KEY = "android.credentials.capabilities"; - /** * Name under which a Credential Provider service component publishes information * about itself. This meta-data must reference an XML resource containing