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

Commit d443fb1d authored by Pedro Loureiro's avatar Pedro Loureiro
Browse files

Add lint baseline to address NewApi errors

We are enabling a new lint check where the min sdk != compile sdk.
It has produced a lot of errors and adding the baseline file(s)
allows us to continue work without introducing more problems.

Bug: 150847901

Test: m lint-check
Change-Id: I1d1db259c95d73522a90658b08b96e9d2e9910c6
Merged-In: I1d1db259c95d73522a90658b08b96e9d2e9910c6
parent 0be71aff
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -114,6 +114,9 @@ java_library {
    ],
    sdk_version: "system_30",
    visibility: ["//visibility:private"],
    lint: {
        baseline_filename: "lint-baseline-api-30-shims.xml",
    },
}

// Shims for APIs being added to the current development version of Android. These APIs are not
@@ -217,6 +220,9 @@ android_library {
        "//packages/modules/NetworkStack/tests/unit",
        "//packages/modules/NetworkStack/tests/integration",
    ],
    lint: {
        baseline_filename: "lint-baseline-current-lib.xml",
    },
}

android_library {
@@ -235,6 +241,9 @@ android_library {
        "//packages/modules/NetworkStack/tests/unit",
        "//packages/modules/NetworkStack/tests/integration",
    ],
    lint: {
        baseline_filename: "lint-baseline-stable-lib.xml",
    },
}

filegroup {
+37 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getNat64Prefix`"
        errorLine1="        return lp.getNat64Prefix();"
        errorLine2="                  ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/apishim/30/com/android/networkstack/apishim/api30/NetworkInformationShimImpl.java"
            line="85"
            column="19"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#setNat64Prefix`"
        errorLine1="        lp.setNat64Prefix(prefix);"
        errorLine2="           ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/apishim/30/com/android/networkstack/apishim/api30/NetworkInformationShimImpl.java"
            line="90"
            column="12"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#setDhcpServerAddress`"
        errorLine1="        lp.setDhcpServerAddress(serverAddress);"
        errorLine2="           ~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/apishim/30/com/android/networkstack/apishim/api30/NetworkInformationShimImpl.java"
            line="109"
            column="12"/>
    </issue>

</issues>
+202 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1032"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1034"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1087"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1089"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#any`"
        errorLine1="        final boolean haveKeepaliveResponses = CollectionUtils.any(mKeepalivePackets,"
        errorLine2="                                                               ~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1368"
            column="64"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#toIntArray`"
        errorLine1="                    CollectionUtils.toIntArray(mDnsReturnCode),"
        errorLine2="                                    ~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/DataStallDetectionStats.java"
            line="302"
            column="37"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#toLongArray`"
        errorLine1="                    CollectionUtils.toLongArray(mDnsTimeStamp),"
        errorLine2="                                    ~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/DataStallDetectionStats.java"
            line="303"
            column="37"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getNat64Prefix`"
        errorLine1="        newLp.setNat64Prefix(netlinkLinkProperties.getNat64Prefix());"
        errorLine2="                                                   ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/ip/IpClient.java"
            line="1337"
            column="52"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#setNat64Prefix`"
        errorLine1="        newLp.setNat64Prefix(netlinkLinkProperties.getNat64Prefix());"
        errorLine2="              ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/ip/IpClient.java"
            line="1337"
            column="15"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="            mStatsBuilder.setIpv4LatencyMicros(ConnectivityUtils.saturatedCast(mIpv4Watch.stop()));"
        errorLine2="                                                                 ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/IpProvisioningMetrics.java"
            line="74"
            column="66"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="            mStatsBuilder.setIpv6LatencyMicros(ConnectivityUtils.saturatedCast(mIpv6Watch.stop()));"
        errorLine2="                                                                 ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/IpProvisioningMetrics.java"
            line="83"
            column="66"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#isEmpty`"
        errorLine1="        if (isEmpty(mCaptivePortalFallbackSpecs)) {"
        errorLine2="            ~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java"
            line="2279"
            column="13"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#isIPv6ULA`"
        errorLine1="                    || isIPv6ULA(address)) {"
        errorLine2="                       ~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java"
            line="2447"
            column="24"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.telephony.NetworkRegistrationInfo#getCellIdentity`"
        errorLine1="                    nri == null ? null : nri.getCellIdentity());"
        errorLine2="                                             ~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java"
            line="3088"
            column="46"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="        int latencyUs = ConnectivityUtils.saturatedCast(durationUs);"
        errorLine2="                                          ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="198"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="                .setRemainingTtlSecs(ConnectivityUtils.saturatedCast(secondsRemaining))"
        errorLine2="                                                       ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="209"
            column="56"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="                        ConnectivityUtils.saturatedCast(capportData.getByteLimit() / 1000))"
        errorLine2="                                          ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="212"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="        mStatsBuilder.setLatencyMicros(ConnectivityUtils.saturatedCast(mWatch.stop()));"
        errorLine2="                                                         ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="237"
            column="58"/>
    </issue>

</issues>
+202 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1032"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1034"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1087"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#addressAndPortToString`"
        errorLine1="                        ConnectivityUtils.addressAndPortToString("
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1089"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#any`"
        errorLine1="        final boolean haveKeepaliveResponses = CollectionUtils.any(mKeepalivePackets,"
        errorLine2="                                                               ~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/apf/ApfFilter.java"
            line="1368"
            column="64"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#toIntArray`"
        errorLine1="                    CollectionUtils.toIntArray(mDnsReturnCode),"
        errorLine2="                                    ~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/DataStallDetectionStats.java"
            line="302"
            column="37"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#toLongArray`"
        errorLine1="                    CollectionUtils.toLongArray(mDnsTimeStamp),"
        errorLine2="                                    ~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/DataStallDetectionStats.java"
            line="303"
            column="37"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getNat64Prefix`"
        errorLine1="        newLp.setNat64Prefix(netlinkLinkProperties.getNat64Prefix());"
        errorLine2="                                                   ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/ip/IpClient.java"
            line="1337"
            column="52"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#setNat64Prefix`"
        errorLine1="        newLp.setNat64Prefix(netlinkLinkProperties.getNat64Prefix());"
        errorLine2="              ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/android/net/ip/IpClient.java"
            line="1337"
            column="15"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="            mStatsBuilder.setIpv4LatencyMicros(ConnectivityUtils.saturatedCast(mIpv4Watch.stop()));"
        errorLine2="                                                                 ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/IpProvisioningMetrics.java"
            line="74"
            column="66"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="            mStatsBuilder.setIpv6LatencyMicros(ConnectivityUtils.saturatedCast(mIpv6Watch.stop()));"
        errorLine2="                                                                 ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/IpProvisioningMetrics.java"
            line="83"
            column="66"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.CollectionUtils#isEmpty`"
        errorLine1="        if (isEmpty(mCaptivePortalFallbackSpecs)) {"
        errorLine2="            ~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java"
            line="2279"
            column="13"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#isIPv6ULA`"
        errorLine1="                    || isIPv6ULA(address)) {"
        errorLine2="                       ~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java"
            line="2447"
            column="24"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.telephony.NetworkRegistrationInfo#getCellIdentity`"
        errorLine1="                    nri == null ? null : nri.getCellIdentity());"
        errorLine2="                                             ~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java"
            line="3088"
            column="46"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="        int latencyUs = ConnectivityUtils.saturatedCast(durationUs);"
        errorLine2="                                          ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="198"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="                .setRemainingTtlSecs(ConnectivityUtils.saturatedCast(secondsRemaining))"
        errorLine2="                                                       ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="209"
            column="56"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="                        ConnectivityUtils.saturatedCast(capportData.getByteLimit() / 1000))"
        errorLine2="                                          ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="212"
            column="43"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 31 (current min is 29): `com.android.net.module.util.ConnectivityUtils#saturatedCast`"
        errorLine1="        mStatsBuilder.setLatencyMicros(ConnectivityUtils.saturatedCast(mWatch.stop()));"
        errorLine2="                                                         ~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkValidationMetrics.java"
            line="237"
            column="58"/>
    </issue>

</issues>
+59 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getDhcpServerAddress`"
        errorLine1="        assertEquals(SERVER_ADDR, captor.getValue().getDhcpServerAddress());"
        errorLine2="                                                    ~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java"
            line="1327"
            column="53"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getNat64Prefix`"
        errorLine1="                argThat(lp -> Objects.equals(expected, lp.getNat64Prefix())));"
        errorLine2="                                                          ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java"
            line="1623"
            column="59"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getNat64Prefix`"
        errorLine1="                lp -> !Objects.equals(unchanged, lp.getNat64Prefix())));"
        errorLine2="                                                    ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java"
            line="1629"
            column="53"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getNat64Prefix`"
        errorLine1="        if (lp.getNat64Prefix() != null) {"
        errorLine2="               ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java"
            line="1660"
            column="16"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level R (current min is 29): `android.net.LinkProperties#getNat64Prefix`"
        errorLine1="            assertEquals(prefix, lp.getNat64Prefix());"
        errorLine2="                                    ~~~~~~~~~~~~~~">
        <location
            file="packages/modules/NetworkStack/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java"
            line="1661"
            column="37"/>
    </issue>

</issues>
Loading