summaryrefslogtreecommitdiff
path: root/keystore
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2024-04-25 19:06:30 +0000
committerEric Biggers <ebiggers@google.com>2024-04-25 20:03:09 +0000
commit94e596ec9c09779ad8911baf76834bb8c8445878 (patch)
treefb5d49013f486f167181882c150a6a8c634cdd66 /keystore
parent548ee3851e394f9eeac1f105904cba9f2a6f2d10 (diff)
downloadbase-94e596ec9c09779ad8911baf76834bb8c8445878.tar.gz
Copy KeyStore.UID_SELF to KeyProperties.UID_SELF
To make it possible to remove the obsolete and misleadingly named helper class android.security.KeyStore, the UID_SELF constant will be moved to KeyProperties. This CL completes the first half of the move by adding the constant to the new location. A later CL will delete the constant from the old location once all users have been updated. Bug: 326508120 Test: build Flag: NONE mechanical refactoring with no behavior change Change-Id: I5aa839a19d548d9d5a86afc30ab39431c0b93aa5
Diffstat (limited to 'keystore')
-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;