diff options
author | Robin Lee <rgl@google.com> | 2014-06-17 16:46:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-17 05:12:50 +0000 |
commit | b12f1778d612a53e6b40e6d5873be1ccff2e52a5 (patch) | |
tree | 9286a5eeb94eae55529fd0a7eb25b23ce8948622 /keystore | |
parent | ea54579b54687788c269b386c4bb802de5b87b1a (diff) | |
parent | 837304f6f6ae37dc475fa6e0e620f1c2321f2e11 (diff) | |
download | base-b12f1778d612a53e6b40e6d5873be1ccff2e52a5.tar.gz |
Merge "Publish DevicePolicyManager CA certificate APIs"
Diffstat (limited to 'keystore')
-rw-r--r-- | keystore/java/android/security/KeyChain.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java index 9d6d76e37118..0da2b9989444 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"); } |