From a835ed2df620e0349c731facb613d27e4f4f38e4 Mon Sep 17 00:00:00 2001 From: Quang Luong Date: Tue, 17 Dec 2019 17:48:36 -0800 Subject: 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 --- .../src/com/android/wifitrackerlib/StandardWifiEntry.java | 7 ++++--- .../src/com/android/wifitrackerlib/WifiEntry.java | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'libs') 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 { 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); + } + } } -- cgit v1.2.3