diff options
Diffstat (limited to 'keystore/java/android/security')
-rw-r--r-- | keystore/java/android/security/KeyChain.java | 17 | ||||
-rw-r--r-- | keystore/java/android/security/KeyPairGeneratorSpec.java | 4 | ||||
-rw-r--r-- | keystore/java/android/security/KeyStoreParameter.java | 4 |
3 files changed, 18 insertions, 7 deletions
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java index 9d6d76e..0da2b99 100644 --- a/keystore/java/android/security/KeyChain.java +++ b/keystore/java/android/security/KeyChain.java @@ -23,7 +23,9 @@ import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.os.Looper; +import android.os.Process; import android.os.RemoteException; +import android.os.UserHandle; import java.io.ByteArrayInputStream; import java.io.Closeable; import java.security.InvalidKeyException; @@ -437,6 +439,14 @@ public final class KeyChain { * Caller should call unbindService on the result when finished. */ public static KeyChainConnection bind(Context context) throws InterruptedException { + return bindAsUser(context, Process.myUserHandle()); + } + + /** + * @hide + */ + public static KeyChainConnection bindAsUser(Context context, UserHandle user) + throws InterruptedException { if (context == null) { throw new NullPointerException("context == null"); } @@ -459,9 +469,10 @@ public final class KeyChain { Intent intent = new Intent(IKeyChainService.class.getName()); ComponentName comp = intent.resolveSystemService(context.getPackageManager(), 0); intent.setComponent(comp); - boolean isBound = context.bindService(intent, - keyChainServiceConnection, - Context.BIND_AUTO_CREATE); + boolean isBound = context.bindServiceAsUser(intent, + keyChainServiceConnection, + Context.BIND_AUTO_CREATE, + user); if (!isBound) { throw new AssertionError("could not bind to KeyChainService"); } diff --git a/keystore/java/android/security/KeyPairGeneratorSpec.java b/keystore/java/android/security/KeyPairGeneratorSpec.java index 21d6caa..4a823cc 100644 --- a/keystore/java/android/security/KeyPairGeneratorSpec.java +++ b/keystore/java/android/security/KeyPairGeneratorSpec.java @@ -35,7 +35,7 @@ import javax.security.auth.x500.X500Principal; /** * This provides the required parameters needed for initializing the * {@code KeyPairGenerator} that works with - * <a href="{@docRoot}guide/topics/security/keystore.html">Android KeyStore + * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore * facility</a>. The Android KeyStore facility is accessed through a * {@link java.security.KeyPairGenerator} API using the {@code AndroidKeyStore} * provider. The {@code context} passed in may be used to pop up some UI to ask @@ -306,7 +306,7 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { * Builder class for {@link KeyPairGeneratorSpec} objects. * <p> * This will build a parameter spec for use with the <a href="{@docRoot} - * guide/topics/security/keystore.html">Android KeyStore facility</a>. + * training/articles/keystore.html">Android KeyStore facility</a>. * <p> * The required fields must be filled in with the builder. * <p> diff --git a/keystore/java/android/security/KeyStoreParameter.java b/keystore/java/android/security/KeyStoreParameter.java index b71efc4..2eeb6ad 100644 --- a/keystore/java/android/security/KeyStoreParameter.java +++ b/keystore/java/android/security/KeyStoreParameter.java @@ -24,7 +24,7 @@ import java.security.KeyStore.ProtectionParameter; /** * This provides the optional parameters that can be specified for * {@code KeyStore} entries that work with - * <a href="{@docRoot}guide/topics/security/keystore.html">Android KeyStore + * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore * facility</a>. The Android KeyStore facility is accessed through a * {@link java.security.KeyStore} API using the {@code AndroidKeyStore} * provider. The {@code context} passed in may be used to pop up some UI to ask @@ -67,7 +67,7 @@ public final class KeyStoreParameter implements ProtectionParameter { * Builder class for {@link KeyStoreParameter} objects. * <p> * This will build protection parameters for use with the - * <a href="{@docRoot}guide/topics/security/keystore.html">Android KeyStore + * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore * facility</a>. * <p> * This can be used to require that KeyStore entries be stored encrypted. |