summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/VelocityBasedConnectedScoreTest.java12
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java16
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiLinkLayerStatsTest.java34
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java44
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java74
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WificondControlTest.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProvisionerTest.java2
10 files changed, 100 insertions, 98 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index 6f59ac264..b59ee2a2a 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -2203,7 +2203,7 @@ public class ClientModeImplTest extends WifiBaseTest {
wifiInfo = mCmi.getWifiInfo();
assertNull(wifiInfo.getBSSID());
- assertEquals(WifiSsid.NONE, wifiInfo.getSSID());
+ assertEquals(WifiManager.UNKNOWN_SSID, wifiInfo.getSSID());
assertEquals(WifiConfiguration.INVALID_NETWORK_ID, wifiInfo.getNetworkId());
assertEquals(SupplicantState.DISCONNECTED, wifiInfo.getSupplicantState());
}
@@ -3767,7 +3767,7 @@ public class ClientModeImplTest extends WifiBaseTest {
assertTrue(mCmi.getWifiInfo().isEphemeral());
assertTrue(mCmi.getWifiInfo().isTrusted());
assertEquals(OP_PACKAGE_NAME,
- mCmi.getWifiInfo().getNetworkSuggestionOrSpecifierPackageName());
+ mCmi.getWifiInfo().getAppPackageName());
}
/**
@@ -3784,7 +3784,7 @@ public class ClientModeImplTest extends WifiBaseTest {
assertTrue(mCmi.getWifiInfo().isEphemeral());
assertTrue(mCmi.getWifiInfo().isTrusted());
assertEquals(OP_PACKAGE_NAME,
- mCmi.getWifiInfo().getNetworkSuggestionOrSpecifierPackageName());
+ mCmi.getWifiInfo().getAppPackageName());
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/VelocityBasedConnectedScoreTest.java b/tests/wifitests/src/com/android/server/wifi/VelocityBasedConnectedScoreTest.java
index ae8c8c0d5..214e80947 100644
--- a/tests/wifitests/src/com/android/server/wifi/VelocityBasedConnectedScoreTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/VelocityBasedConnectedScoreTest.java
@@ -114,9 +114,9 @@ public class VelocityBasedConnectedScoreTest extends WifiBaseTest {
public void allowLowRssiIfErrorRateIsLowAndSomeDataIsMoving() throws Exception {
mWifiInfo.setRssi(mRssiExitThreshold2GHz - 2);
mWifiInfo.setLinkSpeed(6); // Mbps
- mWifiInfo.txSuccessRate = 2.1; // proportional to pps
- mWifiInfo.txBadRate = .5;
- mWifiInfo.rxSuccessRate = 2.1;
+ mWifiInfo.setTxSuccessRate(2.1); // proportional to pps
+ mWifiInfo.setTxBadRate(.5);
+ mWifiInfo.setRxSuccessRate(2.1);
for (int i = 0; i < 10; i++) {
mVelocityBasedConnectedScore.updateUsingWifiInfo(mWifiInfo,
mClock.getWallClockMillis());
@@ -140,9 +140,9 @@ public class VelocityBasedConnectedScoreTest extends WifiBaseTest {
public void disallowLowRssiIfDataIsNotMoving() throws Exception {
mWifiInfo.setRssi(mRssiExitThreshold2GHz - 1);
mWifiInfo.setLinkSpeed(6); // Mbps
- mWifiInfo.txSuccessRate = .1; // proportional to pps
- mWifiInfo.txBadRate = 0;
- mWifiInfo.rxSuccessRate = .1;
+ mWifiInfo.setTxSuccessRate(.1); // proportional to pps
+ mWifiInfo.setTxBadRate(0);
+ mWifiInfo.setRxSuccessRate(.1);
for (int i = 0; i < 10; i++) {
mVelocityBasedConnectedScore.updateUsingWifiInfo(mWifiInfo,
mClock.getWallClockMillis());
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
index e77cce9cb..be78461ee 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
@@ -1029,8 +1029,8 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
*/
@Test
public void checkSingleScanSettingsWhenConnectedWithLowDataRate() {
- mWifiInfo.txSuccessRate = 0;
- mWifiInfo.rxSuccessRate = 0;
+ mWifiInfo.setTxSuccessRate(0);
+ mWifiInfo.setRxSuccessRate(0);
final HashSet<Integer> channelList = new HashSet<>();
channelList.add(1);
@@ -1069,8 +1069,8 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
*/
@Test
public void checkPartialScanRequestedWithHighDataRateWithoutFwRoaming() {
- mWifiInfo.txSuccessRate = mFullScanMaxTxPacketRate * 2;
- mWifiInfo.rxSuccessRate = mFullScanMaxRxPacketRate * 2;
+ mWifiInfo.setTxSuccessRate(mFullScanMaxTxPacketRate * 2);
+ mWifiInfo.setRxSuccessRate(mFullScanMaxRxPacketRate * 2);
final HashSet<Integer> channelList = new HashSet<>();
channelList.add(1);
@@ -1114,8 +1114,8 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
*/
@Test
public void checkPartialScanSkippedWithHighDataRateWithFwRoaming() {
- mWifiInfo.txSuccessRate = mFullScanMaxTxPacketRate * 2;
- mWifiInfo.rxSuccessRate = mFullScanMaxRxPacketRate * 2;
+ mWifiInfo.setTxSuccessRate(mFullScanMaxTxPacketRate * 2);
+ mWifiInfo.setRxSuccessRate(mFullScanMaxRxPacketRate * 2);
long currentTimeStamp = CURRENT_SYSTEM_TIME_MS;
when(mClock.getElapsedSinceBootMillis()).thenReturn(currentTimeStamp);
@@ -1158,8 +1158,8 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
*/
@Test
public void checkSingleScanSettingsWhenConnectedWithHighDataRateNotInCache() {
- mWifiInfo.txSuccessRate = mFullScanMaxTxPacketRate * 2;
- mWifiInfo.rxSuccessRate = mFullScanMaxRxPacketRate * 2;
+ mWifiInfo.setTxSuccessRate(mFullScanMaxTxPacketRate * 2);
+ mWifiInfo.setRxSuccessRate(mFullScanMaxRxPacketRate * 2);
final HashSet<Integer> channelList = new HashSet<>();
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiLinkLayerStatsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiLinkLayerStatsTest.java
index d551680e4..2d6bb5a3c 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiLinkLayerStatsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiLinkLayerStatsTest.java
@@ -100,10 +100,10 @@ public class WifiLinkLayerStatsTest extends WifiBaseTest {
mWifiInfo.updatePacketRates(mWifiLinkLayerStats, mWifiLinkLayerStats.timeStampInMs);
}
// assertEquals(double, double, double) takes a tolerance as the third argument
- assertEquals((double) txg, mWifiInfo.txSuccessRate, txg * 0.02);
- assertEquals((double) txr, mWifiInfo.txRetriesRate, txr * 0.02);
- assertEquals((double) txb, mWifiInfo.txBadRate, txb * 0.02);
- assertEquals((double) rxg, mWifiInfo.rxSuccessRate, rxg * 0.02);
+ assertEquals((double) txg, mWifiInfo.getTxSuccessRate(), txg * 0.02);
+ assertEquals((double) txr, mWifiInfo.getTxRetriesRate(), txr * 0.02);
+ assertEquals((double) txb, mWifiInfo.getTxBadRate(), txb * 0.02);
+ assertEquals((double) rxg, mWifiInfo.getRxSuccessRate(), rxg * 0.02);
assertEquals(mWifiInfo.txSuccess, n * txg);
assertEquals(mWifiInfo.txRetries, n * txr);
@@ -119,11 +119,11 @@ public class WifiLinkLayerStatsTest extends WifiBaseTest {
bumpCounters(mWifiLinkLayerStats, 999999999, 999999999, 999999999, 99999999);
mWifiLinkLayerStats.timeStampInMs = 999999999;
mWifiInfo.updatePacketRates(mWifiLinkLayerStats, mWifiLinkLayerStats.timeStampInMs);
- assertEquals(0.0, mWifiInfo.txSuccessRate, 0.0001);
+ assertEquals(0.0, mWifiInfo.getTxSuccessRate(), 0.0001);
bumpCounters(mWifiLinkLayerStats, 1, 1, 1, 1);
mWifiLinkLayerStats.timeStampInMs += 1;
mWifiInfo.updatePacketRates(mWifiLinkLayerStats, mWifiLinkLayerStats.timeStampInMs);
- assertEquals(0.33, mWifiInfo.txSuccessRate, 0.01);
+ assertEquals(0.33, mWifiInfo.getTxSuccessRate(), 0.01);
}
/**
@@ -135,33 +135,35 @@ public class WifiLinkLayerStatsTest extends WifiBaseTest {
bumpCounters(mWifiLinkLayerStats, 999, 999, 999, 999);
mWifiLinkLayerStats.timeStampInMs = 999999999;
mWifiInfo.updatePacketRates(mWifiLinkLayerStats, mWifiLinkLayerStats.timeStampInMs);
- assertEquals(0.0, mWifiInfo.txSuccessRate, 0.0001);
- assertEquals(0.0, mWifiInfo.rxSuccessRate, 0.0001);
+ assertEquals(0.0, mWifiInfo.getTxSuccessRate(), 0.0001);
+ assertEquals(0.0, mWifiInfo.getRxSuccessRate(), 0.0001);
bumpCounters(mWifiLinkLayerStats, 1_000_000_000, 777000, 66600, 1_000_100_000);
mWifiLinkLayerStats.timeStampInMs += 10_000;
mWifiInfo.updatePacketRates(mWifiLinkLayerStats, mWifiLinkLayerStats.timeStampInMs);
- assertTrue("" + mWifiInfo + " " + mWifiLinkLayerStats, mWifiInfo.txSuccessRate > 0.95e+8);
- assertTrue("" + mWifiInfo + " " + mWifiLinkLayerStats, mWifiInfo.rxSuccessRate > 0.95e+8);
+ assertTrue("" + mWifiInfo + " " + mWifiLinkLayerStats,
+ mWifiInfo.getTxSuccessRate() > 0.95e+8);
+ assertTrue("" + mWifiInfo + " " + mWifiLinkLayerStats,
+ mWifiInfo.getRxSuccessRate() > 0.95e+8);
// Now update with traffic counters
mWifiLinkLayerStats.timeStampInMs += 10_000;
mWifiInfo.updatePacketRates(2_000_000_000L, 2_000_000_000L,
mWifiLinkLayerStats.timeStampInMs);
// Despite the increase, the rates should be zero after the change in source
- assertEquals(0.0, mWifiInfo.txSuccessRate, 0.0001);
- assertEquals(0.0, mWifiInfo.rxSuccessRate, 0.0001);
+ assertEquals(0.0, mWifiInfo.getTxSuccessRate(), 0.0001);
+ assertEquals(0.0, mWifiInfo.getRxSuccessRate(), 0.0001);
assertEquals(0, mWifiInfo.txBad);
assertEquals(0, mWifiInfo.txRetries);
// Make sure that updates from this source work, too
mWifiLinkLayerStats.timeStampInMs += 10_000;
mWifiInfo.updatePacketRates(3_000_000_000L, 3_000_000_000L,
mWifiLinkLayerStats.timeStampInMs);
- assertTrue(mWifiInfo.txSuccessRate > 0.95e+8);
- assertTrue(mWifiInfo.rxSuccessRate > 0.95e+8);
+ assertTrue(mWifiInfo.getTxSuccessRate() > 0.95e+8);
+ assertTrue(mWifiInfo.getRxSuccessRate() > 0.95e+8);
// Switch back to using link layer stats
mWifiLinkLayerStats.timeStampInMs += 10_000;
bumpCounters(mWifiLinkLayerStats, 1_000_000_000, 777000, 66600, 1_000_100_000);
mWifiInfo.updatePacketRates(mWifiLinkLayerStats, mWifiLinkLayerStats.timeStampInMs);
- assertEquals(0.0, mWifiInfo.txSuccessRate, 0.0001);
- assertEquals(0.0, mWifiInfo.rxSuccessRate, 0.0001);
+ assertEquals(0.0, mWifiInfo.getTxSuccessRate(), 0.0001);
+ assertEquals(0.0, mWifiInfo.getRxSuccessRate(), 0.0001);
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
index d9abbed12..77d4cdeb7 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
@@ -848,8 +848,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi2G + 1);
// No streaming traffic.
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = 0.0;
+ mWifiInfo.setTxSuccessRate(0.0);
+ mWifiInfo.setRxSuccessRate(0.0);
// Do not perform selection on 2GHz if current network is good and no 5GHz available
testStayOrTryToSwitch(
@@ -875,8 +875,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi2G + 1);
// No streaming traffic.
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = 0.0;
+ mWifiInfo.setTxSuccessRate(0.0);
+ mWifiInfo.setRxSuccessRate(0.0);
// When on 2GHz, even with "good" signal strength, run selection if 5GHz available
testStayOrTryToSwitch(
@@ -905,8 +905,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi5G - 1);
// No streaming traffic.
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = 0.0;
+ mWifiInfo.setTxSuccessRate(0.0);
+ mWifiInfo.setRxSuccessRate(0.0);
// Run Selection when the current 5Ghz network has low RSSI.
testStayOrTryToSwitch(
@@ -930,8 +930,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi5G + 1);
// No streaming traffic.
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = 0.0;
+ mWifiInfo.setTxSuccessRate(0.0);
+ mWifiInfo.setRxSuccessRate(0.0);
// Connected to a high quality 5Ghz network, so the other result is irrelevant
testStayOrTryToSwitch(
@@ -954,8 +954,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi2G + 1);
// No streaming traffic.
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = 0.0;
+ mWifiInfo.setTxSuccessRate(0.0);
+ mWifiInfo.setRxSuccessRate(0.0);
testStayOrTryToSwitch(
// Parameters for network1:
@@ -987,8 +987,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi2G + 1);
// No streaming traffic.
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = 0.0;
+ mWifiInfo.setTxSuccessRate(0.0);
+ mWifiInfo.setRxSuccessRate(0.0);
testStayOrTryToSwitch(
// Parameters for network1:
@@ -1015,8 +1015,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi2G - 1);
// No streaming traffic.
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = 0.0;
+ mWifiInfo.setTxSuccessRate(0.0);
+ mWifiInfo.setRxSuccessRate(0.0);
testStayOrTryToSwitch(
mThresholdQualifiedRssi2G + 1 /* rssi before connected */,
@@ -1037,8 +1037,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi2G + 1);
// Streaming traffic
- mWifiInfo.txSuccessRate = ((double) (mStayOnNetworkMinimumTxRate + 1));
- mWifiInfo.rxSuccessRate = 0.0;
+ when(mWifiInfo.getTxSuccessRate()).thenReturn(mStayOnNetworkMinimumTxRate + 1.0);
+ when(mWifiInfo.getRxSuccessRate()).thenReturn(0.0);
testStayOrTryToSwitch(
mThresholdQualifiedRssi2G + 1 /* rssi before connected */,
@@ -1059,8 +1059,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi2G + 1);
// Streaming traffic
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = ((double) (mStayOnNetworkMinimumRxRate + 1));
+ when(mWifiInfo.getTxSuccessRate()).thenReturn(0.0);
+ when(mWifiInfo.getRxSuccessRate()).thenReturn(mStayOnNetworkMinimumRxRate + 1.0);
testStayOrTryToSwitch(
mThresholdQualifiedRssi2G + 1 /* rssi before connected */,
@@ -1081,8 +1081,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi5G + 1);
// Streaming traffic
- mWifiInfo.txSuccessRate = ((double) (mStayOnNetworkMinimumTxRate + 1));
- mWifiInfo.rxSuccessRate = 0.0;
+ when(mWifiInfo.getTxSuccessRate()).thenReturn(mStayOnNetworkMinimumTxRate + 1.0);
+ when(mWifiInfo.getRxSuccessRate()).thenReturn(0.0);
testStayOrTryToSwitch(
mThresholdQualifiedRssi5G + 1 /* rssi before connected */,
@@ -1103,8 +1103,8 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
// Rssi after connected.
when(mWifiInfo.getRssi()).thenReturn(mThresholdQualifiedRssi5G + 1);
// Streaming traffic
- mWifiInfo.txSuccessRate = 0.0;
- mWifiInfo.rxSuccessRate = ((double) (mStayOnNetworkMinimumRxRate + 1));
+ when(mWifiInfo.getTxSuccessRate()).thenReturn(0.0);
+ when(mWifiInfo.getRxSuccessRate()).thenReturn(mStayOnNetworkMinimumRxRate + 1.0);
testStayOrTryToSwitch(
mThresholdQualifiedRssi5G + 1 /* rssi before connected */,
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
index f80201bac..c85b9f49c 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
@@ -190,12 +190,12 @@ public class WifiScoreReportTest extends WifiBaseTest {
public void allowLowRssiIfDataIsMoving() throws Exception {
mWifiInfo.setRssi(-80);
mWifiInfo.setLinkSpeed(6); // Mbps
- mWifiInfo.txSuccessRate = 5.1; // proportional to pps
- mWifiInfo.rxSuccessRate = 5.1;
+ mWifiInfo.setTxSuccessRate(5.1); // proportional to pps
+ mWifiInfo.setRxSuccessRate(5.1);
for (int i = 0; i < 10; i++) {
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
}
- int score = mWifiInfo.score;
+ int score = mWifiInfo.getScore();
assertTrue(score > ConnectedScore.WIFI_TRANSITION_SCORE);
}
@@ -213,12 +213,12 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiInfo.setLinkSpeed(6); // Mbps
mWifiInfo.setFrequency(5220);
mWifiScoreReport.enableVerboseLogging(true);
- mWifiInfo.txSuccessRate = 0.1;
- mWifiInfo.rxSuccessRate = 0.1;
+ mWifiInfo.setTxSuccessRate(0.1);
+ mWifiInfo.setRxSuccessRate(0.1);
for (int i = 0; i < 10; i++) {
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
}
- int score = mWifiInfo.score;
+ int score = mWifiInfo.getScore();
assertTrue(score < ConnectedScore.WIFI_TRANSITION_SCORE);
verify(mNetworkAgent, atLeast(1)).sendNetworkScore(score);
}
@@ -234,9 +234,9 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiInfo.setRssi(rssi);
oops += " " + mClock.mWallClockMillis + "," + rssi;
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
- oops += ":" + mWifiInfo.score;
+ oops += ":" + mWifiInfo.getScore();
}
- int score = mWifiInfo.score;
+ int score = mWifiInfo.getScore();
verify(mNetworkAgent, atLeast(1)).sendNetworkScore(score);
assertTrue(oops, score < ConnectedScore.WIFI_TRANSITION_SCORE);
}
@@ -253,16 +253,16 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiInfo.setLinkSpeed(6); // Mbps
mWifiInfo.setFrequency(5220);
mWifiScoreReport.enableVerboseLogging(true);
- mWifiInfo.txSuccessRate = 0.1;
- mWifiInfo.rxSuccessRate = 0.1;
+ mWifiInfo.setTxSuccessRate(0.1);
+ mWifiInfo.setRxSuccessRate(0.1);
assertTrue(mScoringParams.update("rssi5=-83:-80:-66:-55"));
for (int r = -30; r >= -100; r -= 1) {
int rssi = Math.max(r, -80);
mWifiInfo.setRssi(rssi);
oops += " " + mClock.mWallClockMillis + "," + rssi;
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
- oops += ":" + mWifiInfo.score;
- if (mWifiInfo.score < minScore) minScore = mWifiInfo.score;
+ oops += ":" + mWifiInfo.getScore();
+ if (mWifiInfo.getScore() < minScore) minScore = mWifiInfo.getScore();
}
assertTrue(oops, minScore > ConnectedScore.WIFI_TRANSITION_SCORE);
}
@@ -276,24 +276,24 @@ public class WifiScoreReportTest extends WifiBaseTest {
*/
@Test
public void allowTerribleRssiIfDataIsMovingWell() throws Exception {
- mWifiInfo.txSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1;
- mWifiInfo.rxSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1;
- assertTrue(mWifiInfo.txSuccessRate > 10);
+ mWifiInfo.setTxSuccessRate(mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1);
+ mWifiInfo.setRxSuccessRate(mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1);
+ assertTrue(mWifiInfo.getTxSuccessRate() > 10);
mWifiInfo.setFrequency(5220);
for (int r = -30; r >= -120; r -= 2) {
mWifiInfo.setRssi(r);
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
- assertTrue(mWifiInfo.score > ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() > ConnectedScore.WIFI_TRANSITION_SCORE);
}
// If the throughput dips, we should let go
- mWifiInfo.rxSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() - 0.1;
+ mWifiInfo.setRxSuccessRate(mScoringParams.getYippeeSkippyPacketsPerSecond() - 0.1);
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
- assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() < ConnectedScore.WIFI_TRANSITION_SCORE);
// And even if throughput improves again, once we have decided to let go, disregard
// the good rates.
- mWifiInfo.rxSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1;
+ mWifiInfo.setRxSuccessRate(mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1);
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
- assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() < ConnectedScore.WIFI_TRANSITION_SCORE);
}
/**
@@ -327,10 +327,10 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
boolean ask = mWifiScoreReport.shouldCheckIpLayer();
if (ask) {
- assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() < ConnectedScore.WIFI_TRANSITION_SCORE);
assertTrue(oops, mClock.mWallClockMillis >= lastAskedMillis + 5000);
lastAskedMillis = mClock.mWallClockMillis;
- oops += " " + lastAskedMillis + ":" + mWifiInfo.score;
+ oops += " " + lastAskedMillis + ":" + mWifiInfo.getScore();
mWifiScoreReport.noteIpCheck();
asks++;
}
@@ -355,10 +355,10 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
boolean ask = mWifiScoreReport.shouldCheckIpLayer();
if (ask) {
- assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() < ConnectedScore.WIFI_TRANSITION_SCORE);
assertTrue(oops, mClock.mWallClockMillis >= lastAskedMillis + 5000);
lastAskedMillis = mClock.mWallClockMillis;
- oops += " " + lastAskedMillis + ":" + mWifiInfo.score;
+ oops += " " + lastAskedMillis + ":" + mWifiInfo.getScore();
mWifiScoreReport.noteIpCheck();
asks++;
}
@@ -400,10 +400,10 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiInfo.setRssi(-65 + i);
mWifiInfo.setLinkSpeed(300);
mWifiInfo.setFrequency(5220);
- mWifiInfo.txSuccessRate = 0.1 + i;
- mWifiInfo.txRetriesRate = 0.2 + i;
- mWifiInfo.txBadRate = 0.01 * i;
- mWifiInfo.rxSuccessRate = 0.3 + i;
+ mWifiInfo.setTxSuccessRate(0.1 + i);
+ mWifiInfo.setTxRetriesRate(0.2 + i);
+ mWifiInfo.setTxBadRate(0.01 * i);
+ mWifiInfo.setRxSuccessRate(0.3 + i);
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
}
setupToGenerateAReportWhenPrintlnIsCalled();
@@ -422,10 +422,10 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiInfo.setRssi(-65 + i % 20);
mWifiInfo.setLinkSpeed(300);
mWifiInfo.setFrequency(5220);
- mWifiInfo.txSuccessRate = 0.1 + i % 100;
- mWifiInfo.txRetriesRate = 0.2 + i % 100;
- mWifiInfo.txBadRate = 0.0001 * i;
- mWifiInfo.rxSuccessRate = 0.3 + i % 200;
+ mWifiInfo.setTxSuccessRate(0.1 + i % 100);
+ mWifiInfo.setTxRetriesRate(0.2 + i % 100);
+ mWifiInfo.setTxBadRate(0.0001 * i);
+ mWifiInfo.setRxSuccessRate(0.3 + i % 200);
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
}
mWifiScoreReport.dump(null, mPrintWriter, null);
@@ -445,7 +445,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiInfo.setRssi(rssi);
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
}
- assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() < ConnectedScore.WIFI_TRANSITION_SCORE);
// Then, set high RSSI value to exceed the transition score
mWifiInfo.setRssi(-50);
@@ -453,11 +453,11 @@ public class WifiScoreReportTest extends WifiBaseTest {
for (int i = 0; i < 8; i++) {
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
}
- assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() < ConnectedScore.WIFI_TRANSITION_SCORE);
// 9 seconds elapse
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
- assertTrue(mWifiInfo.score > ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() > ConnectedScore.WIFI_TRANSITION_SCORE);
}
/**
@@ -474,13 +474,13 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiInfo.setRssi(rssi);
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
}
- assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() < ConnectedScore.WIFI_TRANSITION_SCORE);
// Then, set high RSSI value to exceed the transition score
mWifiInfo.setRssi(-50);
// Reset the internal timer so that no need to wait for 9 seconds
mWifiScoreReport.reset();
mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
- assertTrue(mWifiInfo.score > ConnectedScore.WIFI_TRANSITION_SCORE);
+ assertTrue(mWifiInfo.getScore() > ConnectedScore.WIFI_TRANSITION_SCORE);
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index 782a8db57..9224d69b5 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -1251,7 +1251,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
WifiInfo connectionInfo = mWifiServiceImpl.getConnectionInfo(TEST_PACKAGE, TEST_FEATURE_ID);
- assertEquals(WifiSsid.NONE, connectionInfo.getSSID());
+ assertEquals(WifiManager.UNKNOWN_SSID, connectionInfo.getSSID());
assertEquals(WifiInfo.DEFAULT_MAC_ADDRESS, connectionInfo.getBSSID());
assertEquals(WifiConfiguration.INVALID_NETWORK_ID, connectionInfo.getNetworkId());
}
@@ -1269,7 +1269,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
WifiInfo connectionInfo = mWifiServiceImpl.getConnectionInfo(TEST_PACKAGE, TEST_FEATURE_ID);
- assertEquals(WifiSsid.NONE, connectionInfo.getSSID());
+ assertEquals(WifiManager.UNKNOWN_SSID, connectionInfo.getSSID());
assertEquals(WifiInfo.DEFAULT_MAC_ADDRESS, connectionInfo.getBSSID());
assertEquals(WifiConfiguration.INVALID_NETWORK_ID, connectionInfo.getNetworkId());
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
index dadab98d6..5af9b6918 100644
--- a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
@@ -629,7 +629,7 @@ public class WificondControlTest extends WifiBaseTest {
/**
* Verifies that scan result's carrier network info {@link ScanResult#isCarrierAp} and
- * {@link ScanResult#getCarrierApEapType} is set appropriated based on the carrier network
+ * {@link ScanResult#carrierApEapType} is set appropriated based on the carrier network
* config.
*
* @throws Exception
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
index ccfb1f0d1..58c84af1c 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
@@ -1217,7 +1217,7 @@ public class PasspointManagerTest extends WifiBaseTest {
friendlyNames.forEach(e -> friendlyNameMap.put(e.getLanguage(), e.getText()));
expectedOsuProvidersForDomainId.add(new OsuProvider(
- null, friendlyNameMap, serviceDescription,
+ (WifiSsid) null, friendlyNameMap, serviceDescription,
serverUri, nai, methodList, null));
// add All OSU Providers for AP1.
@@ -1229,7 +1229,7 @@ public class PasspointManagerTest extends WifiBaseTest {
providerInfoListOfAp2.add(new OsuProviderInfo(
friendlyNames, serverUri, methodList, null, nai, serviceDescriptions));
expectedOsuProvidersForDomainId2.add(new OsuProvider(
- null, friendlyNameMap, serviceDescription,
+ (WifiSsid) null, friendlyNameMap, serviceDescription,
serverUri, nai, methodList,
null));
}
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProvisionerTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProvisionerTest.java
index e101aa9b0..e7bc1950f 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProvisionerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProvisionerTest.java
@@ -509,7 +509,7 @@ public class PasspointProvisionerTest extends WifiBaseTest {
}
}).when(mPasspointManager).getANQPElements(any(ScanResult.class));
OsuProviderInfo info = OsuProviderInfoTestUtil.TEST_OSU_PROVIDER_INFO;
- mOsuProvider = new OsuProvider(null, info.getFriendlyNames(),
+ mOsuProvider = new OsuProvider((WifiSsid) null, info.getFriendlyNames(),
info.getServiceDescription(),
info.getServerUri(),
info.getNetworkAccessIdentifier(), info.getMethodList(), null);