diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2009-05-20 11:28:04 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2009-05-20 11:28:04 -0700 |
commit | 843ef36f7b96cc19ea7d2996b7c8661b41ec3452 (patch) | |
tree | 560e1648c99a93986f8b7deef851ef8bb8029db7 /wifi | |
parent | 358d23017d0d6c4636eb7599ae7a9b48108899a3 (diff) | |
download | frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.zip frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.tar.gz frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.tar.bz2 |
donut snapshot
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/IWifiManager.aidl | 6 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 61 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateTracker.java | 14 |
3 files changed, 76 insertions, 5 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index f9a0845..00829d6 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -69,5 +69,11 @@ interface IWifiManager boolean acquireWifiLock(IBinder lock, int lockType, String tag); boolean releaseWifiLock(IBinder lock); + + boolean isWifiMulticastEnabled(); + + void enableWifiMulticast(IBinder binder, String tag); + + void disableWifiMulticast(); } diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index a51e88f..658a7b2 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -823,4 +823,65 @@ public class WifiManager { public WifiLock createWifiLock(String tag) { return new WifiLock(WIFI_MODE_FULL, tag); } + + /** + * Check multicast filter status. + * + * @return true if multicast packets are allowed. + * + * @hide pending API council approval + */ + public boolean isWifiMulticastEnabled() { + try { + return mService.isWifiMulticastEnabled(); + } catch (RemoteException e) { + return false; + } + } + + /** + * Turn on the reception of multicast packets. + * The default behavior is to disable multicast packets as they + * have a noticable negative effect on battery life. An + * application can turn them on, but should not leave it on for longer + * than needed. When the app quits (or crashes) its request will + * be reverted. + * + * @param tag a string associated with this request for debugging. + * + * @return true on success + * + * @see #disableWifiMulticast + * + * @hide pending API council approval + */ + public boolean enableWifiMulticast(String tag) { + try { + mService.enableWifiMulticast(new Binder(), tag); + return true; + } catch (RemoteException e) { + return false; + } + } + + /** + * Return to the default multicast-off setting. + * Note that if others had turned on Multicast reception, your + * call will not turn it back off - they must also turn off their + * request for multicast reception. + * + * @return true on success + * + * @see #enableWifiMulticast + * + * @hide pending API council approval + */ + public boolean disableWifiMulticast() { + try { + mService.disableWifiMulticast(); + 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 6ea35f5..64084cf 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -732,15 +732,19 @@ 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. Obviously, if we - * ever want to support multicast, this will have to change. + * 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. */ + mWM.enableWifiMulticast("WifiStateTracker"); + mWM.disableWifiMulticast(); + if (mBluetoothA2dp == null) { mBluetoothA2dp = new BluetoothA2dp(mContext); } - synchronized (this) { - WifiNative.startPacketFiltering(); - } checkIsBluetoothPlaying(); break; |