Further Credentials-related clean-up
Remove methods from the Credentials class that are no longer used, now that KeyChain no longer depends on the presence of a screen lock. Bug: 120901345 Test: That it builds, manually with CtsVerifier Change-Id: I37ad617f076a9ea9b5a5c789cd1da77110ad7b3b
This commit is contained in:
@@ -16,12 +16,6 @@
|
||||
|
||||
package android.security;
|
||||
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.org.bouncycastle.util.io.pem.PemObject;
|
||||
import com.android.org.bouncycastle.util.io.pem.PemReader;
|
||||
import com.android.org.bouncycastle.util.io.pem.PemWriter;
|
||||
@@ -34,7 +28,6 @@ import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.KeyPair;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.CertificateException;
|
||||
@@ -53,8 +46,6 @@ public class Credentials {
|
||||
|
||||
public static final String INSTALL_AS_USER_ACTION = "android.credentials.INSTALL_AS_USER";
|
||||
|
||||
public static final String UNLOCK_ACTION = "com.android.credentials.UNLOCK";
|
||||
|
||||
/** Key prefix for CA certificates. */
|
||||
public static final String CA_CERTIFICATE = "CACERT_";
|
||||
|
||||
@@ -171,58 +162,6 @@ public class Credentials {
|
||||
}
|
||||
}
|
||||
|
||||
private static Credentials singleton;
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public static Credentials getInstance() {
|
||||
if (singleton == null) {
|
||||
singleton = new Credentials();
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public void unlock(Context context) {
|
||||
try {
|
||||
Intent intent = new Intent(UNLOCK_ACTION);
|
||||
context.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w(LOGTAG, e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void install(Context context) {
|
||||
try {
|
||||
Intent intent = KeyChain.createInstallIntent();
|
||||
context.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w(LOGTAG, e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public void install(Context context, KeyPair pair) {
|
||||
try {
|
||||
Intent intent = KeyChain.createInstallIntent();
|
||||
intent.putExtra(EXTRA_PRIVATE_KEY, pair.getPrivate().getEncoded());
|
||||
intent.putExtra(EXTRA_PUBLIC_KEY, pair.getPublic().getEncoded());
|
||||
context.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w(LOGTAG, e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public void install(Context context, String type, byte[] value) {
|
||||
try {
|
||||
Intent intent = KeyChain.createInstallIntent();
|
||||
intent.putExtra(type, value);
|
||||
context.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w(LOGTAG, e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all types (private key, user certificate, CA certificate) for a
|
||||
* particular {@code alias}. All three can exist for any given alias.
|
||||
|
||||
Reference in New Issue
Block a user