summaryrefslogtreecommitdiff
path: root/keystore/java/android/security/AndroidKeyStoreMaintenance.java
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2021-03-23 20:33:04 +0000
committerScott Lobdell <slobdell@google.com>2021-03-24 02:40:01 +0000
commit757dbb836469bbdd7eb8312deaf584fe0c99c17d (patch)
treea678b33ad5f0f024d0f942f127b91665f0616193 /keystore/java/android/security/AndroidKeyStoreMaintenance.java
parent7710a95746be8dba8c6ffe7172f9c01334a2ca81 (diff)
parentf022dd1e6827ebf7c52b06aa40f2059a3f0f5cad (diff)
Merge SP1A.210311.001
Change-Id: Id1a205bf3f0609c0b13e4bea377056c3b06299fa
Diffstat (limited to 'keystore/java/android/security/AndroidKeyStoreMaintenance.java')
-rw-r--r--keystore/java/android/security/AndroidKeyStoreMaintenance.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/keystore/java/android/security/AndroidKeyStoreMaintenance.java b/keystore/java/android/security/AndroidKeyStoreMaintenance.java
index c81c8c54d88a..ed789f03f9ba 100644
--- a/keystore/java/android/security/AndroidKeyStoreMaintenance.java
+++ b/keystore/java/android/security/AndroidKeyStoreMaintenance.java
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.security.usermanager.IKeystoreUserManager;
+import android.system.keystore2.Domain;
import android.system.keystore2.ResponseCode;
import android.util.Log;
@@ -39,7 +40,7 @@ public class AndroidKeyStoreMaintenance {
}
/**
- * Informs keystore2 about adding a user
+ * Informs Keystore 2.0 about adding a user
*
* @param userId - Android user id of the user being added
* @return 0 if successful or a {@code ResponseCode}
@@ -60,7 +61,7 @@ public class AndroidKeyStoreMaintenance {
}
/**
- * Informs keystore2 about removing a usergit mer
+ * Informs Keystore 2.0 about removing a usergit mer
*
* @param userId - Android user id of the user being removed
* @return 0 if successful or a {@code ResponseCode}
@@ -81,7 +82,7 @@ public class AndroidKeyStoreMaintenance {
}
/**
- * Informs keystore2 about changing user's password
+ * Informs Keystore 2.0 about changing user's password
*
* @param userId - Android user id of the user
* @param password - a secret derived from the synthetic password provided by the
@@ -102,4 +103,22 @@ public class AndroidKeyStoreMaintenance {
return SYSTEM_ERROR;
}
}
+
+ /**
+ * Informs Keystore 2.0 that an app was uninstalled and the corresponding namspace is to
+ * be cleared.
+ */
+ public static int clearNamespace(@Domain int domain, long namespace) {
+ if (!android.security.keystore2.AndroidKeyStoreProvider.isInstalled()) return 0;
+ try {
+ getService().clearNamespace(domain, namespace);
+ return 0;
+ } catch (ServiceSpecificException e) {
+ Log.e(TAG, "clearNamespace failed", e);
+ return e.errorCode;
+ } catch (Exception e) {
+ Log.e(TAG, "Can not connect to keystore", e);
+ return SYSTEM_ERROR;
+ }
+ }
}