summaryrefslogtreecommitdiffstats
path: root/keystore/java
diff options
context:
space:
mode:
authorRobin Lee <rgl@google.com>2014-06-19 14:06:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-06-17 21:55:55 +0000
commitaab72f3b0ab740e12b4a2576a99852081529feb5 (patch)
tree9e9d0c76701aa01e9eab8f07841c7a01ba4961a0 /keystore/java
parent54fb7e94d071cdaf13b944bca9fec441c376b16b (diff)
parent306fe08ce2b06671336e67a87afaa0851f0105eb (diff)
downloadframeworks_base-aab72f3b0ab740e12b4a2576a99852081529feb5.zip
frameworks_base-aab72f3b0ab740e12b4a2576a99852081529feb5.tar.gz
frameworks_base-aab72f3b0ab740e12b4a2576a99852081529feb5.tar.bz2
Merge "Revert "Revert "Publish DevicePolicyManager CA certificate APIs"""
Diffstat (limited to 'keystore/java')
-rw-r--r--keystore/java/android/security/KeyChain.java17
1 files changed, 14 insertions, 3 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");
}