Merge "Remove deprected capability API" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a87fa51a6a
@@ -40720,7 +40720,6 @@ package android.service.credentials {
|
||||
method public abstract void onBeginGetCredential(@NonNull android.service.credentials.BeginGetCredentialRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver<android.service.credentials.BeginGetCredentialResponse,android.credentials.GetCredentialException>);
|
||||
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<java.lang.Void,android.credentials.ClearCredentialStateException>);
|
||||
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";
|
||||
|
||||
@@ -224,14 +224,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;
|
||||
}
|
||||
|
||||
@@ -325,38 +317,6 @@ public final class CredentialProviderInfoFactory {
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
private static Set<String> populateLegacyProviderCapabilities(
|
||||
Resources resources, Bundle metadata, ServiceInfo serviceInfo) {
|
||||
Set<String> output = new HashSet<>();
|
||||
Set<String> 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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user