Loading apishim/common/com/android/networkstack/apishim/common/ShimUtils.java +7 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,11 @@ public final class ShimUtils { public static boolean isAtLeastR() { return isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q); } /** * Check whether the device supports in-development or final S networking APIs. */ public static boolean isAtLeastS() { return isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.R); } } src/android/net/ip/IpClient.java +9 −1 Original line number Diff line number Diff line Loading @@ -1602,8 +1602,16 @@ public class IpClient extends StateMachine { mL2Key = info.l2Key; mCluster = info.cluster; // Sometimes the wifi code passes in a null BSSID. Don't use Log.wtf in R because // it's a known bug that will not be fixed in R. if (info.bssid == null || mCurrentBssid == null) { Log.wtf(mTag, "bssid in the parcelable or current tracked bssid should be non-null"); final String msg = "bssid in the parcelable: " + info.bssid + " or " + "current tracked bssid: " + mCurrentBssid + " is null"; if (ShimUtils.isAtLeastS()) { Log.wtf(mTag, msg); } else { Log.w(mTag, msg); } return; } Loading tests/integration/src/android/net/ip/IpClientIntegrationTest.java +8 −1 Original line number Diff line number Diff line Loading @@ -2101,7 +2101,8 @@ public class IpClientIntegrationTest { private void doDhcpRoamingTest(final boolean hasMismatchedIpAddress, final String displayName, final String ssid, final String bssid, final boolean expectRoaming) throws Exception { long currentTime = System.currentTimeMillis(); final ScanResultInfo scanResultInfo = makeScanResultInfo(ssid, bssid); final ScanResultInfo scanResultInfo = (ssid == null || bssid == null) ? null : makeScanResultInfo(ssid, bssid); doAnswer(invocation -> { // we don't rely on the Init-Reboot state to renew previous cached IP lease. Loading Loading @@ -2175,6 +2176,12 @@ public class IpClientIntegrationTest { TEST_DHCP_ROAM_SSID, TEST_DHCP_ROAM_BSSID, false /* expectRoaming */); } @Test public void testDhcpRoaming_nullScanResultInfo() throws Exception { doDhcpRoamingTest(false /* hasMismatchedIpAddress */, "\"0001docomo\"" /* display name */, null /* SSID */, null /* BSSID */, false /* expectRoaming */); } @Test public void testDhcpRoaming_invalidSsid() throws Exception { doDhcpRoamingTest(false /* hasMismatchedIpAddress */, "\"0001docomo\"" /* display name */, Loading Loading
apishim/common/com/android/networkstack/apishim/common/ShimUtils.java +7 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,11 @@ public final class ShimUtils { public static boolean isAtLeastR() { return isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q); } /** * Check whether the device supports in-development or final S networking APIs. */ public static boolean isAtLeastS() { return isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.R); } }
src/android/net/ip/IpClient.java +9 −1 Original line number Diff line number Diff line Loading @@ -1602,8 +1602,16 @@ public class IpClient extends StateMachine { mL2Key = info.l2Key; mCluster = info.cluster; // Sometimes the wifi code passes in a null BSSID. Don't use Log.wtf in R because // it's a known bug that will not be fixed in R. if (info.bssid == null || mCurrentBssid == null) { Log.wtf(mTag, "bssid in the parcelable or current tracked bssid should be non-null"); final String msg = "bssid in the parcelable: " + info.bssid + " or " + "current tracked bssid: " + mCurrentBssid + " is null"; if (ShimUtils.isAtLeastS()) { Log.wtf(mTag, msg); } else { Log.w(mTag, msg); } return; } Loading
tests/integration/src/android/net/ip/IpClientIntegrationTest.java +8 −1 Original line number Diff line number Diff line Loading @@ -2101,7 +2101,8 @@ public class IpClientIntegrationTest { private void doDhcpRoamingTest(final boolean hasMismatchedIpAddress, final String displayName, final String ssid, final String bssid, final boolean expectRoaming) throws Exception { long currentTime = System.currentTimeMillis(); final ScanResultInfo scanResultInfo = makeScanResultInfo(ssid, bssid); final ScanResultInfo scanResultInfo = (ssid == null || bssid == null) ? null : makeScanResultInfo(ssid, bssid); doAnswer(invocation -> { // we don't rely on the Init-Reboot state to renew previous cached IP lease. Loading Loading @@ -2175,6 +2176,12 @@ public class IpClientIntegrationTest { TEST_DHCP_ROAM_SSID, TEST_DHCP_ROAM_BSSID, false /* expectRoaming */); } @Test public void testDhcpRoaming_nullScanResultInfo() throws Exception { doDhcpRoamingTest(false /* hasMismatchedIpAddress */, "\"0001docomo\"" /* display name */, null /* SSID */, null /* BSSID */, false /* expectRoaming */); } @Test public void testDhcpRoaming_invalidSsid() throws Exception { doDhcpRoamingTest(false /* hasMismatchedIpAddress */, "\"0001docomo\"" /* display name */, Loading