From b32aae2a46bc3678e11c7f0ca88e01a192829490 Mon Sep 17 00:00:00 2001 From: Tucker Sylvestro Date: Thu, 23 Jun 2016 17:23:33 -0400 Subject: [PATCH] Add the onDeviceOffBody API method to KeyStore This is necessary for allowing the KeyStore to lock keys that remain authorized as long as the device is on-body. Bug 28911985 Change-Id: If50bc84d5a1cb23f9b01b1950c3676d1519cc4f5 --- core/java/android/security/IKeystoreService.aidl | 1 + keystore/java/android/security/KeyStore.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/core/java/android/security/IKeystoreService.aidl b/core/java/android/security/IKeystoreService.aidl index 8689dce3fef55..641e1ada6eaa2 100644 --- a/core/java/android/security/IKeystoreService.aidl +++ b/core/java/android/security/IKeystoreService.aidl @@ -76,4 +76,5 @@ interface IKeystoreService { int onUserAdded(int userId, int parentId); int onUserRemoved(int userId); int attestKey(String alias, in KeymasterArguments params, out KeymasterCertificateChain chain); + int onDeviceOffBody(); } diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java index 70e4b6ff2e590..00d786a93626d 100644 --- a/keystore/java/android/security/KeyStore.java +++ b/keystore/java/android/security/KeyStore.java @@ -626,6 +626,16 @@ public class KeyStore { } } + /** + * Notify keystore that the device went off-body. + */ + public void onDeviceOffBody() { + try { + mBinder.onDeviceOffBody(); + } catch (RemoteException e) { + Log.w(TAG, "Cannot connect to keystore", e); + } + } /** * Returns a {@link KeyStoreException} corresponding to the provided keystore/keymaster error