summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2009-05-21 15:11:40 -0700
committerRobert Greenwalt <robdroid@android.com>2009-05-22 09:31:41 -0700
commitb5010cc3c33c74cc406a70f34f93d330a3f0db6a (patch)
treed915d9dd8108eafc668a45f15bb839c26bf026c6 /wifi
parentc8a57c4b58cdfd23b41e6a770d41e375601e57ca (diff)
downloadframeworks_base-b5010cc3c33c74cc406a70f34f93d330a3f0db6a.zip
frameworks_base-b5010cc3c33c74cc406a70f34f93d330a3f0db6a.tar.gz
frameworks_base-b5010cc3c33c74cc406a70f34f93d330a3f0db6a.tar.bz2
Add carrier/mcc factors to wifi-channel decision.
Uses ro.carrier and MCC when available to try to set (non-persistingly) the number of allowed wifi channels. Part of the fix for 1625953.
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl2
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java5
-rw-r--r--wifi/java/android/net/wifi/WifiStateTracker.java12
3 files changed, 14 insertions, 5 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 7c3af69..0db868e 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -58,7 +58,7 @@ interface IWifiManager
int getNumAllowedChannels();
- boolean setNumAllowedChannels(int numChannels);
+ boolean setNumAllowedChannels(int numChannels, boolean persist);
int[] getValidChannelCounts();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 1a7caef..141d53f 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -538,14 +538,15 @@ public class WifiManager {
* for some reason.
* @param numChannels the number of allowed channels. Must be greater than 0
* and less than or equal to 16.
+ * @param persist {@code true} if you want this remembered
* @return {@code true} if the operation succeeds, {@code false} otherwise, e.g.,
* {@code numChannels} is out of range.
*
* @hide pending API council
*/
- public boolean setNumAllowedChannels(int numChannels) {
+ public boolean setNumAllowedChannels(int numChannels, boolean persist) {
try {
- return mService.setNumAllowedChannels(numChannels);
+ return mService.setNumAllowedChannels(numChannels, persist);
} catch (RemoteException e) {
return false;
}
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 6771136..7ba124f 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -183,6 +183,10 @@ public class WifiStateTracker extends NetworkStateTracker {
private boolean mUseStaticIp = false;
private int mReconnectCount;
+ // used to store the (non-persisted) num determined during device boot
+ // (from mcc or other phone info) before the driver is started.
+ private int mNumAllowedChannels = 0;
+
// Variables relating to the 'available networks' notification
/**
@@ -571,9 +575,12 @@ public class WifiStateTracker extends NetworkStateTracker {
try {
return setNumAllowedChannels(
Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_NUM_ALLOWED_CHANNELS));
+ Settings.Secure.WIFI_NUM_ALLOWED_CHANNELS));
} catch (Settings.SettingNotFoundException e) {
- // if setting doesn't exist, stick with the driver default
+ if (mNumAllowedChannels != 0) {
+ WifiNative.setNumAllowedChannelsCommand(mNumAllowedChannels);
+ }
+ // otherwise, use the driver default
}
return true;
}
@@ -587,6 +594,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* {@code numChannels} is outside the valid range.
*/
public synchronized boolean setNumAllowedChannels(int numChannels) {
+ mNumAllowedChannels = numChannels;
return WifiNative.setNumAllowedChannelsCommand(numChannels);
}