The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1 | /* |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 2 | * Copyright (C) 2009 The Android Open Source Project |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.settings; |
| 18 | |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 19 | import android.app.Activity; |
| 20 | import android.app.admin.DevicePolicyManager; |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 21 | import android.content.Context; |
| 22 | import android.content.Intent; |
| 23 | import android.net.ConnectivityManager; |
repo sync | b98463f | 2011-06-30 10:58:43 -0700 | [diff] [blame] | 24 | import android.net.wifi.p2p.WifiP2pManager; |
Nick Pelly | a57eace | 2010-10-15 01:19:43 -0700 | [diff] [blame] | 25 | import android.nfc.NfcAdapter; |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 26 | import android.os.Bundle; |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 27 | import android.os.SystemProperties; |
| 28 | import android.preference.CheckBoxPreference; |
| 29 | import android.preference.Preference; |
| 30 | import android.preference.PreferenceScreen; |
| 31 | import android.provider.Settings; |
repo sync | b98463f | 2011-06-30 10:58:43 -0700 | [diff] [blame] | 32 | import android.view.LayoutInflater; |
| 33 | import android.view.View; |
| 34 | import android.widget.Switch; |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 35 | |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 36 | import com.android.internal.telephony.TelephonyIntents; |
| 37 | import com.android.internal.telephony.TelephonyProperties; |
| 38 | import com.android.settings.nfc.NfcEnabler; |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 39 | import com.android.settings.wifi.p2p.WifiP2pEnabler; |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 40 | |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 41 | public class WirelessSettings extends SettingsPreferenceFragment { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 42 | |
| 43 | private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane"; |
Nick Pelly | ad50ba0 | 2010-09-22 10:55:13 -0700 | [diff] [blame] | 44 | private static final String KEY_TOGGLE_NFC = "toggle_nfc"; |
Nick Pelly | 0fb33ab | 2011-08-23 19:35:13 -0700 | [diff] [blame] | 45 | private static final String KEY_NDEF_PUSH_SETTINGS = "ndef_push_settings"; |
Mike Lockwood | 83bcc98 | 2009-07-29 23:25:10 -0700 | [diff] [blame] | 46 | private static final String KEY_VPN_SETTINGS = "vpn_settings"; |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 47 | private static final String KEY_TOGGLE_WIFI_P2P = "toggle_wifi_p2p"; |
repo sync | b98463f | 2011-06-30 10:58:43 -0700 | [diff] [blame] | 48 | private static final String KEY_WIFI_P2P_SETTINGS = "wifi_p2p_settings"; |
Robert Greenwalt | c4764d2 | 2010-02-12 14:21:37 -0800 | [diff] [blame] | 49 | private static final String KEY_TETHER_SETTINGS = "tether_settings"; |
Oscar Montemayor | 0541189 | 2010-08-03 16:56:09 -0700 | [diff] [blame] | 50 | private static final String KEY_PROXY_SETTINGS = "proxy_settings"; |
Amith Yamasani | 0f85c48 | 2011-02-23 17:19:11 -0800 | [diff] [blame] | 51 | private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings"; |
Nick Pelly | ad50ba0 | 2010-09-22 10:55:13 -0700 | [diff] [blame] | 52 | |
Irfan Sheriff | e964d57 | 2011-09-01 09:54:32 -0700 | [diff] [blame^] | 53 | private static final int WIFI_P2P_DEBUG = SystemProperties.getInt("ro.debuggable", 0); |
repo sync | 05e01be | 2011-08-16 21:39:55 -0700 | [diff] [blame] | 54 | |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 55 | public static final String EXIT_ECM_RESULT = "exit_ecm_result"; |
| 56 | public static final int REQUEST_CODE_EXIT_ECM = 1; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 57 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 58 | private AirplaneModeEnabler mAirplaneModeEnabler; |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 59 | private CheckBoxPreference mAirplaneModePreference; |
Nick Pelly | ad50ba0 | 2010-09-22 10:55:13 -0700 | [diff] [blame] | 60 | private NfcEnabler mNfcEnabler; |
Martijn Coenen | bb4bdc2 | 2011-07-27 17:31:41 -0500 | [diff] [blame] | 61 | private NfcAdapter mNfcAdapter; |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 62 | |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 63 | private WifiP2pEnabler mWifiP2pEnabler; |
| 64 | |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 65 | /** |
| 66 | * Invoked on each preference click in this hierarchy, overrides |
| 67 | * PreferenceActivity's implementation. Used to make sure we track the |
| 68 | * preference click events. |
| 69 | */ |
| 70 | @Override |
| 71 | public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 72 | if (preference == mAirplaneModePreference && Boolean.parseBoolean( |
| 73 | SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) { |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 74 | // In ECM mode launch ECM app dialog |
| 75 | startActivityForResult( |
| 76 | new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null), |
| 77 | REQUEST_CODE_EXIT_ECM); |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 78 | return true; |
| 79 | } |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 80 | // Let the intents be launched by the Preference manager |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 81 | return super.onPreferenceTreeClick(preferenceScreen, preference); |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 82 | } |
Chia-chi Yeh | b90452f | 2010-01-13 06:11:29 +0800 | [diff] [blame] | 83 | |
| 84 | public static boolean isRadioAllowed(Context context, String type) { |
| 85 | if (!AirplaneModeEnabler.isAirplaneModeOn(context)) { |
| 86 | return true; |
| 87 | } |
| 88 | // Here we use the same logic in onCreate(). |
| 89 | String toggleable = Settings.System.getString(context.getContentResolver(), |
| 90 | Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS); |
| 91 | return toggleable != null && toggleable.contains(type); |
| 92 | } |
| 93 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 94 | @Override |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 95 | public void onCreate(Bundle savedInstanceState) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 96 | super.onCreate(savedInstanceState); |
| 97 | |
| 98 | addPreferencesFromResource(R.xml.wireless_settings); |
| 99 | |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 100 | final Activity activity = getActivity(); |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 101 | mAirplaneModePreference = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE); |
Nick Pelly | ad50ba0 | 2010-09-22 10:55:13 -0700 | [diff] [blame] | 102 | CheckBoxPreference nfc = (CheckBoxPreference) findPreference(KEY_TOGGLE_NFC); |
Nick Pelly | 0fb33ab | 2011-08-23 19:35:13 -0700 | [diff] [blame] | 103 | PreferenceScreen ndefPush = (PreferenceScreen) findPreference(KEY_NDEF_PUSH_SETTINGS); |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 104 | |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 105 | CheckBoxPreference wifiP2p = (CheckBoxPreference) findPreference(KEY_TOGGLE_WIFI_P2P); |
| 106 | |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 107 | mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference); |
Nick Pelly | 0fb33ab | 2011-08-23 19:35:13 -0700 | [diff] [blame] | 108 | mNfcEnabler = new NfcEnabler(activity, nfc, ndefPush); |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 109 | |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 110 | String toggleable = Settings.System.getString(activity.getContentResolver(), |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 111 | Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS); |
| 112 | |
Chia-chi Yeh | b90452f | 2010-01-13 06:11:29 +0800 | [diff] [blame] | 113 | // Manually set dependencies for Wifi when not toggleable. |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 114 | if (toggleable == null || !toggleable.contains(Settings.System.RADIO_WIFI)) { |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 115 | findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); |
| 116 | } |
| 117 | |
| 118 | // Manually set dependencies for Bluetooth when not toggleable. |
| 119 | if (toggleable == null || !toggleable.contains(Settings.System.RADIO_BLUETOOTH)) { |
Gilles Debunne | e78c187 | 2011-06-20 15:00:07 -0700 | [diff] [blame] | 120 | // No bluetooth-dependent items in the list. Code kept in case one is added later. |
Nick Pelly | ad50ba0 | 2010-09-22 10:55:13 -0700 | [diff] [blame] | 121 | } |
| 122 | |
Nick Pelly | 9894d4a | 2011-08-09 07:10:16 -0700 | [diff] [blame] | 123 | // Manually set dependencies for NFC when not toggleable. |
| 124 | if (toggleable == null || !toggleable.contains(Settings.System.RADIO_NFC)) { |
| 125 | findPreference(KEY_TOGGLE_NFC).setDependency(KEY_TOGGLE_AIRPLANE); |
Nick Pelly | 0fb33ab | 2011-08-23 19:35:13 -0700 | [diff] [blame] | 126 | findPreference(KEY_NDEF_PUSH_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); |
Nick Pelly | 9894d4a | 2011-08-09 07:10:16 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Nick Pelly | ad50ba0 | 2010-09-22 10:55:13 -0700 | [diff] [blame] | 129 | // Remove NFC if its not available |
Martijn Coenen | bb4bdc2 | 2011-07-27 17:31:41 -0500 | [diff] [blame] | 130 | mNfcAdapter = NfcAdapter.getDefaultAdapter(activity); |
| 131 | if (mNfcAdapter == null) { |
Nick Pelly | ad50ba0 | 2010-09-22 10:55:13 -0700 | [diff] [blame] | 132 | getPreferenceScreen().removePreference(nfc); |
Nick Pelly | 0fb33ab | 2011-08-23 19:35:13 -0700 | [diff] [blame] | 133 | getPreferenceScreen().removePreference(ndefPush); |
Nick Pelly | 9894d4a | 2011-08-09 07:10:16 -0700 | [diff] [blame] | 134 | mNfcEnabler = null; |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 135 | } |
Robert Greenwalt | c4764d2 | 2010-02-12 14:21:37 -0800 | [diff] [blame] | 136 | |
Amith Yamasani | 0f85c48 | 2011-02-23 17:19:11 -0800 | [diff] [blame] | 137 | // Remove Mobile Network Settings if it's a wifi-only device. |
Robert Greenwalt | 8af88fb | 2011-08-31 11:17:47 -0700 | [diff] [blame] | 138 | if (Utils.isWifiOnly(getActivity())) { |
Amith Yamasani | 0f85c48 | 2011-02-23 17:19:11 -0800 | [diff] [blame] | 139 | getPreferenceScreen().removePreference(findPreference(KEY_MOBILE_NETWORK_SETTINGS)); |
| 140 | } |
| 141 | |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 142 | WifiP2pManager p2p = (WifiP2pManager) activity.getSystemService(Context.WIFI_P2P_SERVICE); |
| 143 | |
| 144 | if (!p2p.isP2pSupported()) { |
| 145 | getPreferenceScreen().removePreference(wifiP2p); |
Irfan Sheriff | e964d57 | 2011-09-01 09:54:32 -0700 | [diff] [blame^] | 146 | getPreferenceScreen().removePreference(findPreference(KEY_WIFI_P2P_SETTINGS)); |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 147 | } else { |
| 148 | mWifiP2pEnabler = new WifiP2pEnabler(activity, wifiP2p); |
Irfan Sheriff | e964d57 | 2011-09-01 09:54:32 -0700 | [diff] [blame^] | 149 | //Settings is used for debug alone |
| 150 | if (WIFI_P2P_DEBUG == 0) { |
| 151 | getPreferenceScreen().removePreference(findPreference(KEY_WIFI_P2P_SETTINGS)); |
| 152 | } |
repo sync | b98463f | 2011-06-30 10:58:43 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Oscar Montemayor | 0541189 | 2010-08-03 16:56:09 -0700 | [diff] [blame] | 155 | // Enable Proxy selector settings if allowed. |
| 156 | Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS); |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 157 | DevicePolicyManager mDPM = (DevicePolicyManager) |
| 158 | activity.getSystemService(Context.DEVICE_POLICY_SERVICE); |
Robert Greenwalt | 6f3a98b | 2010-12-28 16:11:12 -0800 | [diff] [blame] | 159 | // proxy UI disabled until we have better app support |
| 160 | getPreferenceScreen().removePreference(mGlobalProxy); |
Oscar Montemayor | 0541189 | 2010-08-03 16:56:09 -0700 | [diff] [blame] | 161 | mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null); |
| 162 | |
Amith Yamasani | 0f85c48 | 2011-02-23 17:19:11 -0800 | [diff] [blame] | 163 | // Disable Tethering if it's not allowed or if it's a wifi-only device |
Robert Greenwalt | c4764d2 | 2010-02-12 14:21:37 -0800 | [diff] [blame] | 164 | ConnectivityManager cm = |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 165 | (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); |
Robert Greenwalt | 4ad4b4f | 2011-02-25 17:25:38 -0800 | [diff] [blame] | 166 | if (!cm.isTetheringSupported()) { |
Robert Greenwalt | c4764d2 | 2010-02-12 14:21:37 -0800 | [diff] [blame] | 167 | getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS)); |
Robert Greenwalt | e434bfb | 2010-05-08 15:20:24 -0700 | [diff] [blame] | 168 | } else { |
| 169 | String[] usbRegexs = cm.getTetherableUsbRegexs(); |
| 170 | String[] wifiRegexs = cm.getTetherableWifiRegexs(); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 171 | String[] bluetoothRegexs = cm.getTetherableBluetoothRegexs(); |
| 172 | |
| 173 | boolean usbAvailable = usbRegexs.length != 0; |
| 174 | boolean wifiAvailable = wifiRegexs.length != 0; |
| 175 | boolean bluetoothAvailable = bluetoothRegexs.length != 0; |
| 176 | |
Robert Greenwalt | e434bfb | 2010-05-08 15:20:24 -0700 | [diff] [blame] | 177 | Preference p = findPreference(KEY_TETHER_SETTINGS); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 178 | if (wifiAvailable && usbAvailable && bluetoothAvailable) { |
| 179 | p.setTitle(R.string.tether_settings_title_all); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 180 | } else if (wifiAvailable && usbAvailable) { |
| 181 | p.setTitle(R.string.tether_settings_title_all); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 182 | } else if (wifiAvailable && bluetoothAvailable) { |
| 183 | p.setTitle(R.string.tether_settings_title_all); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 184 | } else if (wifiAvailable) { |
| 185 | p.setTitle(R.string.tether_settings_title_wifi); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 186 | } else if (usbAvailable && bluetoothAvailable) { |
| 187 | p.setTitle(R.string.tether_settings_title_usb_bluetooth); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 188 | } else if (usbAvailable) { |
Robert Greenwalt | e434bfb | 2010-05-08 15:20:24 -0700 | [diff] [blame] | 189 | p.setTitle(R.string.tether_settings_title_usb); |
Robert Greenwalt | e434bfb | 2010-05-08 15:20:24 -0700 | [diff] [blame] | 190 | } else { |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 191 | p.setTitle(R.string.tether_settings_title_bluetooth); |
Robert Greenwalt | e434bfb | 2010-05-08 15:20:24 -0700 | [diff] [blame] | 192 | } |
Robert Greenwalt | c4764d2 | 2010-02-12 14:21:37 -0800 | [diff] [blame] | 193 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 194 | } |
Robert Greenwalt | c4764d2 | 2010-02-12 14:21:37 -0800 | [diff] [blame] | 195 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 196 | @Override |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 197 | public void onResume() { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 198 | super.onResume(); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 199 | |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 200 | mAirplaneModeEnabler.resume(); |
Nick Pelly | 9894d4a | 2011-08-09 07:10:16 -0700 | [diff] [blame] | 201 | if (mNfcEnabler != null) { |
| 202 | mNfcEnabler.resume(); |
Martijn Coenen | bb4bdc2 | 2011-07-27 17:31:41 -0500 | [diff] [blame] | 203 | } |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 204 | |
| 205 | if (mWifiP2pEnabler != null) { |
| 206 | mWifiP2pEnabler.resume(); |
| 207 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 208 | } |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 209 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 210 | @Override |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 211 | public void onPause() { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 212 | super.onPause(); |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 213 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 214 | mAirplaneModeEnabler.pause(); |
Nick Pelly | 9894d4a | 2011-08-09 07:10:16 -0700 | [diff] [blame] | 215 | if (mNfcEnabler != null) { |
| 216 | mNfcEnabler.pause(); |
| 217 | } |
Irfan Sheriff | 1610a74 | 2011-08-31 11:51:17 -0700 | [diff] [blame] | 218 | |
| 219 | if (mWifiP2pEnabler != null) { |
| 220 | mWifiP2pEnabler.pause(); |
| 221 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 222 | } |
Danica Chang | 32711b6 | 2010-08-10 18:41:29 -0700 | [diff] [blame] | 223 | |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 224 | @Override |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 225 | public void onActivityResult(int requestCode, int resultCode, Intent data) { |
Chia-chi Yeh | 4e14211 | 2009-12-25 14:48:46 +0800 | [diff] [blame] | 226 | if (requestCode == REQUEST_CODE_EXIT_ECM) { |
| 227 | Boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false); |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 228 | // Set Airplane mode based on the return value and checkbox state |
| 229 | mAirplaneModeEnabler.setAirplaneModeInECM(isChoiceYes, |
| 230 | mAirplaneModePreference.isChecked()); |
Chouting Zhang | 71cc49e | 2009-08-28 14:36:35 -0500 | [diff] [blame] | 231 | } |
| 232 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 233 | } |