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

Commit 919385b5 authored by Cody Kesting's avatar Cody Kesting
Browse files

Clean up handling of NetworkCapabilities#administratorUids.

Update ConnectivityService's check for administrator UIDs to use
ArrayUtils to check for UID inclusion. Update the NetworkCapabilities
annotation on the administrator UIDs field to clarify that it is
NonNull.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
Merged-In: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
(cherry picked from commit 89849636)
parent da502403
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -920,7 +920,7 @@ public final class NetworkCapabilities implements Parcelable {
     * empty unless the destination is 1) the System Server, or 2) Telephony. In either case, the
     * receiving entity must have the ACCESS_FINE_LOCATION permission and target R+.
     */
    private int[] mAdministratorUids = new int[0];
    @NonNull private int[] mAdministratorUids = new int[0];

    /**
     * Sets the int[] of UIDs that are administrators of this network.
+1 −5
Original line number Diff line number Diff line
@@ -7992,11 +7992,7 @@ public class ConnectivityService extends IConnectivityManager.Stub

        // Administrator UIDs also contains the Owner UID
        final int[] administratorUids = nai.networkCapabilities.getAdministratorUids();
        for (final int uid : administratorUids) {
            if (uid == callbackUid) return true;
        }

        return false;
        return ArrayUtils.contains(administratorUids, callbackUid);
    }

    @Override