From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
Date: Wed, 17 Aug 2022 10:12:42 +0300
Subject: [PATCH] mark UserHandle#get{Uid, UserId} as module SystemApi

Needed by packages_modules_Connectivity ->
"enforce INTERNET permission per-uid instead of per-appId".
---
 core/api/module-lib-current.txt      | 5 +++++
 core/java/android/os/UserHandle.java | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt
index b9522163b5d0..5e8bfd4dff61 100644
--- a/core/api/module-lib-current.txt
+++ b/core/api/module-lib-current.txt
@@ -392,6 +392,11 @@ package android.os {
     field public static final long TRACE_TAG_NETWORK = 2097152L; // 0x200000L
   }
 
+  public final class UserHandle implements android.os.Parcelable {
+    method public static int getUid(int, int);
+    method public static int getUserId(int);
+  }
+
 }
 
 package android.os.storage {
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 3d5abb3b8a2f..e6326bb0ad8b 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -275,6 +275,7 @@ public final class UserHandle implements Parcelable {
      * Returns the user id for a given uid.
      * @hide
      */
+    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
     @UnsupportedAppUsage
     @TestApi
     public static @UserIdInt int getUserId(int uid) {
@@ -365,6 +366,7 @@ public final class UserHandle implements Parcelable {
      * Returns the uid that is composed from the userId and the appId.
      * @hide
      */
+    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
     @UnsupportedAppUsage
     @TestApi
     public static int getUid(@UserIdInt int userId, @AppIdInt int appId) {
