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

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

Snap for 6392433 from 69edac38 to sc-release

Change-Id: Iaad27b38d368f92ae70a4467c0c8653b345b07c6
parents a0d09f73 69edac38
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.networkstack.apishim.api29;

import android.net.IpPrefix;
import android.net.LinkProperties;
import android.net.NetworkCapabilities;
import android.net.Uri;
@@ -74,6 +75,18 @@ public class NetworkInformationShimImpl implements NetworkInformationShim {
        return null;
    }

    @Nullable
    @Override
    public IpPrefix getNat64Prefix(@NonNull LinkProperties lp) {
        // Not supported on this API level
        return null;
    }

    @Override
    public void setNat64Prefix(@NonNull LinkProperties lp, @Nullable IpPrefix prefix) {
        // Not supported on this API level: no-op
    }

    @Nullable
    @Override
    public String getSsid(@Nullable NetworkCapabilities nc) {
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.networkstack.apishim;

import android.net.IpPrefix;
import android.net.LinkProperties;
import android.net.NetworkCapabilities;
import android.net.Uri;
@@ -71,6 +72,17 @@ public class NetworkInformationShimImpl extends
        return new CaptivePortalDataShimImpl(lp.getCaptivePortalData());
    }

    @Nullable
    @Override
    public IpPrefix getNat64Prefix(@NonNull LinkProperties lp) {
        return lp.getNat64Prefix();
    }

    @Override
    public void setNat64Prefix(@NonNull LinkProperties lp, @Nullable IpPrefix prefix) {
        lp.setNat64Prefix(prefix);
    }

    @Nullable
    @Override
    public String getSsid(@Nullable NetworkCapabilities nc) {
+13 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.networkstack.apishim;

import android.net.IpPrefix;
import android.net.LinkProperties;
import android.net.NetworkCapabilities;
import android.net.Uri;
@@ -47,6 +48,17 @@ public interface NetworkInformationShim {
    @Nullable
    CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp);

    /**
     * @see LinkProperties#getNat64Prefix()
     */
    @Nullable
    IpPrefix getNat64Prefix(@NonNull LinkProperties lp);

    /**
     * @see LinkProperties#setNat64Prefix()
     */
    void setNat64Prefix(@NonNull LinkProperties lp, @Nullable IpPrefix prefix);

    /**
     * @see NetworkCapabilities#getSSID()
     */
@@ -62,8 +74,6 @@ public interface NetworkInformationShim {
    /**
     * @see LinkProperties#setDhcpServerAddress()
     */
    @NonNull
    void setDhcpServerAddress(@NonNull LinkProperties lp,
            @NonNull Inet4Address serverAddress);
    void setDhcpServerAddress(@NonNull LinkProperties lp, @NonNull Inet4Address serverAddress);

}
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ java_library {
        "androidx.annotation_annotation",
    ],
    static_libs: [
        "androidx.test.ext.junit",
        "net-tests-utils-multivariant",
    ],
}
+21 −10
Original line number Diff line number Diff line
@@ -22,6 +22,23 @@ import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement

/**
 * Returns true if the development SDK version of the device is in the provided range.
 *
 * If the device is not using a release SDK, the development SDK is considered to be higher than
 * [Build.VERSION.SDK_INT].
 */
fun isDevSdkInRange(minExclusive: Int?, maxInclusive: Int?): Boolean {
    // In-development API n+1 will have SDK_INT == n and CODENAME != REL.
    // Stable API n has SDK_INT == n and CODENAME == REL.
    val release = "REL" == Build.VERSION.CODENAME
    val sdkInt = Build.VERSION.SDK_INT
    val devApiLevel = sdkInt + if (release) 0 else 1

    return (minExclusive == null || devApiLevel > minExclusive) &&
            (maxInclusive == null || devApiLevel <= maxInclusive)
}

/**
 * A test rule to ignore tests based on the development SDK level.
 *
@@ -63,16 +80,10 @@ class DevSdkIgnoreRule @JvmOverloads constructor(
            val ignoreAfter = description.getAnnotation(IgnoreAfter::class.java)
            val ignoreUpTo = description.getAnnotation(IgnoreUpTo::class.java)

            // In-development API n+1 will have SDK_INT == n and CODENAME != REL.
            // Stable API n has SDK_INT == n and CODENAME == REL.
            val release = "REL" == Build.VERSION.CODENAME
            val sdkInt = Build.VERSION.SDK_INT
            val devApiLevel = sdkInt + if (release) 0 else 1
            val message = "Skipping test for ${if (!release) "non-" else ""}release SDK $sdkInt"
            assumeTrue(message, ignoreClassAfter == null || devApiLevel <= ignoreClassAfter)
            assumeTrue(message, ignoreClassUpTo == null || devApiLevel > ignoreClassUpTo)
            assumeTrue(message, ignoreAfter == null || devApiLevel <= ignoreAfter.value)
            assumeTrue(message, ignoreUpTo == null || devApiLevel > ignoreUpTo.value)
            val message = "Skipping test for build ${Build.VERSION.CODENAME} " +
                    "with SDK ${Build.VERSION.SDK_INT}"
            assumeTrue(message, isDevSdkInRange(ignoreClassUpTo, ignoreClassAfter))
            assumeTrue(message, isDevSdkInRange(ignoreUpTo?.value, ignoreAfter?.value))
            base.evaluate()
        }
    }
Loading