am a86f1ccc: Merge change Ie2d155a5 into eclair-mr2

Merge commit 'a86f1ccca0bf54f27c398b4dbb0f2f1ec7293315' into eclair-mr2-plus-aosp

* commit 'a86f1ccca0bf54f27c398b4dbb0f2f1ec7293315':
  Add a new API for initing Wifi multicast filtering
This commit is contained in:
Robert Greenwalt
2009-10-21 16:50:46 -07:00
committed by Android Git Automerger
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) { public void acquireMulticastLock(IBinder binder, String tag) {
enforceMulticastChangePermission(); enforceMulticastChangePermission();

View File

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

View File

@@ -1056,4 +1056,17 @@ public class WifiManager {
return false; 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 * Filter out multicast packets. This saves battery power, since
* the CPU doesn't have to spend time processing packets that * the CPU doesn't have to spend time processing packets that
* are going to end up being thrown away. * 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.initializeMulticastFiltering();
mWM.createMulticastLock("WifiStateTracker");
l.acquire();
l.release();
if (mBluetoothA2dp == null) { if (mBluetoothA2dp == null) {
mBluetoothA2dp = new BluetoothA2dp(mContext); mBluetoothA2dp = new BluetoothA2dp(mContext);