diff options
author | Kenny Root <kroot@google.com> | 2013-03-29 11:14:17 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2013-03-29 11:16:43 -0700 |
commit | a738e2a1aee26e0be3944c11820724aeca313f83 (patch) | |
tree | f759843e6482eba4a964869e62a025f22756ed49 | |
parent | ce7f2723ad42f09fb173a9b86d3546e1474fd667 (diff) | |
download | frameworks_base-a738e2a1aee26e0be3944c11820724aeca313f83.zip frameworks_base-a738e2a1aee26e0be3944c11820724aeca313f83.tar.gz frameworks_base-a738e2a1aee26e0be3944c11820724aeca313f83.tar.bz2 |
KeyStore: add API to query storage type
Add an API to keystore daemon to query what kind of storage is currently
in use.
Change-Id: I5a83ae92250ca63b691dcf1beb8b3e1703797745
-rw-r--r-- | core/java/android/security/IKeystoreService.java | 20 | ||||
-rw-r--r-- | keystore/java/android/security/KeyStore.java | 9 |
2 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/security/IKeystoreService.java b/core/java/android/security/IKeystoreService.java index a890d9b..c365643 100644 --- a/core/java/android/security/IKeystoreService.java +++ b/core/java/android/security/IKeystoreService.java @@ -427,6 +427,23 @@ public interface IKeystoreService extends IInterface { } return _result; } + + @Override + public int is_hardware_backed() throws RemoteException { + Parcel _data = Parcel.obtain(); + Parcel _reply = Parcel.obtain(); + int _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + mRemote.transact(Stub.TRANSACTION_is_hardware_backed, _data, _reply, 0); + _reply.readException(); + _result = _reply.readInt(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } } private static final String DESCRIPTOR = "android.security.keystore"; @@ -452,6 +469,7 @@ public interface IKeystoreService extends IInterface { static final int TRANSACTION_ungrant = IBinder.FIRST_CALL_TRANSACTION + 18; static final int TRANSACTION_getmtime = IBinder.FIRST_CALL_TRANSACTION + 19; static final int TRANSACTION_duplicate = IBinder.FIRST_CALL_TRANSACTION + 20; + static final int TRANSACTION_is_hardware_backed = IBinder.FIRST_CALL_TRANSACTION + 21; /** * Cast an IBinder object into an IKeystoreService interface, generating @@ -539,4 +557,6 @@ public interface IKeystoreService extends IInterface { public int duplicate(String srcKey, int srcUid, String destKey, int destUid) throws RemoteException; + + public int is_hardware_backed() throws RemoteException; } diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java index 12c0ed8..2037472 100644 --- a/keystore/java/android/security/KeyStore.java +++ b/keystore/java/android/security/KeyStore.java @@ -296,6 +296,15 @@ public class KeyStore { } } + public boolean isHardwareBacked() { + try { + return mBinder.is_hardware_backed() == NO_ERROR; + } catch (RemoteException e) { + Log.w(TAG, "Cannot connect to keystore", e); + return false; + } + } + public int getLastError() { return mError; } |