From 5b205ac7658ec00c538fe8a2a3a08a4c62db791a Mon Sep 17 00:00:00 2001 From: Quang Luong Date: Mon, 15 Jun 2020 18:14:14 -0700 Subject: [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 --- .../com/android/wifitrackerlib/OsuWifiEntry.java | 15 ----------- .../android/wifitrackerlib/PasspointWifiEntry.java | 15 ----------- .../android/wifitrackerlib/StandardWifiEntry.java | 20 -------------- .../src/com/android/wifitrackerlib/WifiEntry.java | 14 ---------- .../StandardNetworkDetailsTrackerTest.java | 31 ---------------------- .../wifitrackerlib/WifiPickerTrackerTest.java | 2 +- 6 files changed, 1 insertion(+), 96 deletions(-) (limited to 'libs') 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 @@ -197,21 +197,6 @@ class OsuWifiEntry extends WifiEntry { return false; } - @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() { 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 @@ -392,21 +392,6 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry return false; } - @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() { 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; } @@ -497,23 +495,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() { @@ -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 { @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 { 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 { } } - // 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; @@ -104,36 +103,6 @@ public class StandardNetworkDetailsTrackerTest { .thenReturn(mMockNetworkScoreManager); } - /** - * 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. */ 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); -- cgit v1.2.3