am 295eb97c: am 59610c04: cherry-pick d4f3958bde into Froyo
Merge commit '295eb97c7623105d6199fa91e58394e474a0abb1' into kraken
* commit '295eb97c7623105d6199fa91e58394e474a0abb1':
cherry-pick d4f3958bde into Froyo
This commit is contained in:
@@ -160,14 +160,15 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
// Wake lock used by other operations
|
// Wake lock used by other operations
|
||||||
private static PowerManager.WakeLock sWakeLock;
|
private static PowerManager.WakeLock sWakeLock;
|
||||||
|
|
||||||
private static final int MESSAGE_ENABLE_WIFI = 0;
|
private static final int MESSAGE_ENABLE_WIFI = 0;
|
||||||
private static final int MESSAGE_DISABLE_WIFI = 1;
|
private static final int MESSAGE_DISABLE_WIFI = 1;
|
||||||
private static final int MESSAGE_STOP_WIFI = 2;
|
private static final int MESSAGE_STOP_WIFI = 2;
|
||||||
private static final int MESSAGE_START_WIFI = 3;
|
private static final int MESSAGE_START_WIFI = 3;
|
||||||
private static final int MESSAGE_RELEASE_WAKELOCK = 4;
|
private static final int MESSAGE_RELEASE_WAKELOCK = 4;
|
||||||
private static final int MESSAGE_UPDATE_STATE = 5;
|
private static final int MESSAGE_UPDATE_STATE = 5;
|
||||||
private static final int MESSAGE_START_ACCESS_POINT = 6;
|
private static final int MESSAGE_START_ACCESS_POINT = 6;
|
||||||
private static final int MESSAGE_STOP_ACCESS_POINT = 7;
|
private static final int MESSAGE_STOP_ACCESS_POINT = 7;
|
||||||
|
private static final int MESSAGE_SET_CHANNELS = 8;
|
||||||
|
|
||||||
|
|
||||||
private final WifiHandler mWifiHandler;
|
private final WifiHandler mWifiHandler;
|
||||||
@@ -1542,6 +1543,7 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
Slog.i(TAG, "WifiService trying to setNumAllowed to "+numChannels+
|
Slog.i(TAG, "WifiService trying to setNumAllowed to "+numChannels+
|
||||||
" with persist set to "+persist);
|
" with persist set to "+persist);
|
||||||
enforceChangePermission();
|
enforceChangePermission();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate the argument. We'd like to let the Wi-Fi driver do this,
|
* Validate the argument. We'd like to let the Wi-Fi driver do this,
|
||||||
* but if Wi-Fi isn't currently enabled, that's not possible, and
|
* but if Wi-Fi isn't currently enabled, that's not possible, and
|
||||||
@@ -1559,13 +1561,28 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mWifiHandler == null) return false;
|
||||||
|
|
||||||
|
Message.obtain(mWifiHandler,
|
||||||
|
MESSAGE_SET_CHANNELS, numChannels, (persist ? 1 : 0)).sendToTarget();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the number of allowed radio frequency channels synchronously
|
||||||
|
* @param numChannels the number of allowed channels. Must be greater than 0
|
||||||
|
* and less than or equal to 16.
|
||||||
|
* @param persist {@code true} if the setting should be remembered.
|
||||||
|
* @return {@code true} if the operation succeeds, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
private boolean setNumAllowedChannelsBlocking(int numChannels, boolean persist) {
|
||||||
if (persist) {
|
if (persist) {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.WIFI_NUM_ALLOWED_CHANNELS,
|
Settings.Secure.WIFI_NUM_ALLOWED_CHANNELS,
|
||||||
numChannels);
|
numChannels);
|
||||||
}
|
}
|
||||||
mWifiStateTracker.setNumAllowedChannels(numChannels);
|
return mWifiStateTracker.setNumAllowedChannels(numChannels);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1904,6 +1921,11 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
(WifiConfiguration) msg.obj);
|
(WifiConfiguration) msg.obj);
|
||||||
sWakeLock.release();
|
sWakeLock.release();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MESSAGE_SET_CHANNELS:
|
||||||
|
setNumAllowedChannelsBlocking(msg.arg1, msg.arg2 == 1);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user