diff options
author | Irfan Sheriff <isheriff@google.com> | 2011-09-11 19:59:01 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2011-09-11 22:56:17 -0700 |
commit | 616f3173e08ec6110cf5766c70f84c9e031fb7d7 (patch) | |
tree | 5acef71d3cf14d3031e87cba59d17824ac769e8e /wifi/java/android | |
parent | e00633e49a7136e14da8ce9938cf6a3333f28498 (diff) | |
download | frameworks_base-616f3173e08ec6110cf5766c70f84c9e031fb7d7.zip frameworks_base-616f3173e08ec6110cf5766c70f84c9e031fb7d7.tar.gz frameworks_base-616f3173e08ec6110cf5766c70f84c9e031fb7d7.tar.bz2 |
Emergency callback mode handling
For wifi, track ECM and shut down and restart when device
goes in ECM and out
For p2p, simply turn off when in ECM mode
Bug: 5185246
Change-Id: I5f5bf75fac3e27db1d7c412135c796f2b137263d
Diffstat (limited to 'wifi/java/android')
-rw-r--r-- | wifi/java/android/net/wifi/p2p/WifiP2pService.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index 2f7b927..fb2c134 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -61,6 +61,7 @@ import android.view.WindowManager; import android.widget.EditText; import com.android.internal.R; +import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.AsyncChannel; import com.android.internal.util.Protocol; import com.android.internal.util.State; @@ -134,6 +135,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub { /* Airplane mode changed */ private static final int AIRPLANE_MODE_CHANGED = BASE + 6; + /* Emergency callback mode */ + private static final int EMERGENCY_CALLBACK_MODE = BASE + 7; private final boolean mP2pSupported; private final String mDeviceType; @@ -172,6 +175,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub { IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); + filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); filter.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION); mContext.registerReceiver(new WifiStateReceiver(), filter); @@ -185,14 +189,19 @@ public class WifiP2pService extends IWifiP2pManager.Stub { private class WifiStateReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) { + String action = intent.getAction(); + if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) { mWifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_DISABLED); - } else if (intent.getAction().equals(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)) { + } else if (action.equals(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)) { mWifiApState = intent.getIntExtra(WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_DISABLED); - } else if (intent.getAction().equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) { + } else if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) { mP2pStateMachine.sendMessage(AIRPLANE_MODE_CHANGED); + } else if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) { + if (intent.getBooleanExtra("phoneinECMState", false) == true) { + mP2pStateMachine.sendMessage(EMERGENCY_CALLBACK_MODE); + } } } } @@ -361,6 +370,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub { case AIRPLANE_MODE_CHANGED: if (isAirplaneModeOn()) sendMessage(WifiP2pManager.DISABLE_P2P); break; + case EMERGENCY_CALLBACK_MODE: + sendMessage(WifiP2pManager.DISABLE_P2P); + break; // Ignore case WIFI_DISABLE_USER_ACCEPT: case WIFI_DISABLE_USER_REJECT: |