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

Commit 7f0ce628 authored by Pavel Maltsev's avatar Pavel Maltsev Committed by android-build-merger
Browse files

Merge "Fixing comments in Network Capabilities" am: e58f15fd

am: 9b3c003c

Change-Id: If3c0d76f9598d931d801271c4d0634e15f4b9ed4
parents f93ad220 9b3c003c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -382,7 +382,7 @@ public final class NetworkCapabilities implements Parcelable {
    /**
     * Removes (if found) the given capability from this {@code NetworkCapability} instance.
     * <p>
     * Note that this method removes capabilities that was added via {@link #addCapability(int)},
     * Note that this method removes capabilities that were added via {@link #addCapability(int)},
     * {@link #addUnwantedCapability(int)} or {@link #setCapabilities(int[], int[])} .
     *
     * @param capability the capability to be removed.
@@ -471,6 +471,7 @@ public final class NetworkCapabilities implements Parcelable {
                && ((mUnwantedNetworkCapabilities & (1 << capability)) != 0);
    }

    /** Note this method may result in having the same capability in wanted and unwanted lists. */
    private void combineNetCapabilities(NetworkCapabilities nc) {
        this.mNetworkCapabilities |= nc.mNetworkCapabilities;
        this.mUnwantedNetworkCapabilities |= nc.mUnwantedNetworkCapabilities;
@@ -1132,7 +1133,11 @@ public final class NetworkCapabilities implements Parcelable {
    }

    /**
     * Combine a set of Capabilities to this one.  Useful for coming up with the complete set
     * Combine a set of Capabilities to this one.  Useful for coming up with the complete set.
     * <p>
     * Note that this method may break an invariant of having a particular capability in either
     * wanted or unwanted lists but never in both.  Requests that have the same capability in
     * both lists will never be satisfied.
     * @hide
     */
    public void combineCapabilities(NetworkCapabilities nc) {
+1 −2
Original line number Diff line number Diff line
@@ -282,7 +282,7 @@ public class NetworkCapabilitiesTest {
        assertTrue("Request: " + request + ", Network:" + network,
                request.satisfiedByNetworkCapabilities(network));

        // Adding capabilities that doesn't exist in the network anyway
        // Requesting absence of capabilities that network doesn't have. Request should satisfy.
        request.addUnwantedCapability(NET_CAPABILITY_WIFI_P2P);
        request.addUnwantedCapability(NET_CAPABILITY_NOT_METERED);
        assertTrue(request.satisfiedByNetworkCapabilities(network));
@@ -297,7 +297,6 @@ public class NetworkCapabilitiesTest {
        assertTrue(request.hasUnwantedCapability(NET_CAPABILITY_NOT_RESTRICTED));
        assertFalse(request.hasCapability(NET_CAPABILITY_NOT_RESTRICTED));


        // Now this request won't be satisfied because network contains NOT_RESTRICTED.
        assertFalse(request.satisfiedByNetworkCapabilities(network));
        network.removeCapability(NET_CAPABILITY_NOT_RESTRICTED);