summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorQuang Luong <qal@google.com>2019-12-17 17:48:36 -0800
committerQuang Luong <qal@google.com>2019-12-17 17:48:36 -0800
commita835ed2df620e0349c731facb613d27e4f4f38e4 (patch)
tree7c9a63fa936a154023c4dcf2bb966dad45762890 /libs
parentd173148e2fc5ff8991394b120fde013cdcfcabe8 (diff)
Implement StandardWifiEntry.forget()
Implement StandardWifiEntry.forget() API to make call to WifiManager.forget() for the corresponding net id. Test: manual Bug: 70983952 Change-Id: I6455bb07c587d17573d6479e0f3049e5edd39698
Diffstat (limited to 'libs')
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java7
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java12
2 files changed, 16 insertions, 3 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
index 74f4bdccc..39c946cd8 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
@@ -234,13 +234,14 @@ class StandardWifiEntry extends WifiEntry {
@Override
public boolean canForget() {
- // TODO(b/70983952): Fill this method in
- return false;
+ return isSaved();
}
@Override
public void forget() {
- // TODO(b/70983952): Fill this method in
+ if (mWifiConfig != null) {
+ mWifiManager.forget(mWifiConfig.networkId, new ForgetListener());
+ }
}
public boolean canSignIn() {
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
index 29823b430..1631d14e7 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
@@ -508,4 +508,16 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
notifyOnConnectResult(WifiEntryCallback.CONNECT_STATUS_FAILURE_UNKNOWN);
}
}
+
+ class ForgetListener implements WifiManager.ActionListener {
+ @Override
+ public void onSuccess() {
+ notifyOnForgetResult(WifiEntryCallback.FORGET_STATUS_SUCCESS);
+ }
+
+ @Override
+ public void onFailure(int i) {
+ notifyOnForgetResult(WifiEntryCallback.FORGET_STATUS_FAILURE_UNKNOWN);
+ }
+ }
}