am 2705b859: Merge "Address API Council feedback for WifiAdapter/WPS APIs" into lmp-dev
* commit '2705b859f86b9fdac374a55d24bcb47695b53e94':
Address API Council feedback for WifiAdapter/WPS APIs
diff --git a/api/current.txt b/api/current.txt
index d12898f..5607d08 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -17951,23 +17951,6 @@
enum_constant public static final android.net.wifi.SupplicantState UNINITIALIZED;
}
- public class WifiAdapter implements android.os.Parcelable {
- method public int describeContents();
- method public java.lang.String getName();
- method public boolean is5GHzBandSupported();
- method public boolean isDeviceToApRttSupported();
- method public boolean isDeviceToDeviceRttSupported();
- method public boolean isEnhancedPowerReportingSupported();
- method public boolean isOffChannelTdlsSupported();
- method public boolean isP2pSupported();
- method public boolean isPasspointSupported();
- method public boolean isPortableHotspotSupported();
- method public boolean isPreferredNetworkOffloadSupported();
- method public boolean isTdlsSupported();
- method public boolean isWifiScannerSupported();
- method public void writeToParcel(android.os.Parcel, int);
- }
-
public class WifiConfiguration implements android.os.Parcelable {
ctor public WifiConfiguration();
method public int describeContents();
@@ -18101,7 +18084,7 @@
public class WifiManager {
method public int addNetwork(android.net.wifi.WifiConfiguration);
method public static int calculateSignalLevel(int, int);
- method public void cancelWps(android.net.wifi.WifiManager.ActionListener);
+ method public void cancelWps(android.net.wifi.WifiManager.WpsCallback);
method public static int compareSignalLevel(int, int);
method public android.net.wifi.WifiManager.MulticastLock createMulticastLock(java.lang.String);
method public android.net.wifi.WifiManager.WifiLock createWifiLock(int, java.lang.String);
@@ -18109,13 +18092,18 @@
method public boolean disableNetwork(int);
method public boolean disconnect();
method public boolean enableNetwork(int, boolean);
- method public java.util.List<android.net.wifi.WifiAdapter> getAdapters();
method public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
method public android.net.wifi.WifiInfo getConnectionInfo();
method public android.net.DhcpInfo getDhcpInfo();
method public java.util.List<android.net.wifi.ScanResult> getScanResults();
method public int getWifiState();
+ method public boolean is5GHzBandSupported();
+ method public boolean isDeviceToApRttSupported();
+ method public boolean isEnhancedPowerReportingSupported();
+ method public boolean isP2pSupported();
+ method public boolean isPreferredNetworkOffloadSupported();
method public boolean isScanAlwaysAvailable();
+ method public boolean isTdlsSupported();
method public boolean isWifiEnabled();
method public boolean pingSupplicant();
method public boolean reassociate();
@@ -18126,12 +18114,10 @@
method public void setTdlsEnabledWithMacAddress(java.lang.String, boolean);
method public boolean setWifiEnabled(boolean);
method public boolean startScan();
- method public void startWps(android.net.wifi.WpsInfo, android.net.wifi.WifiManager.WpsListener);
+ method public void startWps(android.net.wifi.WpsInfo, android.net.wifi.WifiManager.WpsCallback);
method public int updateNetwork(android.net.wifi.WifiConfiguration);
field public static final java.lang.String ACTION_PICK_WIFI_NETWORK = "android.net.wifi.PICK_WIFI_NETWORK";
field public static final java.lang.String ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE = "android.net.wifi.action.REQUEST_SCAN_ALWAYS_AVAILABLE";
- field public static final int BUSY = 2; // 0x2
- field public static final int ERROR = 0; // 0x0
field public static final int ERROR_AUTHENTICATING = 1; // 0x1
field public static final java.lang.String EXTRA_BSSID = "bssid";
field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
@@ -18142,8 +18128,6 @@
field public static final java.lang.String EXTRA_SUPPLICANT_ERROR = "supplicantError";
field public static final java.lang.String EXTRA_WIFI_INFO = "wifiInfo";
field public static final java.lang.String EXTRA_WIFI_STATE = "wifi_state";
- field public static final int INVALID_ARGS = 8; // 0x8
- field public static final int IN_PROGRESS = 1; // 0x1
field public static final java.lang.String NETWORK_IDS_CHANGED_ACTION = "android.net.wifi.NETWORK_IDS_CHANGED";
field public static final java.lang.String NETWORK_STATE_CHANGED_ACTION = "android.net.wifi.STATE_CHANGE";
field public static final java.lang.String RSSI_CHANGED_ACTION = "android.net.wifi.RSSI_CHANGED";
@@ -18166,11 +18150,6 @@
field public static final int WPS_WEP_PROHIBITED = 4; // 0x4
}
- public static abstract interface WifiManager.ActionListener {
- method public abstract void onFailure(int);
- method public abstract void onSuccess();
- }
-
public class WifiManager.MulticastLock {
method public void acquire();
method public boolean isHeld();
@@ -18186,10 +18165,11 @@
method public void setWorkSource(android.os.WorkSource);
}
- public static abstract interface WifiManager.WpsListener {
- method public abstract void onCompletion();
- method public abstract void onFailure(int);
- method public abstract void onStartSuccess(java.lang.String);
+ public static abstract class WifiManager.WpsCallback {
+ ctor public WifiManager.WpsCallback();
+ method public abstract void onFailed(int);
+ method public abstract void onStarted(java.lang.String);
+ method public abstract void onSucceeded();
}
public class WpsInfo implements android.os.Parcelable {
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 397d700..a752686 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -18,7 +18,6 @@
import android.net.wifi.BatchedScanResult;
import android.net.wifi.BatchedScanSettings;
-import android.net.wifi.WifiAdapter;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.ScanSettings;
@@ -40,9 +39,9 @@
*/
interface IWifiManager
{
- List<WifiAdapter> getAdaptors();
+ int getSupportedFeatures();
- WifiActivityEnergyInfo reportActivityInfo(in WifiAdapter adapter);
+ WifiActivityEnergyInfo reportActivityInfo();
List<WifiConfiguration> getConfiguredNetworks();
diff --git a/wifi/java/android/net/wifi/WifiAdapter.aidl b/wifi/java/android/net/wifi/WifiAdapter.aidl
deleted file mode 100644
index 0bb5dd7..0000000
--- a/wifi/java/android/net/wifi/WifiAdapter.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (c) 2014, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net.wifi;
-
-parcelable WifiAdapter;
diff --git a/wifi/java/android/net/wifi/WifiAdapter.java b/wifi/java/android/net/wifi/WifiAdapter.java
deleted file mode 100644
index 0b12dea..0000000
--- a/wifi/java/android/net/wifi/WifiAdapter.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net.wifi;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.os.RemoteException;
-import android.util.Log;
-
-/**
- * Represents local wifi adapter. Different devices have different kinds of
- * wifi adapters; each with different capabilities. Use this class to find out
- * which capabilites are supported by the wifi adapter on the device.
- */
-public class WifiAdapter implements Parcelable {
- private static final String TAG = "WifiAdapter";
-
- /* Keep this list in sync with wifi_hal.h */
- /** @hide */
- public static final int WIFI_FEATURE_INFRA = 0x0001; // Basic infrastructure mode
- /** @hide */
- public static final int WIFI_FEATURE_INFRA_5G = 0x0002; // Support for 5 GHz Band
- /** @hide */
- public static final int WIFI_FEATURE_PASSPOINT = 0x0004; // Support for GAS/ANQP
- /** @hide */
- public static final int WIFI_FEATURE_P2P = 0x0008; // Wifi-Direct
- /** @hide */
- public static final int WIFI_FEATURE_MOBILE_HOTSPOT = 0x0010; // Soft AP
- /** @hide */
- public static final int WIFI_FEATURE_SCANNER = 0x0020; // WifiScanner APIs
- /** @hide */
- public static final int WIFI_FEATURE_NAN = 0x0040; // Neighbor Awareness Networking
- /** @hide */
- public static final int WIFI_FEATURE_D2D_RTT = 0x0080; // Device-to-device RTT
- /** @hide */
- public static final int WIFI_FEATURE_D2AP_RTT = 0x0100; // Device-to-AP RTT
- /** @hide */
- public static final int WIFI_FEATURE_BATCH_SCAN = 0x0200; // Batched Scan (deprecated)
- /** @hide */
- public static final int WIFI_FEATURE_PNO = 0x0400; // Preferred network offload
- /** @hide */
- public static final int WIFI_FEATURE_ADDITIONAL_STA = 0x0800; // Support for two STAs
- /** @hide */
- public static final int WIFI_FEATURE_TDLS = 0x1000; // Tunnel directed link setup
- /** @hide */
- public static final int WIFI_FEATURE_TDLS_OFFCHANNEL = 0x2000; // Support for TDLS off channel
- /** @hide */
- public static final int WIFI_FEATURE_EPR = 0x4000; // Enhanced power reporting
-
- private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30;
- /** @hide */
- public static final int ACTIVITY_ENERGY_INFO_CACHED = 0;
- /** @hide */
- public static final int ACTIVITY_ENERGY_INFO_REFRESHED = 1;
-
- private String name;
- private int supportedFeatures;
-
- // Make the API consistent with BlueTooth Adaptor, allowing WifiService to be accessed
- // Directly from the adapter
- /** @hide */
- public IWifiManager mService = null;
-
- /** @hide */
- public WifiAdapter(String name, int supportedFeatures) {
- this.name = name;
- this.supportedFeatures = supportedFeatures;
- }
-
- /**
- * @return name of the adapter
- */
- public String getName() {
- return name;
- }
-
- private int getSupportedFeatures() {
- return supportedFeatures;
- }
-
- private boolean isFeatureSupported(int feature) {
- return (supportedFeatures & feature) == feature;
- }
-
- /**
- * @return true if this adapter supports 5 GHz band
- */
- public boolean is5GHzBandSupported() {
- return isFeatureSupported(WIFI_FEATURE_INFRA_5G);
- }
-
- /**
- * @return true if this adapter supports passpoint
- */
- public boolean isPasspointSupported() {
- return isFeatureSupported(WIFI_FEATURE_PASSPOINT);
- }
-
- /**
- * @return true if this adapter supports WifiP2pManager (Wi-Fi Direct)
- */
- public boolean isP2pSupported() {
- return isFeatureSupported(WIFI_FEATURE_P2P);
- }
-
- /**
- * @return true if this adapter supports portable Wi-Fi hotspot
- */
- public boolean isPortableHotspotSupported() {
- return isFeatureSupported(WIFI_FEATURE_MOBILE_HOTSPOT);
- }
-
- /**
- * @return true if this adapter supports WifiScanner APIs
- */
- public boolean isWifiScannerSupported() {
- return isFeatureSupported(WIFI_FEATURE_SCANNER);
- }
-
- /**
- * @return true if this adapter supports Neighbour Awareness Network APIs
- * @hide
- */
- public boolean isNanSupported() {
- return isFeatureSupported(WIFI_FEATURE_NAN);
- }
-
- /**
- * @return true if this adapter supports Device-to-device RTT
- */
- public boolean isDeviceToDeviceRttSupported() {
- return isFeatureSupported(WIFI_FEATURE_D2D_RTT);
- }
-
- /**
- * @return true if this adapter supports Device-to-AP RTT
- */
- public boolean isDeviceToApRttSupported() {
- return isFeatureSupported(WIFI_FEATURE_D2AP_RTT);
- }
-
- /**
- * @return true if this adapter supports offloaded connectivity scan
- */
- public boolean isPreferredNetworkOffloadSupported() {
- return isFeatureSupported(WIFI_FEATURE_PNO);
- }
-
- /**
- * @return true if this adapter supports multiple simultaneous connections
- * @hide
- */
- public boolean isAdditionalStaSupported() {
- return isFeatureSupported(WIFI_FEATURE_ADDITIONAL_STA);
- }
-
- /**
- * @return true if this adapter supports Tunnel Directed Link Setup
- */
- public boolean isTdlsSupported() {
- return isFeatureSupported(WIFI_FEATURE_TDLS);
- }
-
- /**
- * @return true if this adapter supports Off Channel Tunnel Directed Link Setup
- */
- public boolean isOffChannelTdlsSupported() {
- return isFeatureSupported(WIFI_FEATURE_TDLS_OFFCHANNEL);
- }
-
- /**
- * @return true if this adapter supports advanced power/performance counters
- */
- public boolean isEnhancedPowerReportingSupported() {
- return isFeatureSupported(WIFI_FEATURE_EPR);
- }
-
-
- /**
- * Return the record of {@link WifiActivityEnergyInfo} object that
- * has the activity and energy info. This can be used to ascertain what
- * the controller has been up to, since the last sample.
- * @param updateType Type of info, cached vs refreshed.
- *
- * @return a record with {@link WifiActivityEnergyInfo} or null if
- * report is unavailable or unsupported
- * @hide
- */
- public WifiActivityEnergyInfo getControllerActivityEnergyInfo(int updateType) {
- if (mService == null) return null;
- try {
- WifiActivityEnergyInfo record;
- if (!isEnhancedPowerReportingSupported()) {
- return null;
- }
- synchronized(this) {
- record = mService.reportActivityInfo(this);
- if (record.isValid()) {
- return record;
- } else {
- return null;
- }
- }
- } catch (RemoteException e) {
- Log.e(TAG, "getControllerActivityEnergyInfo: " + e);
- }
- return null;
- }
-
- /* Parcelable implementation */
- /**
- * Implement the Parcelable interface
- * {@hide}
- */
- public int describeContents() {
- return 0;
- }
-
- /**
- * Implement the Parcelable interface
- * {@hide}
- */
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(name);
- dest.writeInt(supportedFeatures);
- }
-
- /**
- * Implement the Parcelable interface
- * {@hide}
- */
- public static final Creator<WifiAdapter> CREATOR =
- new Creator<WifiAdapter>() {
- public WifiAdapter createFromParcel(Parcel in) {
- WifiAdapter adaptor = new WifiAdapter(in.readString(), in.readInt());
- return adaptor;
- }
-
- public WifiAdapter[] newArray(int size) {
- return new WifiAdapter[size];
- }
- };
-}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 4a4da22..74f2f65 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -576,22 +576,6 @@
}
/**
- * Retrieve all wifi adapters available on this device
- * @return list of adapters
- */
- public List<WifiAdapter> getAdapters() {
- try {
- List<WifiAdapter> adapterList = mService.getAdaptors();
- for (WifiAdapter a : adapterList) {
- a.mService = mService;
- }
- return adapterList;
- } catch (RemoteException e) {
- return null;
- }
- }
-
- /**
* Return a list of all the networks configured in the supplicant.
* Not all fields of WifiConfiguration are returned. Only the following
* fields are filled in:
@@ -824,6 +808,182 @@
}
}
+ /* Keep this list in sync with wifi_hal.h */
+ /** @hide */
+ public static final int WIFI_FEATURE_INFRA = 0x0001; // Basic infrastructure mode
+ /** @hide */
+ public static final int WIFI_FEATURE_INFRA_5G = 0x0002; // Support for 5 GHz Band
+ /** @hide */
+ public static final int WIFI_FEATURE_PASSPOINT = 0x0004; // Support for GAS/ANQP
+ /** @hide */
+ public static final int WIFI_FEATURE_P2P = 0x0008; // Wifi-Direct
+ /** @hide */
+ public static final int WIFI_FEATURE_MOBILE_HOTSPOT = 0x0010; // Soft AP
+ /** @hide */
+ public static final int WIFI_FEATURE_SCANNER = 0x0020; // WifiScanner APIs
+ /** @hide */
+ public static final int WIFI_FEATURE_NAN = 0x0040; // Neighbor Awareness Networking
+ /** @hide */
+ public static final int WIFI_FEATURE_D2D_RTT = 0x0080; // Device-to-device RTT
+ /** @hide */
+ public static final int WIFI_FEATURE_D2AP_RTT = 0x0100; // Device-to-AP RTT
+ /** @hide */
+ public static final int WIFI_FEATURE_BATCH_SCAN = 0x0200; // Batched Scan (deprecated)
+ /** @hide */
+ public static final int WIFI_FEATURE_PNO = 0x0400; // Preferred network offload
+ /** @hide */
+ public static final int WIFI_FEATURE_ADDITIONAL_STA = 0x0800; // Support for two STAs
+ /** @hide */
+ public static final int WIFI_FEATURE_TDLS = 0x1000; // Tunnel directed link setup
+ /** @hide */
+ public static final int WIFI_FEATURE_TDLS_OFFCHANNEL = 0x2000; // Support for TDLS off channel
+ /** @hide */
+ public static final int WIFI_FEATURE_EPR = 0x4000; // Enhanced power reporting
+
+ private int getSupportedFeatures() {
+ try {
+ return mService.getSupportedFeatures();
+ } catch (RemoteException e) {
+ return 0;
+ }
+ }
+
+ private boolean isFeatureSupported(int feature) {
+ return (getSupportedFeatures() & feature) == feature;
+ }
+ /**
+ * @return true if this adapter supports 5 GHz band
+ */
+ public boolean is5GHzBandSupported() {
+ return isFeatureSupported(WIFI_FEATURE_INFRA_5G);
+ }
+
+ /**
+ * @return true if this adapter supports passpoint
+ * @hide
+ */
+ public boolean isPasspointSupported() {
+ return isFeatureSupported(WIFI_FEATURE_PASSPOINT);
+ }
+
+ /**
+ * @return true if this adapter supports WifiP2pManager (Wi-Fi Direct)
+ */
+ public boolean isP2pSupported() {
+ return isFeatureSupported(WIFI_FEATURE_P2P);
+ }
+
+ /**
+ * @return true if this adapter supports portable Wi-Fi hotspot
+ * @hide
+ */
+ @SystemApi
+ public boolean isPortableHotspotSupported() {
+ return isFeatureSupported(WIFI_FEATURE_MOBILE_HOTSPOT);
+ }
+
+ /**
+ * @return true if this adapter supports WifiScanner APIs
+ * @hide
+ */
+ @SystemApi
+ public boolean isWifiScannerSupported() {
+ return isFeatureSupported(WIFI_FEATURE_SCANNER);
+ }
+
+ /**
+ * @return true if this adapter supports Neighbour Awareness Network APIs
+ * @hide
+ */
+ public boolean isNanSupported() {
+ return isFeatureSupported(WIFI_FEATURE_NAN);
+ }
+
+ /**
+ * @return true if this adapter supports Device-to-device RTT
+ * @hide
+ */
+ @SystemApi
+ public boolean isDeviceToDeviceRttSupported() {
+ return isFeatureSupported(WIFI_FEATURE_D2D_RTT);
+ }
+
+ /**
+ * @return true if this adapter supports Device-to-AP RTT
+ */
+ @SystemApi
+ public boolean isDeviceToApRttSupported() {
+ return isFeatureSupported(WIFI_FEATURE_D2AP_RTT);
+ }
+
+ /**
+ * @return true if this adapter supports offloaded connectivity scan
+ */
+ public boolean isPreferredNetworkOffloadSupported() {
+ return isFeatureSupported(WIFI_FEATURE_PNO);
+ }
+
+ /**
+ * @return true if this adapter supports multiple simultaneous connections
+ * @hide
+ */
+ public boolean isAdditionalStaSupported() {
+ return isFeatureSupported(WIFI_FEATURE_ADDITIONAL_STA);
+ }
+
+ /**
+ * @return true if this adapter supports Tunnel Directed Link Setup
+ */
+ public boolean isTdlsSupported() {
+ return isFeatureSupported(WIFI_FEATURE_TDLS);
+ }
+
+ /**
+ * @return true if this adapter supports Off Channel Tunnel Directed Link Setup
+ * @hide
+ */
+ public boolean isOffChannelTdlsSupported() {
+ return isFeatureSupported(WIFI_FEATURE_TDLS_OFFCHANNEL);
+ }
+
+ /**
+ * @return true if this adapter supports advanced power/performance counters
+ */
+ public boolean isEnhancedPowerReportingSupported() {
+ return isFeatureSupported(WIFI_FEATURE_EPR);
+ }
+
+ /**
+ * Return the record of {@link WifiActivityEnergyInfo} object that
+ * has the activity and energy info. This can be used to ascertain what
+ * the controller has been up to, since the last sample.
+ * @param updateType Type of info, cached vs refreshed.
+ *
+ * @return a record with {@link WifiActivityEnergyInfo} or null if
+ * report is unavailable or unsupported
+ * @hide
+ */
+ public WifiActivityEnergyInfo getControllerActivityEnergyInfo(int updateType) {
+ if (mService == null) return null;
+ try {
+ WifiActivityEnergyInfo record;
+ if (!isEnhancedPowerReportingSupported()) {
+ return null;
+ }
+ synchronized(this) {
+ record = mService.reportActivityInfo();
+ if (record.isValid()) {
+ return record;
+ } else {
+ return null;
+ }
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "getControllerActivityEnergyInfo: " + e);
+ }
+ return null;
+ }
+
/**
* Request a scan for access points. Returns immediately. The availability
* of the results is made known later by means of an asynchronous event sent
@@ -1457,12 +1617,14 @@
/**
* Passed with {@link ActionListener#onFailure}.
* Indicates that the operation failed due to an internal error.
+ * @hide
*/
public static final int ERROR = 0;
/**
* Passed with {@link ActionListener#onFailure}.
* Indicates that the operation is already in progress
+ * @hide
*/
public static final int IN_PROGRESS = 1;
@@ -1470,6 +1632,7 @@
* Passed with {@link ActionListener#onFailure}.
* Indicates that the operation failed because the framework is busy and
* unable to service the request
+ * @hide
*/
public static final int BUSY = 2;
@@ -1488,18 +1651,21 @@
/**
* Passed with {@link ActionListener#onFailure}.
* Indicates that the operation failed due to invalid inputs
+ * @hide
*/
public static final int INVALID_ARGS = 8;
/**
* Passed with {@link ActionListener#onFailure}.
* Indicates that the operation failed due to user permissions.
- *
* @hide
*/
public static final int NOT_AUTHORIZED = 9;
- /** Interface for callback invocation on an application action */
+ /**
+ * Interface for callback invocation on an application action
+ * @hide
+ */
public interface ActionListener {
/** The operation succeeded */
public void onSuccess();
@@ -1512,19 +1678,21 @@
}
/** Interface for callback invocation on a start WPS action */
- public interface WpsListener {
+ public static abstract class WpsCallback {
/** WPS start succeeded */
- public void onStartSuccess(String pin);
+ public abstract void onStarted(String pin);
/** WPS operation completed succesfully */
- public void onCompletion();
+ public abstract void onSucceeded();
/**
* WPS operation failed
* @param reason The reason for failure could be one of
- * {@link #IN_PROGRESS}, {@link #WPS_OVERLAP_ERROR},{@link #ERROR} or {@link #BUSY}
+ * {@link #WPS_TKIP_ONLY_PROHIBITED}, {@link #WPS_OVERLAP_ERROR},
+ * {@link #WPS_WEP_PROHIBITED}, {@link #WPS_TIMED_OUT} or {@link #WPS_AUTH_FAILURE}
+ * and some generic errors.
*/
- public void onFailure(int reason);
+ public abstract void onFailed(int reason);
}
/** Interface for callback invocation on a TX packet count poll action {@hide} */
@@ -1576,7 +1744,6 @@
case WifiManager.CONNECT_NETWORK_FAILED:
case WifiManager.FORGET_NETWORK_FAILED:
case WifiManager.SAVE_NETWORK_FAILED:
- case WifiManager.CANCEL_WPS_FAILED:
case WifiManager.DISABLE_NETWORK_FAILED:
if (listener != null) {
((ActionListener) listener).onFailure(message.arg1);
@@ -1586,7 +1753,6 @@
case WifiManager.CONNECT_NETWORK_SUCCEEDED:
case WifiManager.FORGET_NETWORK_SUCCEEDED:
case WifiManager.SAVE_NETWORK_SUCCEEDED:
- case WifiManager.CANCEL_WPS_SUCCEDED:
case WifiManager.DISABLE_NETWORK_SUCCEEDED:
if (listener != null) {
((ActionListener) listener).onSuccess();
@@ -1595,7 +1761,7 @@
case WifiManager.START_WPS_SUCCEEDED:
if (listener != null) {
WpsResult result = (WpsResult) message.obj;
- ((WpsListener) listener).onStartSuccess(result.pin);
+ ((WpsCallback) listener).onStarted(result.pin);
//Listener needs to stay until completion or failure
synchronized(sListenerMapLock) {
sListenerMap.put(message.arg2, listener);
@@ -1604,12 +1770,22 @@
break;
case WifiManager.WPS_COMPLETED:
if (listener != null) {
- ((WpsListener) listener).onCompletion();
+ ((WpsCallback) listener).onSucceeded();
}
break;
case WifiManager.WPS_FAILED:
if (listener != null) {
- ((WpsListener) listener).onFailure(message.arg1);
+ ((WpsCallback) listener).onFailed(message.arg1);
+ }
+ break;
+ case WifiManager.CANCEL_WPS_SUCCEDED:
+ if (listener != null) {
+ ((WpsCallback) listener).onSucceeded();
+ }
+ break;
+ case WifiManager.CANCEL_WPS_FAILED:
+ if (listener != null) {
+ ((WpsCallback) listener).onFailed(message.arg1);
}
break;
case WifiManager.RSSI_PKTCNT_FETCH_SUCCEEDED:
@@ -1794,7 +1970,7 @@
* @throws IllegalStateException if the WifiManager instance needs to be
* initialized again
*/
- public void startWps(WpsInfo config, WpsListener listener) {
+ public void startWps(WpsInfo config, WpsCallback listener) {
if (config == null) throw new IllegalArgumentException("config cannot be null");
validateChannel();
sAsyncChannel.sendMessage(START_WPS, 0, putListener(listener), config);
@@ -1807,7 +1983,7 @@
* @throws IllegalStateException if the WifiManager instance needs to be
* initialized again
*/
- public void cancelWps(ActionListener listener) {
+ public void cancelWps(WpsCallback listener) {
validateChannel();
sAsyncChannel.sendMessage(CANCEL_WPS, 0, putListener(listener));
}
@@ -2352,4 +2528,7 @@
return 0;
}
}
+
+
+
}