Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a6a5e77 authored by Chiachang Wang's avatar Chiachang Wang Committed by Automerger Merge Worker
Browse files

Merge "Make getUid a method on UserHandle itself instead of static" am:...

Merge "Make getUid a method on UserHandle itself instead of static" am: bd1cc4f2 am: 6b7167e8 am: 155b0961

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669185

Change-Id: Ic0b7887630c00404ff354c193b82a96930940556
parents e5c8cea5 155b0961
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8558,7 +8558,7 @@ package android.os {
    method @NonNull public static String formatUid(int);
    method public static int getAppId(int);
    method public int getIdentifier();
    method public static int getUid(@NonNull android.os.UserHandle, int);
    method public int getUid(int);
    method @Deprecated public boolean isOwner();
    method public boolean isSystem();
    method public static int myUserId();
+4 −5
Original line number Diff line number Diff line
@@ -326,16 +326,15 @@ public final class UserHandle implements Parcelable {
    }

    /**
     * Returns the uid that is composed from the userHandle and the appId.
     * Returns the uid representing the given appId for this UserHandle.
     *
     * @param userHandle the UserHandle to compose the uid
     * @param appId the AppId to compose the uid
     * @return the uid that is composed from the userHandle and the appId
     * @return the uid representing the given appId for this UserHandle
     * @hide
     */
    @SystemApi
    public static int getUid(@NonNull UserHandle userHandle, @AppIdInt int appId) {
        return getUid(userHandle.getIdentifier(), appId);
    public int getUid(@AppIdInt int appId) {
        return getUid(getIdentifier(), appId);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ public final class UidRange implements Parcelable {
    /** Creates a UidRange for the specified user. */
    public static UidRange createForUser(UserHandle user) {
        final UserHandle nextUser = UserHandle.of(user.getIdentifier() + 1);
        final int start = UserHandle.getUid(user, 0 /* appId */);
        final int end = UserHandle.getUid(nextUser, 0) - 1;
        final int start = user.getUid(0 /* appId */);
        final int end = nextUser.getUid(0 /* appId */) - 1;
        return new UidRange(start, end);
    }

+1 −1
Original line number Diff line number Diff line
@@ -9910,7 +9910,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
                    }
                    for (final UserHandle ui : users) {
                        // Add the rules for all users as this policy is device wide.
                        uids.get(pref).add(UserHandle.getUid(ui, uid));
                        uids.get(pref).add(ui.getUid(uid));
                    }
                } catch (PackageManager.NameNotFoundException e) {
                    // Although this may seem like an error scenario, it is ok that uninstalled
+2 −2
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public class PermissionMonitor {
            for (UserHandle user : users) {
                if (user == null) continue;

                list.add(UserHandle.getUid(user, app.getKey()));
                list.add(user.getUid(app.getKey()));
            }
        }
        try {
@@ -555,7 +555,7 @@ public class PermissionMonitor {
                    final UserHandle handle = UserHandle.of(userId);
                    if (handle == null) continue;

                    final int uid = UserHandle.getUid(handle, appId);
                    final int uid = handle.getUid(appId);
                    if (range.contains(uid)) {
                        result.add(uid);
                    }
Loading