diff options
author | Robert Greenwalt <robdroid@android.com> | 2009-10-21 14:58:34 -0700 |
---|---|---|
committer | Robert Greenwalt <robdroid@android.com> | 2009-10-21 15:03:44 -0700 |
commit | e2d155a51e68694e17fa6e27d05c928215a5dbcf (patch) | |
tree | d092da97d68fc4adf8aa2536f452af3f8cd700b1 | |
parent | 3f9faf473712be7d6471913b921bf8a63ab3205d (diff) | |
download | frameworks_base-e2d155a51e68694e17fa6e27d05c928215a5dbcf.zip frameworks_base-e2d155a51e68694e17fa6e27d05c928215a5dbcf.tar.gz frameworks_base-e2d155a51e68694e17fa6e27d05c928215a5dbcf.tar.bz2 |
Add a new API for initing Wifi multicast filtering
Gets rid of the old method which generated Log noise.
bug: 1973855
-rw-r--r-- | services/java/com/android/server/WifiService.java | 13 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/IWifiManager.aidl | 2 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 13 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateTracker.java | 10 |
4 files changed, 29 insertions, 9 deletions
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 89d969d..370ee68 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -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(); diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 73dbb6f..f3738e3 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -70,6 +70,8 @@ interface IWifiManager boolean releaseWifiLock(IBinder lock); + void initializeMulticastFiltering(); + boolean isMulticastEnabled(); void acquireMulticastLock(IBinder binder, String tag); diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 27755ed..178f76e 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -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; + } + } } diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java index b7d3a6e..d8538ea 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -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); |