blob: fde70447f2969755de66c931b4ae570c2531caf8 [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 {
Wink Saville5d5a2692013-06-29 07:54:13 -070048 private static final String TAG = "WirelessSettiings";
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
109 String url = getProvisioningUrl();
110 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
148 private String getProvisioningUrl() {
149 String url = getActivity().getResources()
150 .getString(com.android.internal.R.string.mobile_provisioning_url);
151 log("getProvisioningUrl: mobile_provisioning_url=" + url);
152
153 // populate the iccid and imei in the provisioning url.
154 if (!TextUtils.isEmpty(url)) {
155 log("getProvisioningUrl: iccid=" + mTm.getSimSerialNumber()
156 + " imei=" + mTm.getDeviceId() + " phone number=" + mTm.getLine1Number());
157 url = String.format(url,
158 mTm.getSimSerialNumber() /* ICCID */,
159 mTm.getDeviceId() /* IMEI */,
160 mTm.getLine1Number() /* Phone number */);
161 }
162
163 log("getProvisioningUrl: url=" + url);
164 return url;
165 }
166
167 @Override
168 public Dialog onCreateDialog(int dialogId) {
169 log("onCreateDialog: dialogId=" + dialogId);
170 switch (dialogId) {
171 case MANAGE_MOBILE_PLAN_DIALOG_ID:
172 return new AlertDialog.Builder(getActivity())
173 .setMessage(mManageMobilePlanMessage)
174 .setCancelable(false)
175 .setPositiveButton(com.android.internal.R.string.ok,
176 new DialogInterface.OnClickListener() {
177 @Override
178 public void onClick(DialogInterface dialog, int id) {
179 log("MANAGE_MOBILE_PLAN_DIALOG.onClickListener id=" + id);
180 mManageMobilePlanMessage = null;
181 }
182 })
183 .create();
184 }
185 return super.onCreateDialog(dialogId);
186 }
187
188 private void log(String s) {
189 Log.d(TAG, s);
190 }
191
Chia-chi Yehb90452f2010-01-13 06:11:29 +0800192 public static boolean isRadioAllowed(Context context, String type) {
193 if (!AirplaneModeEnabler.isAirplaneModeOn(context)) {
194 return true;
195 }
196 // Here we use the same logic in onCreate().
Christopher Tate6a5929b2012-09-10 15:39:05 -0700197 String toggleable = Settings.Global.getString(context.getContentResolver(),
198 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
Chia-chi Yehb90452f2010-01-13 06:11:29 +0800199 return toggleable != null && toggleable.contains(type);
200 }
201
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800202 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700203 public void onCreate(Bundle savedInstanceState) {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800204 super.onCreate(savedInstanceState);
Wink Saville5d5a2692013-06-29 07:54:13 -0700205 if (savedInstanceState != null) {
206 mManageMobilePlanMessage = savedInstanceState.getString(SAVED_MANAGE_MOBILE_PLAN_MSG);
207 }
208 log("onCreate: mManageMobilePlanMessage=" + mManageMobilePlanMessage);
209
210 mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
211 mTm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800212
213 addPreferencesFromResource(R.xml.wireless_settings);
214
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700215 final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER;
216
Amith Yamasanid7993472010-08-18 13:59:28 -0700217 final Activity activity = getActivity();
Gilles Debunnee78c1872011-06-20 15:00:07 -0700218 mAirplaneModePreference = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE);
Nick Pellyad50ba02010-09-22 10:55:13 -0700219 CheckBoxPreference nfc = (CheckBoxPreference) findPreference(KEY_TOGGLE_NFC);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500220 PreferenceScreen androidBeam = (PreferenceScreen) findPreference(KEY_ANDROID_BEAM_SETTINGS);
Irfan Sheriff536c3d72012-04-17 23:17:46 -0700221 CheckBoxPreference nsd = (CheckBoxPreference) findPreference(KEY_TOGGLE_NSD);
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800222
Gilles Debunnee78c1872011-06-20 15:00:07 -0700223 mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500224 mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam);
Irfan Sheriff936e3fa2012-05-07 15:51:37 -0700225
226 // Remove NSD checkbox by default
227 getPreferenceScreen().removePreference(nsd);
228 //mNsdEnabler = new NsdEnabler(activity, nsd);
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800229
Christopher Tate6a5929b2012-09-10 15:39:05 -0700230 String toggleable = Settings.Global.getString(activity.getContentResolver(),
231 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800232
tk.mun7c5c1652011-10-13 22:56:18 +0900233 //enable/disable wimax depending on the value in config.xml
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700234 boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
tk.mun7c5c1652011-10-13 22:56:18 +0900235 com.android.internal.R.bool.config_wimaxEnabled);
236 if (!isWimaxEnabled) {
237 PreferenceScreen root = getPreferenceScreen();
238 Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS);
239 if (ps != null) root.removePreference(ps);
240 } else {
Christopher Tate6a5929b2012-09-10 15:39:05 -0700241 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX )
tk.mun7c5c1652011-10-13 22:56:18 +0900242 && isWimaxEnabled) {
243 Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS);
244 ps.setDependency(KEY_TOGGLE_AIRPLANE);
245 }
246 }
Chia-chi Yehb90452f2010-01-13 06:11:29 +0800247 // Manually set dependencies for Wifi when not toggleable.
Christopher Tate6a5929b2012-09-10 15:39:05 -0700248 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) {
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800249 findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
250 }
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700251 if (isSecondaryUser) { // Disable VPN
252 removePreference(KEY_VPN_SETTINGS);
253 }
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800254
255 // Manually set dependencies for Bluetooth when not toggleable.
Christopher Tate6a5929b2012-09-10 15:39:05 -0700256 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_BLUETOOTH)) {
Gilles Debunnee78c1872011-06-20 15:00:07 -0700257 // No bluetooth-dependent items in the list. Code kept in case one is added later.
Nick Pellyad50ba02010-09-22 10:55:13 -0700258 }
259
Nick Pelly9894d4a2011-08-09 07:10:16 -0700260 // Manually set dependencies for NFC when not toggleable.
Christopher Tate6a5929b2012-09-10 15:39:05 -0700261 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_NFC)) {
Nick Pelly9894d4a2011-08-09 07:10:16 -0700262 findPreference(KEY_TOGGLE_NFC).setDependency(KEY_TOGGLE_AIRPLANE);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500263 findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
Nick Pelly9894d4a2011-08-09 07:10:16 -0700264 }
265
Nick Pellyad50ba02010-09-22 10:55:13 -0700266 // Remove NFC if its not available
Martijn Coenenbb4bdc22011-07-27 17:31:41 -0500267 mNfcAdapter = NfcAdapter.getDefaultAdapter(activity);
268 if (mNfcAdapter == null) {
Nick Pellyad50ba02010-09-22 10:55:13 -0700269 getPreferenceScreen().removePreference(nfc);
Jeff Hamilton3d670de2011-09-21 16:44:36 -0500270 getPreferenceScreen().removePreference(androidBeam);
Nick Pelly9894d4a2011-08-09 07:10:16 -0700271 mNfcEnabler = null;
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800272 }
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800273
Wink Saville5d5a2692013-06-29 07:54:13 -0700274 // Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device.
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700275 if (isSecondaryUser || Utils.isWifiOnly(getActivity())) {
276 removePreference(KEY_MOBILE_NETWORK_SETTINGS);
Wink Saville5d5a2692013-06-29 07:54:13 -0700277 removePreference(KEY_MANAGE_MOBILE_PLAN);
Amith Yamasani0f85c482011-02-23 17:19:11 -0800278 }
279
Oscar Montemayor05411892010-08-03 16:56:09 -0700280 // Enable Proxy selector settings if allowed.
281 Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
Amith Yamasanid7993472010-08-18 13:59:28 -0700282 DevicePolicyManager mDPM = (DevicePolicyManager)
283 activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
Robert Greenwalt6f3a98b2010-12-28 16:11:12 -0800284 // proxy UI disabled until we have better app support
285 getPreferenceScreen().removePreference(mGlobalProxy);
Oscar Montemayor05411892010-08-03 16:56:09 -0700286 mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
287
Amith Yamasani0f85c482011-02-23 17:19:11 -0800288 // Disable Tethering if it's not allowed or if it's a wifi-only device
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800289 ConnectivityManager cm =
Amith Yamasanid7993472010-08-18 13:59:28 -0700290 (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700291 if (isSecondaryUser || !cm.isTetheringSupported()) {
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800292 getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
Robert Greenwalte434bfb2010-05-08 15:20:24 -0700293 } else {
Robert Greenwalte434bfb2010-05-08 15:20:24 -0700294 Preference p = findPreference(KEY_TETHER_SETTINGS);
Jeff Sharkeya83a24f2011-09-16 01:52:39 -0700295 p.setTitle(Utils.getTetheringLabel(cm));
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800296 }
Jake Hambyef57ed72012-06-21 10:59:22 -0700297
298 // Enable link to CMAS app settings depending on the value in config.xml.
299 boolean isCellBroadcastAppLinkEnabled = this.getResources().getBoolean(
300 com.android.internal.R.bool.config_cellBroadcastAppLinks);
301 try {
302 if (isCellBroadcastAppLinkEnabled) {
303 PackageManager pm = getPackageManager();
304 if (pm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver")
305 == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
306 isCellBroadcastAppLinkEnabled = false; // CMAS app disabled
307 }
308 }
309 } catch (IllegalArgumentException ignored) {
310 isCellBroadcastAppLinkEnabled = false; // CMAS app not installed
311 }
Amith Yamasani9627a8e2012-09-23 12:54:14 -0700312 if (isSecondaryUser || !isCellBroadcastAppLinkEnabled) {
Jake Hambyef57ed72012-06-21 10:59:22 -0700313 PreferenceScreen root = getPreferenceScreen();
314 Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS);
315 if (ps != null) root.removePreference(ps);
316 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800317 }
Robert Greenwaltc4764d22010-02-12 14:21:37 -0800318
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800319 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700320 public void onResume() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800321 super.onResume();
Danica Chang32711b62010-08-10 18:41:29 -0700322
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800323 mAirplaneModeEnabler.resume();
Nick Pelly9894d4a2011-08-09 07:10:16 -0700324 if (mNfcEnabler != null) {
325 mNfcEnabler.resume();
Martijn Coenenbb4bdc22011-07-27 17:31:41 -0500326 }
Irfan Sheriff936e3fa2012-05-07 15:51:37 -0700327 if (mNsdEnabler != null) {
328 mNsdEnabler.resume();
329 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800330 }
Danica Chang32711b62010-08-10 18:41:29 -0700331
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800332 @Override
Wink Saville5d5a2692013-06-29 07:54:13 -0700333 public void onSaveInstanceState(Bundle outState) {
334 super.onSaveInstanceState(outState);
335
336 if (!TextUtils.isEmpty(mManageMobilePlanMessage)) {
337 outState.putString(SAVED_MANAGE_MOBILE_PLAN_MSG, mManageMobilePlanMessage);
338 }
339 }
340
341 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700342 public void onPause() {
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800343 super.onPause();
Danica Chang32711b62010-08-10 18:41:29 -0700344
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800345 mAirplaneModeEnabler.pause();
Nick Pelly9894d4a2011-08-09 07:10:16 -0700346 if (mNfcEnabler != null) {
347 mNfcEnabler.pause();
348 }
Irfan Sheriff936e3fa2012-05-07 15:51:37 -0700349 if (mNsdEnabler != null) {
350 mNsdEnabler.pause();
351 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800352 }
Danica Chang32711b62010-08-10 18:41:29 -0700353
Chouting Zhang71cc49e2009-08-28 14:36:35 -0500354 @Override
Amith Yamasanid7993472010-08-18 13:59:28 -0700355 public void onActivityResult(int requestCode, int resultCode, Intent data) {
Chia-chi Yeh4e142112009-12-25 14:48:46 +0800356 if (requestCode == REQUEST_CODE_EXIT_ECM) {
357 Boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false);
Chouting Zhang71cc49e2009-08-28 14:36:35 -0500358 // Set Airplane mode based on the return value and checkbox state
359 mAirplaneModeEnabler.setAirplaneModeInECM(isChoiceYes,
360 mAirplaneModePreference.isChecked());
Chouting Zhang71cc49e2009-08-28 14:36:35 -0500361 }
362 }
Amith Yamasanib0b37ae2012-04-23 15:35:36 -0700363
364 @Override
365 protected int getHelpResource() {
366 return R.string.help_url_more_networks;
367 }
The Android Open Source Projectafc4ab22009-03-03 19:32:34 -0800368}