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

Commit 23288421 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6436511 from 0dd17262 to sc-release

Change-Id: I3a8ca364b2c6442595d21cd31a17adae909d8bd9
parents dfb9302a 0dd17262
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -42,4 +42,11 @@ public final class ShimUtils {
                + ("REL".equals(Build.VERSION.CODENAME) ? 0 : 1);
        return devApiLevel > apiLevel;
    }

    /**
     * Check whether the device supports in-development or final R networking APIs.
     */
    public static boolean isAtLeastR() {
        return isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q);
    }
}
+6 −4
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.net.util;

import static com.android.internal.util.Preconditions.checkArgument;

import android.net.MacAddress;
import android.text.TextUtils;

@@ -66,8 +64,12 @@ public class InterfaceParams {
    }

    public InterfaceParams(String name, int index, MacAddress macAddr, int defaultMtu) {
        checkArgument((!TextUtils.isEmpty(name)), "impossible interface name");
        checkArgument((index > 0), "invalid interface index");
        if (TextUtils.isEmpty(name)) {
            throw new IllegalArgumentException("impossible interface name");
        }

        if (index <= 0) throw new IllegalArgumentException("invalid interface index");

        this.name = name;
        this.index = index;
        this.hasMacAddress = (macAddr != null);
+15 −14
Original line number Diff line number Diff line
@@ -74,7 +74,6 @@ import com.android.internal.util.HexDump;
import com.android.internal.util.IState;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.MessageUtils;
import com.android.internal.util.Preconditions;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
import com.android.internal.util.WakeupMessage;
@@ -549,8 +548,8 @@ public class IpClient extends StateMachine {
            NetworkObserverRegistry observerRegistry, NetworkStackServiceManager nssManager,
            Dependencies deps) {
        super(IpClient.class.getSimpleName() + "." + ifName);
        Preconditions.checkNotNull(ifName);
        Preconditions.checkNotNull(callback);
        Objects.requireNonNull(ifName);
        Objects.requireNonNull(callback);

        mTag = getName();

@@ -1699,25 +1698,27 @@ public class IpClient extends StateMachine {
    class ClearingIpAddressesState extends State {
        @Override
        public void enter() {
            if (readyToProceed()) {
                deferMessage(obtainMessage(CMD_ADDRESSES_CLEARED));
            } else {
                // Clear all IPv4 and IPv6 before proceeding to RunningState.
                // Clean up any leftover state from an abnormal exit from
                // tethering or during an IpClient restart.
                stopAllIP();
            }

            // Ensure that interface parameters are fetched on the handler thread so they are
            // properly ordered with other events, such as restoring the interface MTU on teardown.
            mInterfaceParams = mDependencies.getInterfaceParams(mInterfaceName);
            if (mInterfaceParams == null) {
                logError("Failed to find InterfaceParams for " + mInterfaceName);
                doImmediateProvisioningFailure(IpManagerEvent.ERROR_INTERFACE_NOT_FOUND);
                transitionTo(mStoppedState);
                deferMessage(obtainMessage(CMD_STOP));
                return;
            }

            mLinkObserver.setInterfaceParams(mInterfaceParams);

            if (readyToProceed()) {
                deferMessage(obtainMessage(CMD_ADDRESSES_CLEARED));
            } else {
                // Clear all IPv4 and IPv6 before proceeding to RunningState.
                // Clean up any leftover state from an abnormal exit from
                // tethering or during an IpClient restart.
                stopAllIP();
            }

            mCallback.setNeighborDiscoveryOffload(true);
        }

@@ -1752,7 +1753,7 @@ public class IpClient extends StateMachine {
        }

        private boolean readyToProceed() {
            return (!mLinkProperties.hasIpv4Address() && !mLinkProperties.hasGlobalIpv6Address());
            return !mLinkProperties.hasIpv4Address() && !mLinkProperties.hasGlobalIpv6Address();
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -653,7 +653,7 @@ public class IpClientIntegrationTest {
    }

    private void assertNoHostname(String hostname) {
        if (ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) {
        if (ShimUtils.isAtLeastR()) {
            assertNull(hostname);
        } else {
            // Until Q, if no hostname is set, the device falls back to the hostname set via
@@ -1815,7 +1815,7 @@ public class IpClientIntegrationTest {

        // Ensure that the URL was set as expected in the callbacks.
        // Can't verify the URL up to Q as there is no such attribute in LinkProperties.
        if (!ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) return;
        if (!ShimUtils.isAtLeastR()) return;
        verify(mCb).onLinkPropertiesChange(captor.capture());
        assertTrue(captor.getAllValues().stream().anyMatch(
                lp -> Objects.equals(expectedUrl, lp.getCaptivePortalApiUrl())));
+2 −3
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.app.Instrumentation;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.netlink.StructNlMsgHdr;
import android.os.Build;
import android.os.Process;
import android.system.Os;

@@ -196,7 +195,7 @@ public class InetDiagSocketTest {
    @Test
    public void testGetConnectionOwnerUid() throws Exception {
        // Skip the test for API <= Q, as b/141603906 this was only fixed in Q-QPR2
        assumeTrue(ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q));
        assumeTrue(ShimUtils.isAtLeastR());
        checkGetConnectionOwnerUid("::", null);
        checkGetConnectionOwnerUid("::", "::");
        checkGetConnectionOwnerUid("0.0.0.0", null);
@@ -211,7 +210,7 @@ public class InetDiagSocketTest {
    @Test
    public void testB141603906() throws Exception {
        // Skip the test for API <= Q, as b/141603906 this was only fixed in Q-QPR2
        assumeTrue(ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q));
        assumeTrue(ShimUtils.isAtLeastR());
        final InetSocketAddress src = new InetSocketAddress(0);
        final InetSocketAddress dst = new InetSocketAddress(0);
        final int numThreads = 8;
Loading