summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-12-17 02:00:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-12-17 02:00:09 +0000
commit5389940a05a0989febd77f7f6d86caffc57e3535 (patch)
tree1933789b12f1131922dad2ad1edc839aa19f80b2
parent620c69fd1b95c702364a462f74ba6ce38c81843a (diff)
parent56193231e11dc363c240cf0382d1f996e066c87b (diff)
Merge "Add overlooked WifiEntry APIs"
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java34
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java45
2 files changed, 76 insertions, 3 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
index 50d4158fc..74f4bdccc 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
@@ -161,6 +161,12 @@ class StandardWifiEntry extends WifiEntry {
}
@Override
+ public String getMacAddress() {
+ // TODO(b/70983952): Fill this method in
+ return null;
+ }
+
+ @Override
public boolean isMetered() {
// TODO(b/70983952): Fill this method in
return false;
@@ -237,6 +243,34 @@ class StandardWifiEntry extends WifiEntry {
// TODO(b/70983952): Fill this method in
}
+ public boolean canSignIn() {
+ // TODO(b/70983952): Fill this method in
+ return false;
+ }
+
+ @Override
+ public void signIn() {
+ // TODO(b/70983952): Fill this method in
+ }
+
+ @Override
+ public boolean canShare() {
+ // TODO(b/70983952): Fill this method in
+ return false;
+ }
+
+ @Override
+ public boolean canEasyConnect() {
+ // TODO(b/70983952): Fill this method in
+ return false;
+ }
+
+ @Override
+ public String getQrCodeString() {
+ // TODO(b/70983952): Fill this method in
+ return null;
+ }
+
@Override
public boolean canSetPassword() {
// TODO(b/70983952): Fill this method in
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
index 14e40db61..29823b430 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
@@ -168,6 +168,9 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
@Security
public abstract int getSecurity();
+ /** Returns the MAC address of the connection */
+ public abstract String getMacAddress();
+
/**
* Indicates when a network is metered or the user marked the network as metered.
*/
@@ -217,6 +220,18 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
/** Forgets the network */
public abstract void forget();
+ /** Returns whether the network can be signed-in to */
+ public abstract boolean canSignIn();
+ /** Sign-in to the network. For captive portals. */
+ public abstract void signIn();
+
+ /** Returns whether the network can be shared via QR code */
+ 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 */
@@ -364,6 +379,17 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
int FORGET_STATUS_SUCCESS = 0;
int FORGET_STATUS_FAILURE_UNKNOWN = 1;
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(value = {
+ SIGNIN_STATUS_SUCCESS,
+ SIGNIN_STATUS_FAILURE_UNKNOWN
+ })
+
+ public @interface SignInStatus {}
+
+ int SIGNIN_STATUS_SUCCESS = 0;
+ int SIGNIN_STATUS_FAILURE_UNKNOWN = 1;
+
/**
* Indicates the state of the WifiEntry has changed and clients may retrieve updates through
* the WifiEntry getter methods.
@@ -388,6 +414,12 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
*/
@MainThread
void onForgetResult(@ForgetStatus int status);
+
+ /**
+ * Result of the sign-in request indicated by the SIGNIN_STATUS constants.
+ */
+ @MainThread
+ void onSignInResult(@SignInStatus int status);
}
// TODO (b/70983952) Come up with a sorting scheme that does the right thing.
@@ -438,26 +470,33 @@ public abstract class WifiEntry implements Comparable<WifiEntry> {
}
@AnyThread
- protected void notifyOnConnectResult(int status) {
+ protected void notifyOnConnectResult(@WifiEntryCallback.ConnectStatus int status) {
if (mListener != null) {
mCallbackHandler.post(() -> mListener.onConnectResult(status));
}
}
@AnyThread
- protected void notifyOnDisconnectResult(int status) {
+ protected void notifyOnDisconnectResult(@WifiEntryCallback.DisconnectStatus int status) {
if (mListener != null) {
mCallbackHandler.post(() -> mListener.onDisconnectResult(status));
}
}
@AnyThread
- protected void notifyOnForgetResult(int status) {
+ protected void notifyOnForgetResult(@WifiEntryCallback.ForgetStatus int status) {
if (mListener != null) {
mCallbackHandler.post(() -> mListener.onForgetResult(status));
}
}
+ @AnyThread
+ protected void notifyOnSignInResult(@WifiEntryCallback.SignInStatus int status) {
+ if (mListener != null) {
+ mCallbackHandler.post(() -> mListener.onSignInResult(status));
+ }
+ }
+
class ConnectListener implements WifiManager.ActionListener {
@Override
public void onSuccess() {