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
diff --git a/keystore/java/android/security/keystore/KeyProperties.java b/keystore/java/android/security/keystore/KeyProperties.java
index 8c42547..7f936f2 100644
--- a/keystore/java/android/security/keystore/KeyProperties.java
+++ b/keystore/java/android/security/keystore/KeyProperties.java
@@ -22,7 +22,6 @@
 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 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 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;