Merge change Ie2d155a5 into eclair-mr2

* changes:
  Add a new API for initing Wifi multicast filtering
This commit is contained in:
Android (Google) Code Review
2009-10-21 19:44:30 -04:00
4 changed files with 29 additions and 9 deletions

View File

@@ -1829,6 +1829,19 @@ public class WifiService extends IWifiManager.Stub {
}
}
public void initializeMulticastFiltering() {
enforceMulticastChangePermission();
synchronized (mMulticasters) {
// if anybody had requested filters be off, leave off
if (mMulticasters.size() != 0) {
return;
} else {
WifiNative.startPacketFiltering();
}
}
}
public void acquireMulticastLock(IBinder binder, String tag) {
enforceMulticastChangePermission();

View File

@@ -70,6 +70,8 @@ interface IWifiManager
boolean releaseWifiLock(IBinder lock);
void initializeMulticastFiltering();
boolean isMulticastEnabled();
void acquireMulticastLock(IBinder binder, String tag);

View File

@@ -1056,4 +1056,17 @@ public class WifiManager {
return false;
}
}
/**
* Initialize the multicast filtering to 'on'
* @hide no intent to publish
*/
public boolean initializeMulticastFiltering() {
try {
mService.initializeMulticastFiltering();
return true;
} catch (RemoteException e) {
return false;
}
}
}

View File

@@ -786,16 +786,8 @@ public class WifiStateTracker extends NetworkStateTracker {
* Filter out multicast packets. This saves battery power, since
* the CPU doesn't have to spend time processing packets that
* are going to end up being thrown away.
*
* Note that rather than turn this off directly, we use the
* public api - this keeps us all in sync - turn multicast on
* first and then off.. if nobody else wants it on it'll be
* off then and it's all synchronized within the API.
*/
WifiManager.MulticastLock l =
mWM.createMulticastLock("WifiStateTracker");
l.acquire();
l.release();
mWM.initializeMulticastFiltering();
if (mBluetoothA2dp == null) {
mBluetoothA2dp = new BluetoothA2dp(mContext);