blob: 8124b3b8e5c061260424b779b67d066e6a0979be [file] [log] [blame]
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08001/*
Chia-chi Yeh4e142112009-12-25 14:48:46 +08002 * Copyright (C) 2009 The Android Open Source Project
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -08003 *
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
17package com.android.settings;
18
Amith Yamasanid7993472010-08-18 13:59:28 -070019import android.app.Activity;
Wink Saville5d5a2692013-06-29 07:54:13 -070020import android.app.AlertDialog;
21import android.app.Dialog;
Amith Yamasanid7993472010-08-18 13:59:28 -070022import android.app.admin.DevicePolicyManager;
Amith Yamasanid7993472010-08-18 13:59:28 -070023import android.content.Context;
Wink Saville5d5a2692013-06-29 07:54:13 -070024import android.content.DialogInterface;
Amith Yamasanid7993472010-08-18 13:59:28 -070025import android.content.Intent;
Irfan Sheriff167d7182011-09-07 14:51:11 -070026import android.content.pm.PackageManager;
Wink Saville5d5a2692013-06-29 07:54:13 -070027import android.content.res.Resources;
Amith Yamasanid7993472010-08-18 13:59:28 -070028import android.net.ConnectivityManager;
Wink Saville5d5a2692013-06-29 07:54:13 -070029import android.net.NetworkInfo;
30import android.net.Uri;
Nick Pellya57eace2010-10-15 01:19:43 -070031import android.nfc.NfcAdapter;
Amith Yamasanid7993472010-08-18 13:59:28 -070032import android.os.Bundle;
Amith Yamasanid7993472010-08-18 13:59:28 -070033import android.os.SystemProperties;
Amith Yamasani9627a8e2012-09-23 12:54:14 -070034import android.os.UserHandle;
Amith Yamasanid7993472010-08-18 13:59:28 -070035import android.preference.CheckBoxPreference;
36import android.preference.Preference;
37import android.preference.PreferenceScreen;
38import android.provider.Settings;
Wink Saville5d5a2692013-06-29 07:54:13 -070039import android.telephony.TelephonyManager;
40import android.text.TextUtils;
41import android.util.Log;
Gilles Debunnee78c1872011-06-20 15:00:07 -070042import com.android.internal.telephony.TelephonyIntents;
43import com.android.internal.telephony.TelephonyProperties;
44import com.android.settings.nfc.NfcEnabler;
Irfan Sheriff536c3d72012-04-17 23:17:46 -070045import com.android.settings.NsdEnabler;
Gilles Debunnee78c1872011-06-20 15:00:07 -070046
Amith Yamasanid7993472010-08-18 13:59:28 -070047public class WirelessSettings extends SettingsPreferenceFragment {
Robert Greenwalt4929e912013-07-16 13:09:24 -070048 private static final String TAG = "WirelessSettings";
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080049
50 private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
Nick Pellyad50ba02010-09-22 10:55:13 -070051 private static final String KEY_TOGGLE_NFC = "toggle_nfc";
tk.mun7c5c1652011-10-13 22:56:18 +090052 private static final String KEY_WIMAX_SETTINGS = "wimax_settings";
Jeff Hamilton3d670de2011-09-21 16:44:36 -050053 private static final String KEY_ANDROID_BEAM_SETTINGS = "android_beam_settings";
Mike Lockwood83bcc982009-07-29 23:25:10 -070054 private static final String KEY_VPN_SETTINGS = "vpn_settings";
Robert Greenwaltc4764d22010-02-12 14:21:37 -080055 private static final String KEY_TETHER_SETTINGS = "tether_settings";
Oscar Montemayor05411892010-08-03 16:56:09 -070056 private static final String KEY_PROXY_SETTINGS = "proxy_settings";
Amith Yamasani0f85c482011-02-23 17:19:11 -080057 private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
Wink Saville5d5a2692013-06-29 07:54:13 -070058 private static final String KEY_MANAGE_MOBILE_PLAN = "manage_mobile_plan";
Irfan Sheriff536c3d72012-04-17 23:17:46 -070059 private static final String KEY_TOGGLE_NSD = "toggle_nsd"; //network service discovery
Jake Hambyef57ed72012-06-21 10:59:22 -070060 private static final String KEY_CELL_BROADCAST_SETTINGS = "cell_broadcast_settings";
Nick Pellyad50ba02010-09-22 10:55:13 -070061
Chouting Zhang71cc49e2009-08-28 14:36:35 -050062 public static final String EXIT_ECM_RESULT = "exit_ecm_result";
63 public static final int REQUEST_CODE_EXIT_ECM = 1;
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080064
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -080065 private AirplaneModeEnabler mAirplaneModeEnabler;
Chouting Zhang71cc49e2009-08-28 14:36:35 -050066 private CheckBoxPreference mAirplaneModePreference;
Nick Pellyad50ba02010-09-22 10:55:13 -070067 private NfcEnabler mNfcEnabler;
Martijn Coenenbb4bdc22011-07-27 17:31:41 -050068 private NfcAdapter mNfcAdapter;
Irfan Sheriff536c3d72012-04-17 23:17:46 -070069 private NsdEnabler mNsdEnabler;
Chouting Zhang71cc49e2009-08-28 14:36:35 -050070
Wink Saville5d5a2692013-06-29 07:54:13 -070071 private ConnectivityManager mCm;
72 private TelephonyManager mTm;
73
74 private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1;
75 private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";
76
Chouting Zhang71cc49e2009-08-28 14:36:35 -050077 /**
78 * Invoked on each preference click in this hierarchy, overrides
79 * PreferenceActivity's implementation. Used to make sure we track the
80 * preference click events.
81 */
82 @Override
83 public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
Wink Saville5d5a2692013-06-29 07:54:13 -070084 log("onPreferenceTreeClick: preference=" + preference);
Chia-chi Yeh4e142112009-12-25 14:48:46 +080085 if (preference == mAirplaneModePreference && Boolean.parseBoolean(
86 SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) {
Chouting Zhang71cc49e2009-08-28 14:36:35 -050087 // In ECM mode launch ECM app dialog
88 startActivityForResult(
89 new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null),
90 REQUEST_CODE_EXIT_ECM);
Chouting Zhang71cc49e2009-08-28 14:36:35 -050091 return true;
Wink Saville5d5a2692013-06-29 07:54:13 -070092 } else if (preference == findPreference(KEY_MANAGE_MOBILE_PLAN)) {
93 onManageMobilePlanClick();
Chouting Zhang71cc49e2009-08-28 14:36:35 -050094 }
Chia-chi Yeh4e142112009-12-25 14:48:46 +080095 // Let the intents be launched by the Preference manager
Amith Yamasanid7993472010-08-18 13:59:28 -070096 return super.onPreferenceTreeClick(preferenceScreen, preference);
Chouting Zhang71cc49e2009-08-28 14:36:35 -050097 }
Chia-chi Yehb90452f2010-01-13 06:11:29 +080098
Wink Saville5d5a2692013-06-29 07:54:13 -070099 private String mManageMobilePlanMessage;
100
101 public void onManageMobilePlanClick() {
102 log("onManageMobilePlanClick:");
103 mManageMobilePlanMessage = null;
104 Resources resources = getActivity().getResources();
105
106 NetworkInfo ni = mCm.getActiveNetworkInfo();
107 if (mTm.hasIccCard() && (ni != null)) {
108 // Get provisioning URL
Robert Greenwalt4929e912013-07-16 13:09:24 -0700109 String url = mCm.getMobileProvisioningUrl();
Wink Saville5d5a2692013-06-29 07:54:13 -0700110 if (!TextUtils.isEmpty(url)) {
111 // Send user to provisioning webpage
112 Intent intent = new Intent(Intent.ACTION_VIEW);
113 intent.setData(Uri.parse(url));
114 startActivity(intent);
115 mManageMobilePlanMessage = null;
116 } else {
117 // No provisioning URL
118 String operatorName = mTm.getSimOperatorName();
119 if (TextUtils.isEmpty(operatorName)) {
120 // Use NetworkOperatorName as second choice in case there is no
121 // SPN (Service Provider Name on the SIM). Such as with T-mobile.
122 operatorName = mTm.getNetworkOperatorName();
123 if (TextUtils.isEmpty(operatorName)) {
124 mManageMobilePlanMessage = resources.getString(
125 R.string.mobile_unknown_sim_operator);
126 } else {
127 mManageMobilePlanMessage = resources.getString(
128 R.string.mobile_no_provisioning_url, operatorName);
129 }
130 } else {
131 mManageMobilePlanMessage = resources.getString(
132 R.string.mobile_no_provisioning_url, operatorName);
133 }
134 }
135 } else if (mTm.hasIccCard() == false) {
136 // No sim card
137 mManageMobilePlanMessage = resources.getString(R.string.mobile_insert_sim_card);
138 } else {
139 // NetworkInfo is null, there is no connection
140 mManageMobilePlanMessage = resources.getString(R.string.mobile_connect_to_internet);
141 }
142 if (!TextUtils.isEmpty(mManageMobilePlanMessage)) {
143 log("onManageMobilePlanClick: message=" + mManageMobilePlanMessage);
144 showDialog(MANAGE_MOBILE_PLAN_DIALOG_ID);
145 }
146 }
147
Wink Saville5d5a2692013-06-29 07:54:13 -0700148 @Override
149 public Dialog onCreateDialog(int dialogId) {
150 log("onCreateDialog: dialogId=" + dialogId);
151 switch (dialogId) {
152 case MANAGE_MOBILE_PLAN_DIALOG_ID:
153 return new AlertDialog.Builder(getActivity())
154 .setMessage(mManageMobilePlanMessage)
155 .setCancelable(false)
156 .setPositiveButton(com.android.internal.R.string.ok,
157 new DialogInterface.OnClickListener() {
158 @Override
159 public void onClick(DialogInterface dialog, int id) {
160 log("MANAGE_MOBILE_PLAN_DIALOG.onClickListener id=" + id);
161 mManageMobilePlanMessage = null;
162 }
163 })
164 .create();
165 }
166 return super.onCreateDialog(dialogId);
167 }
168
169 private void log(String s) {
170 Log.d(TAG, s);
171 }
172
Chia-chi Yehb90452f2010-01-13 06:11:29 +0800173 public static boolean isRadioAllowed(Context context, String type) {
174 if (!AirplaneModeEnabler.isAirplaneModeOn(context)) {
175 return true;
176 }
177 // Here we use the same logic in onCreate().
Christopher Tate6a5929b2012-09-10 15:39:05 -0700178 String toggleable = Settings.Global.getString(context.getContentResolver(),
179 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
Chia-chi Yehb90452f2010-01-13 06:11:29 +0800180 return toggleable != null && toggleable.contains(type);
181 }
182
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800183 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700184 public void onCreate(Bundle savedInstanceState) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800185 super.onCreate(savedInstanceState);
Wink Saville5d5a2692013-06-29 07:54:13 -0700186 if (savedInstanceState != null) {
187 mManageMobilePlanMessage = savedInstanceState.getString(SAVED_MANAGE_MOBILE_PLAN_MSG);
188 }
189 log("onCreate: mManageMobilePlanMessage=" + mManageMobilePlanMessage);
190
191 mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
192 mTm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800193
194 addPreferencesFromResource(R.xml.wireless_settings);
195
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700196 final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER;
197
Amith Yamasanid7993472010-08-18 13:59:28 -0700198 final Activity activity = getActivity();
Gilles Debunnee78c1872011-06-20 15:00:07 -0700199 mAirplaneModePreference = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE);
Nick Pellyad50ba02010-09-22 10:55:13 -0700200 CheckBoxPreference nfc = (CheckBoxPreference) findPreference(KEY_TOGGLE_NFC);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500201 PreferenceScreen androidBeam = (PreferenceScreen) findPreference(KEY_ANDROID_BEAM_SETTINGS);
Irfan Sheriff536c3d72012-04-17 23:17:46 -0700202 CheckBoxPreference nsd = (CheckBoxPreference) findPreference(KEY_TOGGLE_NSD);
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800203
Gilles Debunnee78c1872011-06-20 15:00:07 -0700204 mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500205 mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam);
Irfan Sheriff936e3fa2012-05-07 15:51:37 -0700206
207 // Remove NSD checkbox by default
208 getPreferenceScreen().removePreference(nsd);
209 //mNsdEnabler = new NsdEnabler(activity, nsd);
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800210
Christopher Tate6a5929b2012-09-10 15:39:05 -0700211 String toggleable = Settings.Global.getString(activity.getContentResolver(),
212 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800213
tk.mun7c5c1652011-10-13 22:56:18 +0900214 //enable/disable wimax depending on the value in config.xml
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700215 boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
tk.mun7c5c1652011-10-13 22:56:18 +0900216 com.android.internal.R.bool.config_wimaxEnabled);
217 if (!isWimaxEnabled) {
218 PreferenceScreen root = getPreferenceScreen();
219 Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS);
220 if (ps != null) root.removePreference(ps);
221 } else {
Christopher Tate6a5929b2012-09-10 15:39:05 -0700222 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX )
tk.mun7c5c1652011-10-13 22:56:18 +0900223 && isWimaxEnabled) {
224 Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS);
225 ps.setDependency(KEY_TOGGLE_AIRPLANE);
226 }
227 }
Chia-chi Yehb90452f2010-01-13 06:11:29 +0800228 // Manually set dependencies for Wifi when not toggleable.
Christopher Tate6a5929b2012-09-10 15:39:05 -0700229 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) {
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800230 findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
231 }
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700232 if (isSecondaryUser) { // Disable VPN
233 removePreference(KEY_VPN_SETTINGS);
234 }
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800235
236 // Manually set dependencies for Bluetooth when not toggleable.
Christopher Tate6a5929b2012-09-10 15:39:05 -0700237 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_BLUETOOTH)) {
Gilles Debunnee78c1872011-06-20 15:00:07 -0700238 // No bluetooth-dependent items in the list. Code kept in case one is added later.
Nick Pellyad50ba02010-09-22 10:55:13 -0700239 }
240
Nick Pelly9894d4a2011-08-09 07:10:16 -0700241 // Manually set dependencies for NFC when not toggleable.
Christopher Tate6a5929b2012-09-10 15:39:05 -0700242 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_NFC)) {
Nick Pelly9894d4a2011-08-09 07:10:16 -0700243 findPreference(KEY_TOGGLE_NFC).setDependency(KEY_TOGGLE_AIRPLANE);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500244 findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
Nick Pelly9894d4a2011-08-09 07:10:16 -0700245 }
246
Nick Pellyad50ba02010-09-22 10:55:13 -0700247 // Remove NFC if its not available
Martijn Coenenbb4bdc22011-07-27 17:31:41 -0500248 mNfcAdapter = NfcAdapter.getDefaultAdapter(activity);
249 if (mNfcAdapter == null) {
Nick Pellyad50ba02010-09-22 10:55:13 -0700250 getPreferenceScreen().removePreference(nfc);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500251 getPreferenceScreen().removePreference(androidBeam);
Nick Pelly9894d4a2011-08-09 07:10:16 -0700252 mNfcEnabler = null;
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800253 }
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800254
Wink Saville5d5a2692013-06-29 07:54:13 -0700255 // Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device.
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700256 if (isSecondaryUser || Utils.isWifiOnly(getActivity())) {
257 removePreference(KEY_MOBILE_NETWORK_SETTINGS);
Wink Saville5d5a2692013-06-29 07:54:13 -0700258 removePreference(KEY_MANAGE_MOBILE_PLAN);
Amith Yamasani0f85c482011-02-23 17:19:11 -0800259 }
260
Oscar Montemayor05411892010-08-03 16:56:09 -0700261 // Enable Proxy selector settings if allowed.
262 Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
Amith Yamasanid7993472010-08-18 13:59:28 -0700263 DevicePolicyManager mDPM = (DevicePolicyManager)
264 activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
Robert Greenwalt6f3a98b2010-12-28 16:11:12 -0800265 // proxy UI disabled until we have better app support
266 getPreferenceScreen().removePreference(mGlobalProxy);
Oscar Montemayor05411892010-08-03 16:56:09 -0700267 mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
268
Amith Yamasani0f85c482011-02-23 17:19:11 -0800269 // Disable Tethering if it's not allowed or if it's a wifi-only device
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800270 ConnectivityManager cm =
Amith Yamasanid7993472010-08-18 13:59:28 -0700271 (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700272 if (isSecondaryUser || !cm.isTetheringSupported()) {
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800273 getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
Robert Greenwalte434bfb2010-05-08 15:20:24 -0700274 } else {
Robert Greenwalte434bfb2010-05-08 15:20:24 -0700275 Preference p = findPreference(KEY_TETHER_SETTINGS);
Jeff Sharkeya83a24f2011-09-16 01:52:39 -0700276 p.setTitle(Utils.getTetheringLabel(cm));
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800277 }
Jake Hambyef57ed72012-06-21 10:59:22 -0700278
279 // Enable link to CMAS app settings depending on the value in config.xml.
280 boolean isCellBroadcastAppLinkEnabled = this.getResources().getBoolean(
281 com.android.internal.R.bool.config_cellBroadcastAppLinks);
282 try {
283 if (isCellBroadcastAppLinkEnabled) {
284 PackageManager pm = getPackageManager();
285 if (pm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver")
286 == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
287 isCellBroadcastAppLinkEnabled = false; // CMAS app disabled
288 }
289 }
290 } catch (IllegalArgumentException ignored) {
291 isCellBroadcastAppLinkEnabled = false; // CMAS app not installed
292 }
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700293 if (isSecondaryUser || !isCellBroadcastAppLinkEnabled) {
Jake Hambyef57ed72012-06-21 10:59:22 -0700294 PreferenceScreen root = getPreferenceScreen();
295 Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS);
296 if (ps != null) root.removePreference(ps);
297 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800298 }
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800299
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800300 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700301 public void onResume() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800302 super.onResume();
Danica Chang32711b62010-08-10 18:41:29 -0700303
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800304 mAirplaneModeEnabler.resume();
Nick Pelly9894d4a2011-08-09 07:10:16 -0700305 if (mNfcEnabler != null) {
306 mNfcEnabler.resume();
Martijn Coenenbb4bdc22011-07-27 17:31:41 -0500307 }
Irfan Sheriff936e3fa2012-05-07 15:51:37 -0700308 if (mNsdEnabler != null) {
309 mNsdEnabler.resume();
310 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800311 }
Danica Chang32711b62010-08-10 18:41:29 -0700312
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800313 @Override
Wink Saville5d5a2692013-06-29 07:54:13 -0700314 public void onSaveInstanceState(Bundle outState) {
315 super.onSaveInstanceState(outState);
316
317 if (!TextUtils.isEmpty(mManageMobilePlanMessage)) {
318 outState.putString(SAVED_MANAGE_MOBILE_PLAN_MSG, mManageMobilePlanMessage);
319 }
320 }
321
322 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700323 public void onPause() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800324 super.onPause();
Danica Chang32711b62010-08-10 18:41:29 -0700325
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800326 mAirplaneModeEnabler.pause();
Nick Pelly9894d4a2011-08-09 07:10:16 -0700327 if (mNfcEnabler != null) {
328 mNfcEnabler.pause();
329 }
Irfan Sheriff936e3fa2012-05-07 15:51:37 -0700330 if (mNsdEnabler != null) {
331 mNsdEnabler.pause();
332 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800333 }
Danica Chang32711b62010-08-10 18:41:29 -0700334
Chouting Zhang71cc49e2009-08-28 14:36:35 -0500335 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700336 public void onActivityResult(int requestCode, int resultCode, Intent data) {
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800337 if (requestCode == REQUEST_CODE_EXIT_ECM) {
338 Boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false);
Chouting Zhang71cc49e2009-08-28 14:36:35 -0500339 // Set Airplane mode based on the return value and checkbox state
340 mAirplaneModeEnabler.setAirplaneModeInECM(isChoiceYes,
341 mAirplaneModePreference.isChecked());
Chouting Zhang71cc49e2009-08-28 14:36:35 -0500342 }
343 }
Amith Yamasanib0b37ae2012-04-23 15:35:36 -0700344
345 @Override
346 protected int getHelpResource() {
347 return R.string.help_url_more_networks;
348 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800349}