summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuang Luong <qal@google.com>2020-06-15 18:14:14 -0700
committerQuang Luong <qal@google.com>2020-06-16 14:10:15 -0700
commit5b205ac7658ec00c538fe8a2a3a08a4c62db791a (patch)
tree0abb3fbcc5298a7fcf7e72cfa3869e87c0127a76
parentec47b27101cda0b02d5d337f54fc1189739145c9 (diff)
[WifiTrackerLib] Cleanup obsolete methods and TODOs
Remove unused/obsolete methods and TODO comments that are no longer applicable. Bug: 159074196 Test: atest WifiTrackerLibTests Change-Id: I884b4beea8b6a8f58fe726a5998b8e261b0e48ab
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java15
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java15
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java20
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java14
-rw-r--r--libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/StandardNetworkDetailsTrackerTest.java31
-rw-r--r--libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/WifiPickerTrackerTest.java2
6 files changed, 1 insertions, 96 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java
index c6cd574d0..dbf146909 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java
@@ -198,21 +198,6 @@ class OsuWifiEntry extends WifiEntry {
}
@Override
- public String getQrCodeString() {
- return null;
- }
-
- @Override
- public boolean canSetPassword() {
- return false;
- }
-
- @Override
- public void setPassword(@NonNull String password) {
- // Do nothing.
- }
-
- @Override
@MeteredChoice
public int getMeteredChoice() {
// Metered choice is meaningless for OSU entries
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
index 2c0134d5a..3e8db7fcf 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
@@ -393,21 +393,6 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry
}
@Override
- public String getQrCodeString() {
- return null;
- }
-
- @Override
- public boolean canSetPassword() {
- return false;
- }
-
- @Override
- public void setPassword(@NonNull String password) {
- // Do nothing.
- }
-
- @Override
@MeteredChoice
public int getMeteredChoice() {
if (mMeteredOverride == WifiConfiguration.METERED_OVERRIDE_METERED) {
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
index 2a3a71cb3..19c2619bc 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
@@ -161,7 +161,6 @@ public class StandardWifiEntry extends WifiEntry {
@NonNull String key, @NonNull WifiManager wifiManager,
@NonNull WifiNetworkScoreCache scoreCache,
boolean forSavedNetworksPage) {
- // TODO: second argument (isSaved = false) is bogus in this context
super(callbackHandler, wifiManager, scoreCache, forSavedNetworksPage);
mContext = context;
@@ -305,7 +304,6 @@ public class StandardWifiEntry extends WifiEntry {
@Override
@Security
public int getSecurity() {
- // TODO(b/70983952): Fill this method in
return mSecurity;
}
@@ -498,23 +496,6 @@ public class StandardWifiEntry extends WifiEntry {
}
@Override
- public String getQrCodeString() {
- // TODO(b/70983952): Fill this method in
- return null;
- }
-
- @Override
- public boolean canSetPassword() {
- // TODO(b/70983952): Fill this method in
- return false;
- }
-
- @Override
- public void setPassword(@NonNull String password) {
- // TODO(b/70983952): Fill this method in
- }
-
- @Override
@MeteredChoice
public int getMeteredChoice() {
if (getWifiConfiguration() != null) {
@@ -904,7 +885,6 @@ public class StandardWifiEntry extends WifiEntry {
}
description.append("=").append(scanResult.frequency);
description.append(",").append(scanResult.level);
- // TODO(b/70983952): Append speed of the ScanResult here.
final int ageSeconds = (int) (nowMs - scanResult.timestamp / 1000) / 1000;
description.append(",").append(ageSeconds).append("s");
description.append("}");
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
index e800e4832..c7dc5c4da 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
@@ -304,12 +304,6 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
@Security
public abstract int getSecurity();
- /** Returns the string representation of the security of the WifiEntry. */
- public String getSecurityString() {
- // TODO (b/70983952) Implement this
- return null;
- }
-
/** Returns the MAC address of the connection */
public abstract String getMacAddress();
@@ -393,16 +387,9 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
public abstract boolean canShare();
/** Returns whether the user can use Easy Connect to onboard a device to the network */
public abstract boolean canEasyConnect();
- /** Returns the QR code string for the network */
- public abstract String getQrCodeString();
// Modifiable settings
- /** Returns whether the entry should show a password input */
- public abstract boolean canSetPassword();
- /** Sets the user's password to a network */
- public abstract void setPassword(@NonNull String password);
-
/**
* Returns the user's choice whether to treat a network as metered,
* defined by the METERED_CHOICE constants
@@ -770,7 +757,6 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
}
}
- // TODO (b/70983952) Come up with a sorting scheme that does the right thing.
@Override
public int compareTo(@NonNull WifiEntry other) {
if (getLevel() != WIFI_LEVEL_UNREACHABLE && other.getLevel() == WIFI_LEVEL_UNREACHABLE) {
diff --git a/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/StandardNetworkDetailsTrackerTest.java b/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/StandardNetworkDetailsTrackerTest.java
index a7aa20a6b..964a900ca 100644
--- a/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/StandardNetworkDetailsTrackerTest.java
+++ b/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/StandardNetworkDetailsTrackerTest.java
@@ -23,7 +23,6 @@ import static com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_UNREACHABLE;
import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -105,36 +104,6 @@ public class StandardNetworkDetailsTrackerTest {
}
/**
- * Tests that a key without the correct prefix throws an error in the constructor.
- */
- @Test
- public void testConstructor_malformedPrefix_throwsError() {
- final String key = "IncorrectPrefix:ssid,0";
- try {
- final StandardNetworkDetailsTracker tracker =
- createTestStandardNetworkDetailsTracker(key);
- fail("Incorrect prefix in key argument should throw an error!");
- } catch (IllegalArgumentException e) {
- // Test Succeeded
- }
- }
-
- /**
- * Tests that a key without a security type throws an error in the constructor.
- */
- @Test
- public void testConstructor_malformedSecurity_throwsError() {
- final String key = StandardWifiEntry.KEY_PREFIX + "ssid";
- try {
- final StandardNetworkDetailsTracker tracker =
- createTestStandardNetworkDetailsTracker(key);
- fail("Incorrect security type in key argument should throw an error!");
- } catch (IllegalArgumentException e) {
- // Test Succeeded
- }
- }
-
- /**
* Tests that the key of the created WifiEntry matches the key passed into the constructor.
*/
@Test
diff --git a/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/WifiPickerTrackerTest.java b/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/WifiPickerTrackerTest.java
index f59e34499..feec984bf 100644
--- a/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/WifiPickerTrackerTest.java
+++ b/libs/WifiTrackerLib/tests/src/com/android/wifitrackerlib/WifiPickerTrackerTest.java
@@ -115,7 +115,7 @@ public class WifiPickerTrackerTest {
when(mMockWifiManager.getScanResults()).thenReturn(new ArrayList<>());
when(mMockWifiManager.getConnectionInfo()).thenReturn(mMockWifiInfo);
- when(mMockConnectivityManager.getActiveNetworkInfo()).thenReturn(mMockNetworkInfo);
+ when(mMockConnectivityManager.getNetworkInfo(any())).thenReturn(mMockNetworkInfo);
when(mMockClock.millis()).thenReturn(START_MILLIS);
when(mMockWifiInfo.getNetworkId()).thenReturn(WifiConfiguration.INVALID_NETWORK_ID);
when(mMockWifiInfo.getRssi()).thenReturn(WifiInfo.INVALID_RSSI);