summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2024-05-03 15:45:08 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-05-03 15:45:08 +0000
commit00305306aa9c13bd2ffea75e33597ba12370ff17 (patch)
treef1c01184676c74da815b839d38c043b35b561ec2
parent3f35361d1f843b545ef3bb84a1e40232d9263fb9 (diff)
parent94e596ec9c09779ad8911baf76834bb8c8445878 (diff)
downloadbase-00305306aa9c13bd2ffea75e33597ba12370ff17.tar.gz
Merge "Copy KeyStore.UID_SELF to KeyProperties.UID_SELF" into main
-rw-r--r--keystore/java/android/security/keystore/KeyProperties.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/keystore/java/android/security/keystore/KeyProperties.java b/keystore/java/android/security/keystore/KeyProperties.java
index 8c42547caea6..7f936f28ac4f 100644
--- a/keystore/java/android/security/keystore/KeyProperties.java
+++ b/keystore/java/android/security/keystore/KeyProperties.java
@@ -22,7 +22,6 @@ import android.annotation.Nullable;
import android.annotation.StringDef;
import android.annotation.SystemApi;
import android.os.Process;
-import android.security.KeyStore;
import android.security.keymaster.KeymasterDefs;
import libcore.util.EmptyArray;
@@ -1008,13 +1007,20 @@ public abstract class KeyProperties {
public static final int NAMESPACE_LOCKSETTINGS = 103;
/**
+ * The legacy UID that corresponds to {@link #NAMESPACE_APPLICATION}.
+ * In new code, prefer to work with Keystore namespaces directly.
+ * @hide
+ */
+ public static final int UID_SELF = -1;
+
+ /**
* For legacy support, translate namespaces into known UIDs.
* @hide
*/
public static int namespaceToLegacyUid(@Namespace int namespace) {
switch (namespace) {
case NAMESPACE_APPLICATION:
- return KeyStore.UID_SELF;
+ return UID_SELF;
case NAMESPACE_WIFI:
return Process.WIFI_UID;
default:
@@ -1029,7 +1035,7 @@ public abstract class KeyProperties {
*/
public static @Namespace int legacyUidToNamespace(int uid) {
switch (uid) {
- case KeyStore.UID_SELF:
+ case UID_SELF:
return NAMESPACE_APPLICATION;
case Process.WIFI_UID:
return NAMESPACE_WIFI;