summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl2
-rw-r--r--wifi/java/android/net/wifi/WifiActivityEnergyInfo.java55
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java103
-rw-r--r--wifi/java/android/net/wifi/WifiLinkLayerStats.java6
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java173
-rw-r--r--wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java2
-rw-r--r--wifi/java/android/net/wifi/WifiScanner.java13
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java1
-rw-r--r--wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java2
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java2
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointDmTree.java2
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java2
12 files changed, 321 insertions, 42 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 6e6d6f6..0e888e8 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -166,5 +166,7 @@ interface IWifiManager
WifiConnectionStatistics getConnectionStatistics();
void disableEphemeralNetwork(String SSID);
+
+ void factoryReset();
}
diff --git a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
index c9a2f07..0f73342 100644
--- a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
+++ b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
@@ -21,37 +21,60 @@ import android.os.Parcelable;
/**
* Record of energy and activity information from controller and
- * underlying wifi stack state.Timestamp the record with system
- * time
+ * underlying wifi stack state. Timestamp the record with elapsed
+ * real-time.
* @hide
*/
public final class WifiActivityEnergyInfo implements Parcelable {
- private final int mStackState;
- private final int mControllerTxTimeMs;
- private final int mControllerRxTimeMs;
- private final int mControllerIdleTimeMs;
- private final int mControllerEnergyUsed;
- private final long timestamp;
+ /**
+ * @hide
+ */
+ public long mTimestamp;
+
+ /**
+ * @hide
+ */
+ public int mStackState;
+
+ /**
+ * @hide
+ */
+ public int mControllerTxTimeMs;
+
+ /**
+ * @hide
+ */
+ public int mControllerRxTimeMs;
+
+ /**
+ * @hide
+ */
+ public int mControllerIdleTimeMs;
+
+ /**
+ * @hide
+ */
+ public int mControllerEnergyUsed;
public static final int STACK_STATE_INVALID = 0;
public static final int STACK_STATE_STATE_ACTIVE = 1;
public static final int STACK_STATE_STATE_SCANNING = 2;
public static final int STACK_STATE_STATE_IDLE = 3;
- public WifiActivityEnergyInfo(int stackState, int txTime, int rxTime,
- int idleTime, int energyUsed) {
+ public WifiActivityEnergyInfo(long timestamp, int stackState,
+ int txTime, int rxTime, int idleTime, int energyUsed) {
+ mTimestamp = timestamp;
mStackState = stackState;
mControllerTxTimeMs = txTime;
mControllerRxTimeMs = rxTime;
mControllerIdleTimeMs = idleTime;
mControllerEnergyUsed = energyUsed;
- timestamp = System.currentTimeMillis();
}
@Override
public String toString() {
return "WifiActivityEnergyInfo{"
- + " timestamp=" + timestamp
+ + " timestamp=" + mTimestamp
+ " mStackState=" + mStackState
+ " mControllerTxTimeMs=" + mControllerTxTimeMs
+ " mControllerRxTimeMs=" + mControllerRxTimeMs
@@ -63,13 +86,14 @@ public final class WifiActivityEnergyInfo implements Parcelable {
public static final Parcelable.Creator<WifiActivityEnergyInfo> CREATOR =
new Parcelable.Creator<WifiActivityEnergyInfo>() {
public WifiActivityEnergyInfo createFromParcel(Parcel in) {
+ long timestamp = in.readLong();
int stackState = in.readInt();
int txTime = in.readInt();
int rxTime = in.readInt();
int idleTime = in.readInt();
int energyUsed = in.readInt();
- return new WifiActivityEnergyInfo(stackState, txTime, rxTime,
- idleTime, energyUsed);
+ return new WifiActivityEnergyInfo(timestamp, stackState,
+ txTime, rxTime, idleTime, energyUsed);
}
public WifiActivityEnergyInfo[] newArray(int size) {
return new WifiActivityEnergyInfo[size];
@@ -77,6 +101,7 @@ public final class WifiActivityEnergyInfo implements Parcelable {
};
public void writeToParcel(Parcel out, int flags) {
+ out.writeLong(mTimestamp);
out.writeInt(mStackState);
out.writeInt(mControllerTxTimeMs);
out.writeInt(mControllerRxTimeMs);
@@ -128,7 +153,7 @@ public final class WifiActivityEnergyInfo implements Parcelable {
* @return timestamp(wall clock) of record creation
*/
public long getTimeStamp() {
- return timestamp;
+ return mTimestamp;
}
/**
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index b52f6cf..21161b4 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -17,6 +17,7 @@
package android.net.wifi;
import android.annotation.SystemApi;
+import android.content.pm.PackageManager;
import android.net.IpConfiguration;
import android.net.IpConfiguration.ProxySettings;
import android.net.ProxyInfo;
@@ -193,6 +194,9 @@ public class WifiConfiguration implements Parcelable {
/** @hide */
public static final int DISABLED_BY_WIFI_MANAGER = 5;
+ /** @hide */
+ public static final int UNKNOWN_UID = -1;
+
/**
* The ID number that the supplicant uses to identify this
* network configuration entry. This must be passed as an argument
@@ -400,10 +404,32 @@ public class WifiConfiguration implements Parcelable {
/**
* @hide
+ * Universal name for app creating the configuration
+ * see {#link {@link PackageManager#getNameForUid(int)}
+ */
+ @SystemApi
+ public String creatorName;
+
+ /**
+ * @hide
+ * Universal name for app updating the configuration
+ * see {#link {@link PackageManager#getNameForUid(int)}
+ */
+ @SystemApi
+ public String lastUpdateName;
+
+ /**
+ * @hide
* Uid used by autoJoin
*/
public String autoJoinBSSID;
+ /**
+ * @hide
+ * Status of user approval for connection
+ */
+ public int userApproved = USER_UNSPECIFIED;
+
/** The Below RSSI thresholds are used to configure AutoJoin
* - GOOD/LOW/BAD thresholds are used so as to calculate link score
* - UNWANTED_SOFT are used by the blacklisting logic so as to handle
@@ -605,6 +631,28 @@ public class WifiConfiguration implements Parcelable {
/** @hide */
public static final int AUTO_JOIN_DELETED = 200;
+ // States for the userApproved field
+ /**
+ * @hide
+ * User hasn't specified if connection is okay
+ */
+ public static final int USER_UNSPECIFIED = 0;
+ /**
+ * @hide
+ * User has approved this for connection
+ */
+ public static final int USER_APPROVED = 1;
+ /**
+ * @hide
+ * User has banned this from connection
+ */
+ public static final int USER_BANNED = 2;
+ /**
+ * @hide
+ * Waiting for user input
+ */
+ public static final int USER_PENDING = 3;
+
/**
* @hide
*/
@@ -645,6 +693,14 @@ public class WifiConfiguration implements Parcelable {
}
/**
+ * The WiFi configuration is expected not to have Internet access (e.g., a wireless printer, a
+ * Chromecast hotspot, etc.). This will be set if the user explicitly confirms a connection to
+ * this configuration and selects "don't ask again".
+ * @hide
+ */
+ public boolean noInternetAccessExpected;
+
+ /**
* @hide
* Last time we blacklisted the configuration
*/
@@ -858,6 +914,8 @@ public class WifiConfiguration implements Parcelable {
ephemeral = false;
validatedInternetAccess = false;
mIpConfiguration = new IpConfiguration();
+ lastUpdateUid = -1;
+ creatorUid = -1;
}
/**
@@ -938,6 +996,15 @@ public class WifiConfiguration implements Parcelable {
return false;
}
+ /**
+ * Helper function, idenfity if a configuration should be treated as an enterprise network
+ * @hide
+ */
+ public boolean isEnterprise() {
+ return allowedKeyManagement.get(KeyMgmt.WPA_EAP) ||
+ allowedKeyManagement.get(KeyMgmt.IEEE8021X);
+ }
+
/** @hide **/
public void setAutoJoinStatus(int status) {
if (status < 0) status = 0;
@@ -1062,7 +1129,6 @@ public class WifiConfiguration implements Parcelable {
sbuf.append("IP config:\n");
sbuf.append(mIpConfiguration.toString());
- if (this.creatorUid != 0) sbuf.append(" uid=" + Integer.toString(creatorUid));
if (this.autoJoinBSSID != null) sbuf.append(" autoJoinBSSID=" + autoJoinBSSID);
long now_ms = System.currentTimeMillis();
if (this.blackListTimestamp != 0) {
@@ -1074,6 +1140,15 @@ public class WifiConfiguration implements Parcelable {
sbuf.append(" blackListed: ").append(Long.toString(diff/1000)).append( "sec");
}
}
+ if (creatorUid != 0) sbuf.append(" cuid=" + Integer.toString(creatorUid));
+ if (creatorName != null) sbuf.append(" cname=" + creatorName);
+ if (lastUpdateUid != 0) sbuf.append(" luid=" + lastUpdateUid);
+ if (lastUpdateName != null) sbuf.append(" lname=" + lastUpdateName);
+ sbuf.append(" lcuid=" + lastConnectUid);
+ sbuf.append(" userApproved=" + userApprovedAsString(userApproved));
+ sbuf.append(" noInternetAccessExpected=" + noInternetAccessExpected);
+ sbuf.append(" ");
+
if (this.lastConnected != 0) {
sbuf.append('\n');
long diff = now_ms - this.lastConnected;
@@ -1174,6 +1249,20 @@ public class WifiConfiguration implements Parcelable {
return SSID;
}
+ /** @hide **/
+ public static String userApprovedAsString(int userApproved) {
+ switch (userApproved) {
+ case USER_APPROVED:
+ return "USER_APPROVED";
+ case USER_BANNED:
+ return "USER_BANNED";
+ case USER_UNSPECIFIED:
+ return "USER_UNSPECIFIED";
+ default:
+ return "INVALID";
+ }
+ }
+
/**
* Get an identifier for associating credentials with this config
* @param current configuration contains values for additional fields
@@ -1439,6 +1528,8 @@ public class WifiConfiguration implements Parcelable {
lastConnectUid = source.lastConnectUid;
lastUpdateUid = source.lastUpdateUid;
creatorUid = source.creatorUid;
+ creatorName = source.creatorName;
+ lastUpdateName = source.lastUpdateName;
peerWifiConfiguration = source.peerWifiConfiguration;
blackListTimestamp = source.blackListTimestamp;
lastConnected = source.lastConnected;
@@ -1465,7 +1556,9 @@ public class WifiConfiguration implements Parcelable {
= source.autoJoinUseAggressiveJoinAttemptThreshold;
autoJoinBailedDueToLowRssi = source.autoJoinBailedDueToLowRssi;
dirty = source.dirty;
+ userApproved = source.userApproved;
numNoInternetAccessReports = source.numNoInternetAccessReports;
+ noInternetAccessExpected = source.noInternetAccessExpected;
}
}
@@ -1520,6 +1613,8 @@ public class WifiConfiguration implements Parcelable {
dest.writeInt(creatorUid);
dest.writeInt(lastConnectUid);
dest.writeInt(lastUpdateUid);
+ dest.writeString(creatorName);
+ dest.writeString(lastUpdateName);
dest.writeLong(blackListTimestamp);
dest.writeLong(lastConnectionFailure);
dest.writeLong(lastRoamingFailure);
@@ -1540,7 +1635,9 @@ public class WifiConfiguration implements Parcelable {
dest.writeInt(numUserTriggeredJoinAttempts);
dest.writeInt(autoJoinUseAggressiveJoinAttemptThreshold);
dest.writeInt(autoJoinBailedDueToLowRssi ? 1 : 0);
+ dest.writeInt(userApproved);
dest.writeInt(numNoInternetAccessReports);
+ dest.writeInt(noInternetAccessExpected ? 1 : 0);
}
/** Implement the Parcelable interface {@hide} */
@@ -1591,6 +1688,8 @@ public class WifiConfiguration implements Parcelable {
config.creatorUid = in.readInt();
config.lastConnectUid = in.readInt();
config.lastUpdateUid = in.readInt();
+ config.creatorName = in.readString();
+ config.lastUpdateName = in.readString();
config.blackListTimestamp = in.readLong();
config.lastConnectionFailure = in.readLong();
config.lastRoamingFailure = in.readLong();
@@ -1611,7 +1710,9 @@ public class WifiConfiguration implements Parcelable {
config.numUserTriggeredJoinAttempts = in.readInt();
config.autoJoinUseAggressiveJoinAttemptThreshold = in.readInt();
config.autoJoinBailedDueToLowRssi = in.readInt() != 0;
+ config.userApproved = in.readInt();
config.numNoInternetAccessReports = in.readInt();
+ config.noInternetAccessExpected = in.readInt() != 0;
return config;
}
diff --git a/wifi/java/android/net/wifi/WifiLinkLayerStats.java b/wifi/java/android/net/wifi/WifiLinkLayerStats.java
index 7fac7cf..1de4fd8 100644
--- a/wifi/java/android/net/wifi/WifiLinkLayerStats.java
+++ b/wifi/java/android/net/wifi/WifiLinkLayerStats.java
@@ -18,12 +18,6 @@ package android.net.wifi;
import android.os.Parcelable;
import android.os.Parcel;
-import android.text.TextUtils;
-import java.util.HashMap;
-import java.util.Date;
-import java.util.ArrayList;
-
-import java.util.BitSet;
/**
* A class representing link layer statistics collected over a Wifi Interface.
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 2058645..3205351 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -20,10 +20,16 @@ import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.ConnectivityManager.NetworkCallback;
import android.net.DhcpInfo;
+import android.net.Network;
+import android.net.NetworkCapabilities;
+import android.net.NetworkRequest;
import android.net.wifi.ScanSettings;
import android.net.wifi.WifiChannel;
import android.os.Binder;
+import android.os.Build;
import android.os.IBinder;
import android.os.Handler;
import android.os.HandlerThread;
@@ -38,6 +44,7 @@ import android.util.SparseArray;
import java.net.InetAddress;
import java.util.concurrent.CountDownLatch;
+import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.AsyncChannel;
import com.android.internal.util.Protocol;
@@ -86,6 +93,28 @@ public class WifiManager {
public static final String EXTRA_SCAN_AVAILABLE = "scan_enabled";
/**
+ * Broadcast intent action indicating that the credential of a Wi-Fi network
+ * has been changed. One extra provides the ssid of the network. Another
+ * extra provides the event type, whether the credential is saved or forgot.
+ * @hide
+ */
+ @SystemApi
+ public static final String WIFI_CREDENTIAL_CHANGED_ACTION =
+ "android.net.wifi.WIFI_CREDENTIAL_CHANGED";
+ /** @hide */
+ @SystemApi
+ public static final String EXTRA_WIFI_CREDENTIAL_EVENT_TYPE = "et";
+ /** @hide */
+ @SystemApi
+ public static final String EXTRA_WIFI_CREDENTIAL_SSID = "ssid";
+ /** @hide */
+ @SystemApi
+ public static final int WIFI_CREDENTIAL_SAVED = 0;
+ /** @hide */
+ @SystemApi
+ public static final int WIFI_CREDENTIAL_FORGOT = 1;
+
+ /**
* Broadcast intent action indicating that Wi-Fi has been enabled, disabled,
* enabling, disabling, or unknown. One extra provides this state as an int.
* Another extra provides the previous state, if available.
@@ -546,6 +575,7 @@ public class WifiManager {
private Context mContext;
IWifiManager mService;
+ private final int mTargetSdkVersion;
private static final int INVALID_KEY = 0;
private static int sListenerKey = 1;
@@ -554,11 +584,17 @@ public class WifiManager {
private static AsyncChannel sAsyncChannel;
private static CountDownLatch sConnected;
+ private static ConnectivityManager sCM;
private static final Object sThreadRefLock = new Object();
private static int sThreadRefCount;
private static HandlerThread sHandlerThread;
+ @GuardedBy("sCM")
+ // TODO: Introduce refcounting and make this a per-process static callback, instead of a
+ // per-WifiManager callback.
+ private PinningNetworkCallback mNetworkCallback;
+
/**
* Create a new WifiManager instance.
* Applications will almost always want to use
@@ -572,6 +608,7 @@ public class WifiManager {
public WifiManager(Context context, IWifiManager service) {
mContext = context;
mService = service;
+ mTargetSdkVersion = context.getApplicationInfo().targetSdkVersion;
init();
}
@@ -718,6 +755,20 @@ public class WifiManager {
* networks are disabled, and an attempt to connect to the selected
* network is initiated. This may result in the asynchronous delivery
* of state change events.
+ * <p>
+ * <b>Note:</b> If an application's target SDK version is
+ * {@link android.os.Build.VERSION_CODES#MNC} or newer, network
+ * communication may not use Wi-Fi even if Wi-Fi is connected; traffic may
+ * instead be sent through another network, such as cellular data,
+ * Bluetooth tethering, or Ethernet. For example, traffic will never use a
+ * Wi-Fi network that does not provide Internet access (e.g. a wireless
+ * printer), if another network that does offer Internet access (e.g.
+ * cellular data) is available. Applications that need to ensure that their
+ * network traffic uses Wi-Fi should use APIs such as
+ * {@link Network#bindSocket(java.net.Socket)},
+ * {@link Network#openConnection(java.net.URL)}, or
+ * {@link ConnectivityManager#bindProcessToNetwork} to do so.
+ *
* @param netId the ID of the network in the list of configured networks
* @param disableOthers if true, disable all other networks. The way to
* select a particular network to connect to is specify {@code true}
@@ -725,11 +776,23 @@ public class WifiManager {
* @return {@code true} if the operation succeeded
*/
public boolean enableNetwork(int netId, boolean disableOthers) {
+ final boolean pin = disableOthers && mTargetSdkVersion < Build.VERSION_CODES.MNC;
+ if (pin) {
+ registerPinningNetworkCallback();
+ }
+
+ boolean success;
try {
- return mService.enableNetwork(netId, disableOthers);
+ success = mService.enableNetwork(netId, disableOthers);
} catch (RemoteException e) {
- return false;
+ success = false;
+ }
+
+ if (pin && !success) {
+ unregisterPinningNetworkCallback();
}
+
+ return success;
}
/**
@@ -1929,6 +1992,100 @@ public class WifiManager {
"No permission to access and change wifi or a bad initialization");
}
+ private void initConnectivityManager() {
+ // TODO: what happens if an app calls a WifiManager API before ConnectivityManager is
+ // registered? Can we fix this by starting ConnectivityService before WifiService?
+ if (sCM == null) {
+ sCM = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (sCM == null) {
+ throw new IllegalStateException("Bad luck, ConnectivityService not started.");
+ }
+ }
+ }
+
+ /**
+ * A NetworkCallback that pins the process to the first wifi network to connect.
+ *
+ * We use this to maintain compatibility with pre-M apps that call WifiManager.enableNetwork()
+ * to connect to a Wi-Fi network that has no Internet access, and then assume that they will be
+ * able to use that network because it's the system default.
+ *
+ * In order to maintain compatibility with apps that call setProcessDefaultNetwork themselves,
+ * we try not to set the default network unless they have already done so, and we try not to
+ * clear the default network unless we set it ourselves.
+ *
+ * This should maintain behaviour that's compatible with L, which would pin the whole system to
+ * any wifi network that was created via enableNetwork(..., true) until that network
+ * disconnected.
+ *
+ * Note that while this hack allows network traffic to flow, it is quite limited. For example:
+ *
+ * 1. setProcessDefaultNetwork only affects this process, so:
+ * - Any subprocesses spawned by this process will not be pinned to Wi-Fi.
+ * - If this app relies on any other apps on the device also being on Wi-Fi, that won't work
+ * either, because other apps on the device will not be pinned.
+ * 2. The behaviour of other APIs is not modified. For example:
+ * - getActiveNetworkInfo will return the system default network, not Wi-Fi.
+ * - There will be no CONNECTIVITY_ACTION broadcasts about TYPE_WIFI.
+ * - getProcessDefaultNetwork will not return null, so if any apps are relying on that, they
+ * will be surprised as well.
+ */
+ private class PinningNetworkCallback extends NetworkCallback {
+ private Network mPinnedNetwork;
+
+ @Override
+ public void onPreCheck(Network network) {
+ if (sCM.getProcessDefaultNetwork() == null && mPinnedNetwork == null) {
+ sCM.setProcessDefaultNetwork(network);
+ mPinnedNetwork = network;
+ Log.d(TAG, "Wifi alternate reality enabled on network " + network);
+ }
+ }
+
+ @Override
+ public void onLost(Network network) {
+ if (network.equals(mPinnedNetwork) && network.equals(sCM.getProcessDefaultNetwork())) {
+ sCM.setProcessDefaultNetwork(null);
+ Log.d(TAG, "Wifi alternate reality disabled on network " + network);
+ mPinnedNetwork = null;
+ unregisterPinningNetworkCallback();
+ }
+ }
+ }
+
+ private void registerPinningNetworkCallback() {
+ initConnectivityManager();
+ synchronized (sCM) {
+ if (mNetworkCallback == null) {
+ // TODO: clear all capabilities.
+ NetworkRequest request = new NetworkRequest.Builder()
+ .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
+ .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+ .build();
+ mNetworkCallback = new PinningNetworkCallback();
+ try {
+ sCM.registerNetworkCallback(request, mNetworkCallback);
+ } catch (SecurityException e) {
+ Log.d(TAG, "Failed to register network callback", e);
+ }
+ }
+ }
+ }
+
+ private void unregisterPinningNetworkCallback() {
+ initConnectivityManager();
+ synchronized (sCM) {
+ if (mNetworkCallback != null) {
+ try {
+ sCM.unregisterNetworkCallback(mNetworkCallback);
+ } catch (SecurityException e) {
+ Log.d(TAG, "Failed to unregister network callback", e);
+ }
+ mNetworkCallback = null;
+ }
+ }
+ }
+
/**
* Connect to a network with the given configuration. The network also
* gets added to the supplicant configuration.
@@ -2635,4 +2792,16 @@ public class WifiManager {
}
return false;
}
+
+ /**
+ * Resets all wifi manager settings back to factory defaults.
+ *
+ * @hide
+ */
+ public void factoryReset() {
+ try {
+ mService.factoryReset();
+ } catch (RemoteException e) {
+ }
+ }
}
diff --git a/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java
index c7d62e5..9b2fdc8 100644
--- a/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java
+++ b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java
@@ -21,8 +21,6 @@ import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import java.util.HashMap;
-
/**
* Connection Statistics For a WiFi Network.
* @hide
diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java
index fea934f..4ead972 100644
--- a/wifi/java/android/net/wifi/WifiScanner.java
+++ b/wifi/java/android/net/wifi/WifiScanner.java
@@ -417,11 +417,6 @@ public class WifiScanner {
public void onPeriodChanged(int periodInMs);
/**
* reports results retrieved from background scan and single shot scans
- * @deprecated in favor of {@link #onResults(ScanData[])}
- */
- public void onResults(ScanResult[] results);
- /**
- * reports results retrieved from background scan and single shot scans
*/
public void onResults(ScanData[] results);
/**
@@ -452,12 +447,12 @@ public class WifiScanner {
}
/**
* reports currently available scan results on appropriate listeners
+ * @return true if all scan results were reported correctly
*/
- public ScanResult[] getScanResults() {
+ public boolean getScanResults() {
validateChannel();
Message reply = sAsyncChannel.sendMessageSynchronously(CMD_GET_SCAN_RESULTS, 0);
- // return reply.what == CMD_OP_SUCCEEDED;
- return null;
+ return reply.what == CMD_OP_SUCCEEDED;
}
/**
@@ -727,7 +722,7 @@ public class WifiScanner {
/* private members and methods */
private static final String TAG = "WifiScanner";
- private static final boolean DBG = true;
+ private static final boolean DBG = false;
/* commands for Wifi Service */
private static final int BASE = Protocol.BASE_WIFI_SCANNER;
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
index d65d03e..92c7e36 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
@@ -77,6 +77,7 @@ public class WifiP2pWfdInfo implements Parcelable {
public boolean setDeviceType(int deviceType) {
if (deviceType >= WFD_SOURCE && deviceType <= SOURCE_OR_PRIMARY_SINK) {
+ mDeviceInfo &= ~DEVICE_TYPE;
mDeviceInfo |= deviceType;
return true;
}
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java
index 194c982..0ddfa77 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java
@@ -334,7 +334,7 @@ public class WifiP2pServiceResponse implements Parcelable {
result = 31 * result + mTransId;
result = 31 * result + (mDevice.deviceAddress == null ?
0 : mDevice.deviceAddress.hashCode());
- result = 31 * result + (mData == null ? 0 : mData.hashCode());
+ result = 31 * result + (mData == null ? 0 : Arrays.hashCode(mData));
return result;
}
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java
index 0a7230f..a100aed 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java
@@ -20,9 +20,7 @@ import android.net.wifi.WifiEnterpriseConfig;
import android.os.Parcelable;
import android.os.Parcel;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointDmTree.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointDmTree.java
index bbf5fc6..427c84c 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointDmTree.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointDmTree.java
@@ -18,8 +18,6 @@ package android.net.wifi.passpoint;
import android.os.Parcelable;
import android.os.Parcel;
-import android.util.Log;
-
import java.util.HashMap;
/**
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java
index f84ac88..c08877e 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java
@@ -17,7 +17,6 @@
package android.net.wifi.passpoint;
import android.net.wifi.WifiConfiguration;
-import android.net.wifi.ScanResult;
import android.os.Parcelable;
import android.os.Parcel;
import android.security.Credentials;
@@ -25,7 +24,6 @@ import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.List;
/** @hide */