blob: ccbb4d082bfb217f799ecc8fa3673717ede7d256 [file] [log] [blame]
Santos Cordon7d4ddf62013-07-10 11:58:08 -07001/*
2 * Copyright (C) 2006 The Android Open Source Project
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
17package com.android.phone;
18
19import android.app.Activity;
20import android.app.KeyguardManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070021import android.app.ProgressDialog;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070022import android.content.BroadcastReceiver;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070023import android.content.ContentResolver;
24import android.content.Context;
25import android.content.ContextWrapper;
26import android.content.Intent;
27import android.content.IntentFilter;
Youming Ye47a6adc2018-11-19 15:33:36 -080028import android.content.res.XmlResourceParser;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070029import android.media.AudioManager;
Santos Cordone18902f2016-03-22 17:16:04 -070030import android.net.ConnectivityManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070031import android.net.Uri;
Brad Ebinger533c6c12017-08-02 11:38:48 -070032import android.net.sip.SipManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070033import android.os.AsyncResult;
Junda Liu605148f2015-04-28 15:23:40 -070034import android.os.Bundle;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070035import android.os.Handler;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070036import android.os.Message;
Jonathan Basseric31f1f32015-05-12 10:13:03 -070037import android.os.PersistableBundle;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070038import android.os.PowerManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070039import android.os.SystemClock;
40import android.os.SystemProperties;
41import android.os.UpdateLock;
Brad Ebinger3fa43462016-04-12 16:06:48 -070042import android.os.UserManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070043import android.preference.PreferenceManager;
Sanket Padawe4c699232016-02-09 11:07:22 -080044import android.provider.Settings;
Tyler Gunn900d8fd2018-09-21 09:22:12 -070045import android.telecom.TelecomManager;
Junda Liu12f7d802015-05-01 12:06:44 -070046import android.telephony.CarrierConfigManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070047import android.telephony.ServiceState;
Andrew Lee385019f2014-11-24 14:19:50 -080048import android.telephony.SubscriptionManager;
Jack Yu1a2fc352017-07-14 17:14:37 -070049import android.telephony.TelephonyManager;
Jack Yu311536f2018-11-26 11:20:48 -080050import android.telephony.data.ApnSetting;
Jack Yu1a2fc352017-07-14 17:14:37 -070051import android.util.LocalLog;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070052import android.util.Log;
Santos Cordone18902f2016-03-22 17:16:04 -070053import android.widget.Toast;
Ta-wei Yenb29425b2016-09-21 17:28:14 -070054
Santos Cordon7d4ddf62013-07-10 11:58:08 -070055import com.android.internal.telephony.CallManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070056import com.android.internal.telephony.IccCardConstants;
57import com.android.internal.telephony.MmiCode;
58import com.android.internal.telephony.Phone;
59import com.android.internal.telephony.PhoneConstants;
60import com.android.internal.telephony.PhoneFactory;
Jack Yu1a2fc352017-07-14 17:14:37 -070061import com.android.internal.telephony.SettingsObserver;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070062import com.android.internal.telephony.TelephonyCapabilities;
Youming Ye47a6adc2018-11-19 15:33:36 -080063import com.android.internal.telephony.TelephonyComponentFactory;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070064import com.android.internal.telephony.TelephonyIntents;
Jack Yu1a2fc352017-07-14 17:14:37 -070065import com.android.internal.telephony.dataconnection.DataConnectionReasons;
66import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataDisallowedReasonType;
67import com.android.internal.util.IndentingPrintWriter;
Andrew Leefb7f92e2015-02-26 16:23:32 -080068import com.android.phone.settings.SettingsConstants;
Ta-wei Yenf0a71bc2017-05-17 12:28:28 -070069import com.android.phone.vvm.CarrierVvmPackageInstalledReceiver;
Brad Ebinger28626122017-08-10 14:13:35 -070070import com.android.services.telephony.sip.SipAccountRegistry;
Brad Ebinger3fa43462016-04-12 16:06:48 -070071import com.android.services.telephony.sip.SipUtil;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070072
Jack Yu1a2fc352017-07-14 17:14:37 -070073import java.io.FileDescriptor;
74import java.io.PrintWriter;
75
Santos Cordon7d4ddf62013-07-10 11:58:08 -070076/**
77 * Global state for the telephony subsystem when running in the primary
78 * phone process.
79 */
Sailesh Nepalbf900542014-07-15 16:18:32 -070080public class PhoneGlobals extends ContextWrapper {
Jack Yu1a2fc352017-07-14 17:14:37 -070081 public static final String LOG_TAG = "PhoneGlobals";
Santos Cordon7d4ddf62013-07-10 11:58:08 -070082
83 /**
84 * Phone app-wide debug level:
85 * 0 - no debug logging
86 * 1 - normal debug logging if ro.debuggable is set (which is true in
87 * "eng" and "userdebug" builds but not "user" builds)
88 * 2 - ultra-verbose debug logging
89 *
90 * Most individual classes in the phone app have a local DBG constant,
91 * typically set to
92 * (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1)
93 * or else
94 * (PhoneApp.DBG_LEVEL >= 2)
95 * depending on the desired verbosity.
96 *
97 * ***** DO NOT SUBMIT WITH DBG_LEVEL > 0 *************
98 */
Andrew Lee88b51e22014-10-29 15:48:51 -070099 public static final int DBG_LEVEL = 0;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700100
101 private static final boolean DBG =
102 (PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
103 private static final boolean VDBG = (PhoneGlobals.DBG_LEVEL >= 2);
104
105 // Message codes; see mHandler below.
106 private static final int EVENT_SIM_NETWORK_LOCKED = 3;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700107 private static final int EVENT_SIM_STATE_CHANGED = 8;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700108 private static final int EVENT_DATA_ROAMING_DISCONNECTED = 10;
109 private static final int EVENT_DATA_ROAMING_OK = 11;
110 private static final int EVENT_UNSOL_CDMA_INFO_RECORD = 12;
Brad Ebinger3fa43462016-04-12 16:06:48 -0700111 private static final int EVENT_RESTART_SIP = 13;
Jack Yu1a2fc352017-07-14 17:14:37 -0700112 private static final int EVENT_DATA_ROAMING_SETTINGS_CHANGED = 14;
113 private static final int EVENT_MOBILE_DATA_SETTINGS_CHANGED = 15;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700114
115 // The MMI codes are also used by the InCallScreen.
116 public static final int MMI_INITIATE = 51;
117 public static final int MMI_COMPLETE = 52;
118 public static final int MMI_CANCEL = 53;
119 // Don't use message codes larger than 99 here; those are reserved for
120 // the individual Activities of the Phone UI.
121
Santos Cordone18902f2016-03-22 17:16:04 -0700122 public static final int AIRPLANE_ON = 1;
123 public static final int AIRPLANE_OFF = 0;
124
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700125 /**
126 * Allowable values for the wake lock code.
127 * SLEEP means the device can be put to sleep.
128 * PARTIAL means wake the processor, but we display can be kept off.
129 * FULL means wake both the processor and the display.
130 */
131 public enum WakeState {
132 SLEEP,
133 PARTIAL,
134 FULL
135 }
136
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700137 private static PhoneGlobals sMe;
138
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700139 CallManager mCM;
Santos Cordon63a84242013-07-23 13:32:52 -0700140 CallNotifier notifier;
141 CallerInfoCache callerInfoCache;
Santos Cordon63a84242013-07-23 13:32:52 -0700142 NotificationMgr notificationMgr;
Andrew Lee9431b832015-03-09 18:46:45 -0700143 public PhoneInterfaceManager phoneMgr;
Jonathan Basseri6465afd2015-02-25 13:05:57 -0800144 CarrierConfigLoader configLoader;
Santos Cordon63a84242013-07-23 13:32:52 -0700145
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530146 private Phone phoneInEcm;
Santos Cordon63a84242013-07-23 13:32:52 -0700147
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700148 static boolean sVoiceCapable = true;
149
Santos Cordonc593d002015-06-03 15:41:15 -0700150 // TODO: Remove, no longer used.
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700151 CdmaPhoneCallState cdmaPhoneCallState;
152
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700153 // The currently-active PUK entry activity and progress dialog.
154 // Normally, these are the Emergency Dialer and the subsequent
155 // progress dialog. null if there is are no such objects in
156 // the foreground.
157 private Activity mPUKEntryActivity;
158 private ProgressDialog mPUKEntryProgressDialog;
159
Jack Yu1a2fc352017-07-14 17:14:37 -0700160 private boolean mNoDataDueToRoaming = false;
Jack Yu953f9352017-05-18 14:41:06 -0700161
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700162 private WakeState mWakeState = WakeState.SLEEP;
163
164 private PowerManager mPowerManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700165 private PowerManager.WakeLock mWakeLock;
166 private PowerManager.WakeLock mPartialWakeLock;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700167 private KeyguardManager mKeyguardManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700168
169 private UpdateLock mUpdateLock;
170
Jack Yu1a2fc352017-07-14 17:14:37 -0700171 private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
172 private final LocalLog mDataRoamingNotifLog = new LocalLog(50);
173
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700174 // Broadcast receiver for various intent broadcasts (see onCreate())
175 private final BroadcastReceiver mReceiver = new PhoneAppBroadcastReceiver();
Brad Ebinger533c6c12017-08-02 11:38:48 -0700176 // Broadcast receiver for SIP based intents (see onCreate())
Brad Ebinger28626122017-08-10 14:13:35 -0700177 private final SipReceiver mSipReceiver = new SipReceiver();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700178
Ta-wei Yenf0a71bc2017-05-17 12:28:28 -0700179 private final CarrierVvmPackageInstalledReceiver mCarrierVvmPackageInstalledReceiver =
180 new CarrierVvmPackageInstalledReceiver();
181
Jack Yu1a2fc352017-07-14 17:14:37 -0700182 private final SettingsObserver mSettingsObserver;
183
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700184 Handler mHandler = new Handler() {
185 @Override
186 public void handleMessage(Message msg) {
187 PhoneConstants.State phoneState;
Jack Yu1a2fc352017-07-14 17:14:37 -0700188 if (VDBG) Log.v(LOG_TAG, "event=" + msg.what);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700189 switch (msg.what) {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700190 // TODO: This event should be handled by the lock screen, just
191 // like the "SIM missing" and "Sim locked" cases (bug 1804111).
192 case EVENT_SIM_NETWORK_LOCKED:
Jonathan Basseri9504c6b2015-06-04 14:23:32 -0700193 if (getCarrierConfig().getBoolean(
194 CarrierConfigManager.KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL)) {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700195 // Some products don't have the concept of a "SIM network lock"
196 Log.i(LOG_TAG, "Ignoring EVENT_SIM_NETWORK_LOCKED event; "
Eric Erfanian945409f2018-02-21 19:26:15 +0000197 + "not showing 'SIM network unlock' PIN entry screen");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700198 } else {
199 // Normal case: show the "SIM network unlock" PIN entry screen.
200 // The user won't be able to do anything else until
201 // they enter a valid SIM network PIN.
202 Log.i(LOG_TAG, "show sim depersonal panel");
Biljana Maneva96291112018-01-30 13:12:59 +0800203 Phone phone = (Phone) ((AsyncResult) msg.obj).userObj;
204 IccNetworkDepersonalizationPanel.showDialog(phone);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700205 }
206 break;
207
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700208 case EVENT_DATA_ROAMING_DISCONNECTED:
Pengquan Meng8783d932017-10-16 14:57:40 -0700209 notificationMgr.showDataDisconnectedRoaming(msg.arg1);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700210 break;
211
212 case EVENT_DATA_ROAMING_OK:
213 notificationMgr.hideDataDisconnectedRoaming();
214 break;
215
216 case MMI_COMPLETE:
217 onMMIComplete((AsyncResult) msg.obj);
218 break;
219
220 case MMI_CANCEL:
Stuart Scottdcf40a92014-12-09 10:45:01 -0800221 PhoneUtils.cancelMmiCode(mCM.getFgPhone());
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700222 break;
223
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700224 case EVENT_SIM_STATE_CHANGED:
225 // Marks the event where the SIM goes into ready state.
226 // Right now, this is only used for the PUK-unlocking
227 // process.
228 if (msg.obj.equals(IccCardConstants.INTENT_VALUE_ICC_READY)) {
229 // when the right event is triggered and there
230 // are UI objects in the foreground, we close
231 // them to display the lock panel.
232 if (mPUKEntryActivity != null) {
233 mPUKEntryActivity.finish();
234 mPUKEntryActivity = null;
235 }
236 if (mPUKEntryProgressDialog != null) {
237 mPUKEntryProgressDialog.dismiss();
238 mPUKEntryProgressDialog = null;
239 }
240 }
241 break;
242
243 case EVENT_UNSOL_CDMA_INFO_RECORD:
244 //TODO: handle message here;
245 break;
Brad Ebinger3fa43462016-04-12 16:06:48 -0700246 case EVENT_RESTART_SIP:
247 // This should only run if the Phone process crashed and was restarted. We do
248 // not want this running if the device is still in the FBE encrypted state.
Brad Ebinger28626122017-08-10 14:13:35 -0700249 // This is the same procedure that is triggered in the SipIncomingCallReceiver
Brad Ebinger3fa43462016-04-12 16:06:48 -0700250 // upon BOOT_COMPLETED.
251 UserManager userManager = UserManager.get(sMe);
252 if (userManager != null && userManager.isUserUnlocked()) {
253 SipUtil.startSipService();
254 }
255 break;
Jack Yu1a2fc352017-07-14 17:14:37 -0700256 case EVENT_DATA_ROAMING_SETTINGS_CHANGED:
257 case EVENT_MOBILE_DATA_SETTINGS_CHANGED:
258 updateDataRoamingStatus();
259 break;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700260 }
261 }
262 };
263
264 public PhoneGlobals(Context context) {
265 super(context);
266 sMe = this;
Jack Yu1a2fc352017-07-14 17:14:37 -0700267 mSettingsObserver = new SettingsObserver(context, mHandler);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700268 }
269
270 public void onCreate() {
271 if (VDBG) Log.v(LOG_TAG, "onCreate()...");
272
273 ContentResolver resolver = getContentResolver();
274
275 // Cache the "voice capable" flag.
276 // This flag currently comes from a resource (which is
277 // overrideable on a per-product basis):
278 sVoiceCapable =
279 getResources().getBoolean(com.android.internal.R.bool.config_voice_capable);
280 // ...but this might eventually become a PackageManager "system
281 // feature" instead, in which case we'd do something like:
282 // sVoiceCapable =
283 // getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_VOICE_CALLS);
284
Stuart Scottdcf40a92014-12-09 10:45:01 -0800285 if (mCM == null) {
Youming Ye47a6adc2018-11-19 15:33:36 -0800286 // Inject telephony component factory if configured using other jars.
287 XmlResourceParser parser = getResources().getXml(R.xml.telephony_injection);
288 TelephonyComponentFactory.getInstance().injectTheComponentFactory(parser);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700289 // Initialize the telephony framework
290 PhoneFactory.makeDefaultPhones(this);
291
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700292 // Start TelephonyDebugService After the default phone is created.
293 Intent intent = new Intent(this, TelephonyDebugService.class);
294 startService(intent);
295
296 mCM = CallManager.getInstance();
Stuart Scottdcf40a92014-12-09 10:45:01 -0800297 for (Phone phone : PhoneFactory.getPhones()) {
298 mCM.registerPhone(phone);
Stuart Scottdcf40a92014-12-09 10:45:01 -0800299 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700300
301 // Create the NotificationMgr singleton, which is used to display
302 // status bar icons and control other status bar behavior.
303 notificationMgr = NotificationMgr.init(this);
304
Brad Ebinger3fa43462016-04-12 16:06:48 -0700305 // If PhoneGlobals has crashed and is being restarted, then restart.
306 mHandler.sendEmptyMessage(EVENT_RESTART_SIP);
307
Anthony Lee03ebdfc2015-07-27 08:12:02 -0700308 // Create an instance of CdmaPhoneCallState and initialize it to IDLE
309 cdmaPhoneCallState = new CdmaPhoneCallState();
310 cdmaPhoneCallState.CdmaPhoneCallStateInit();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700311
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700312 // before registering for phone state changes
313 mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
314 mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, LOG_TAG);
315 // lock used to keep the processor awake, when we don't care for the display.
316 mPartialWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK
317 | PowerManager.ON_AFTER_RELEASE, LOG_TAG);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700318
319 mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
320
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700321 // Get UpdateLock to suppress system-update related events (e.g. dialog show-up)
322 // during phone calls.
323 mUpdateLock = new UpdateLock("phone");
324
325 if (DBG) Log.d(LOG_TAG, "onCreate: mUpdateLock: " + mUpdateLock);
326
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700327 // Create the CallerInfoCache singleton, which remembers custom ring tone and
328 // send-to-voicemail settings.
329 //
330 // The asynchronous caching will start just after this call.
331 callerInfoCache = CallerInfoCache.init(this);
332
Nazanin Bakhshi2f2cc692018-12-11 15:15:39 -0800333 phoneMgr = PhoneInterfaceManager.init(this);
Santos Cordon406c0342013-08-28 00:07:47 -0700334
Jonathan Basseri6465afd2015-02-25 13:05:57 -0800335 configLoader = CarrierConfigLoader.init(this);
336
Jack Yu1a2fc352017-07-14 17:14:37 -0700337 // Create the CallNotifier singleton, which handles
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700338 // asynchronous events from the telephony layer (like
339 // launching the incoming-call UI when an incoming call comes
340 // in.)
Brad Ebingera9c6b6d2016-01-07 17:24:16 -0800341 notifier = CallNotifier.init(this);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700342
Stuart Scottdcf40a92014-12-09 10:45:01 -0800343 PhoneUtils.registerIccStatus(mHandler, EVENT_SIM_NETWORK_LOCKED);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700344
345 // register for MMI/USSD
346 mCM.registerForMmiComplete(mHandler, MMI_COMPLETE, null);
347
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700348 // Register for misc other intent broadcasts.
349 IntentFilter intentFilter =
350 new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700351 intentFilter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
352 intentFilter.addAction(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
353 intentFilter.addAction(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
354 intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
Jack Yu1a2fc352017-07-14 17:14:37 -0700355 intentFilter.addAction(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
356 intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700357 registerReceiver(mReceiver, intentFilter);
358
Brad Ebinger533c6c12017-08-02 11:38:48 -0700359 IntentFilter sipIntentFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
Brad Ebinger533c6c12017-08-02 11:38:48 -0700360 sipIntentFilter.addAction(SipManager.ACTION_SIP_SERVICE_UP);
361 sipIntentFilter.addAction(SipManager.ACTION_SIP_CALL_OPTION_CHANGED);
362 sipIntentFilter.addAction(SipManager.ACTION_SIP_REMOVE_PHONE);
Brad Ebinger28626122017-08-10 14:13:35 -0700363 registerReceiver(mSipReceiver, sipIntentFilter);
Brad Ebinger533c6c12017-08-02 11:38:48 -0700364
Ta-wei Yenf0a71bc2017-05-17 12:28:28 -0700365 mCarrierVvmPackageInstalledReceiver.register(this);
366
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700367 //set the default values for the preferences in the phone.
pkanward702e542017-02-08 15:44:54 -0800368 PreferenceManager.setDefaultValues(this, R.xml.network_setting_fragment, false);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700369
370 PreferenceManager.setDefaultValues(this, R.xml.call_feature_setting, false);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700371 }
372
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700373 // XXX pre-load the SimProvider so that it's ready
374 resolver.getType(Uri.parse("content://icc/adn"));
375
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700376 // TODO: Register for Cdma Information Records
377 // phone.registerCdmaInformationRecord(mHandler, EVENT_UNSOL_CDMA_INFO_RECORD, null);
378
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700379 // Read HAC settings and configure audio hardware
380 if (getResources().getBoolean(R.bool.hac_enabled)) {
Stuart Scottdcf40a92014-12-09 10:45:01 -0800381 int hac = android.provider.Settings.System.getInt(
382 getContentResolver(),
383 android.provider.Settings.System.HEARING_AID,
384 0);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700385 AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
Andrew Leefb7f92e2015-02-26 16:23:32 -0800386 audioManager.setParameter(SettingsConstants.HAC_KEY,
387 hac == SettingsConstants.HAC_ENABLED
388 ? SettingsConstants.HAC_VAL_ON : SettingsConstants.HAC_VAL_OFF);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700389 }
Santos Cordonff506f52013-11-21 19:13:19 -0800390 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700391
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700392 /**
393 * Returns the singleton instance of the PhoneApp.
394 */
Sailesh Nepal1eaf22b2014-02-22 17:00:49 -0800395 public static PhoneGlobals getInstance() {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700396 if (sMe == null) {
397 throw new IllegalStateException("No PhoneGlobals here!");
398 }
399 return sMe;
400 }
401
402 /**
Stuart Scottdcf40a92014-12-09 10:45:01 -0800403 * Returns the default phone.
404 *
Andrew Lee385019f2014-11-24 14:19:50 -0800405 * WARNING: This method should be used carefully, now that there may be multiple phones.
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700406 */
Andrew Lee83383e42014-10-31 12:42:28 -0700407 public static Phone getPhone() {
Stuart Scottdcf40a92014-12-09 10:45:01 -0800408 return PhoneFactory.getDefaultPhone();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700409 }
410
Andrew Lee2fcb6c32014-12-04 14:52:35 -0800411 public static Phone getPhone(int subId) {
412 return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
Andrew Lee385019f2014-11-24 14:19:50 -0800413 }
414
Santos Cordonde10b752013-09-19 04:11:33 -0700415 /* package */ CallManager getCallManager() {
416 return mCM;
417 }
418
Chris Manton4e9fa912015-06-19 11:26:57 -0700419 public PersistableBundle getCarrierConfig() {
Shishir Agrawald3480e02016-01-25 13:05:49 -0800420 return getCarrierConfigForSubId(SubscriptionManager.getDefaultSubscriptionId());
Jonathan Basseri89b0ab42015-05-01 10:52:40 -0700421 }
422
Chris Manton4e9fa912015-06-19 11:26:57 -0700423 public PersistableBundle getCarrierConfigForSubId(int subId) {
Malcolm Chen6d3d6b32018-03-01 13:58:03 -0800424 return configLoader.getConfigForSubId(subId, getOpPackageName());
Junda Liu605148f2015-04-28 15:23:40 -0700425 }
426
Jack Yu1a2fc352017-07-14 17:14:37 -0700427 private void registerSettingsObserver() {
428 mSettingsObserver.unobserve();
429 String dataRoamingSetting = Settings.Global.DATA_ROAMING;
430 String mobileDataSetting = Settings.Global.MOBILE_DATA;
431 if (TelephonyManager.getDefault().getSimCount() > 1) {
432 int subId = mDefaultDataSubId;
433 if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
434 dataRoamingSetting += subId;
435 mobileDataSetting += subId;
436 }
437 }
438
439 // Listen for user data roaming setting changed event
440 mSettingsObserver.observe(Settings.Global.getUriFor(dataRoamingSetting),
441 EVENT_DATA_ROAMING_SETTINGS_CHANGED);
442
443 // Listen for mobile data setting changed event
444 mSettingsObserver.observe(Settings.Global.getUriFor(mobileDataSetting),
445 EVENT_MOBILE_DATA_SETTINGS_CHANGED);
446 }
447
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700448 /**
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700449 * Sets the activity responsible for un-PUK-blocking the device
450 * so that we may close it when we receive a positive result.
451 * mPUKEntryActivity is also used to indicate to the device that
452 * we are trying to un-PUK-lock the phone. In other words, iff
453 * it is NOT null, then we are trying to unlock and waiting for
454 * the SIM to move to READY state.
455 *
456 * @param activity is the activity to close when PUK has
457 * finished unlocking. Can be set to null to indicate the unlock
458 * or SIM READYing process is over.
459 */
460 void setPukEntryActivity(Activity activity) {
461 mPUKEntryActivity = activity;
462 }
463
464 Activity getPUKEntryActivity() {
465 return mPUKEntryActivity;
466 }
467
468 /**
469 * Sets the dialog responsible for notifying the user of un-PUK-
470 * blocking - SIM READYing progress, so that we may dismiss it
471 * when we receive a positive result.
472 *
473 * @param dialog indicates the progress dialog informing the user
474 * of the state of the device. Dismissed upon completion of
475 * READYing process
476 */
477 void setPukEntryProgressDialog(ProgressDialog dialog) {
478 mPUKEntryProgressDialog = dialog;
479 }
480
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700481 /**
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700482 * If we are not currently keeping the screen on, then poke the power
483 * manager to wake up the screen for the user activity timeout duration.
484 */
485 /* package */ void wakeUpScreen() {
486 synchronized (this) {
487 if (mWakeState == WakeState.SLEEP) {
488 if (DBG) Log.d(LOG_TAG, "pulse screen lock");
Dianne Hackborn148769b2015-07-13 17:55:47 -0700489 mPowerManager.wakeUp(SystemClock.uptimeMillis(), "android.phone:WAKE");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700490 }
491 }
492 }
493
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700494 KeyguardManager getKeyguardManager() {
495 return mKeyguardManager;
496 }
497
498 private void onMMIComplete(AsyncResult r) {
499 if (VDBG) Log.d(LOG_TAG, "onMMIComplete()...");
500 MmiCode mmiCode = (MmiCode) r.result;
Stuart Scottdcf40a92014-12-09 10:45:01 -0800501 PhoneUtils.displayMMIComplete(mmiCode.getPhone(), getInstance(), mmiCode, null, null);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700502 }
503
fionaxu80126972017-02-01 17:01:26 -0800504 private void initForNewRadioTechnology() {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700505 if (DBG) Log.d(LOG_TAG, "initForNewRadioTechnology...");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700506 notifier.updateCallNotifierRegistrationsAfterRadioTechnologyChange();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700507 }
508
Chris Mantona09f3632016-02-09 14:48:42 -0800509 private void handleAirplaneModeChange(Context context, int newMode) {
510 int cellState = Settings.Global.getInt(context.getContentResolver(),
511 Settings.Global.CELL_ON, PhoneConstants.CELL_ON_FLAG);
512 boolean isAirplaneNewlyOn = (newMode == 1);
513 switch (cellState) {
514 case PhoneConstants.CELL_OFF_FLAG:
515 // Airplane mode does not affect the cell radio if user
516 // has turned it off.
517 break;
518 case PhoneConstants.CELL_ON_FLAG:
519 maybeTurnCellOff(context, isAirplaneNewlyOn);
520 break;
521 case PhoneConstants.CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG:
522 maybeTurnCellOn(context, isAirplaneNewlyOn);
523 break;
524 }
525 }
526
527 /*
528 * Returns true if the radio must be turned off when entering airplane mode.
529 */
530 private boolean isCellOffInAirplaneMode(Context context) {
531 String airplaneModeRadios = Settings.Global.getString(context.getContentResolver(),
532 Settings.Global.AIRPLANE_MODE_RADIOS);
533 return airplaneModeRadios == null
534 || airplaneModeRadios.contains(Settings.Global.RADIO_CELL);
535 }
536
537 private void setRadioPowerOff(Context context) {
538 Log.i(LOG_TAG, "Turning radio off - airplane");
539 Settings.Global.putInt(context.getContentResolver(), Settings.Global.CELL_ON,
Eric Erfanian945409f2018-02-21 19:26:15 +0000540 PhoneConstants.CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG);
Sooraj Sasindran798bafa2017-04-03 22:49:00 -0700541 SystemProperties.set("persist.radio.airplane_mode_on", "1");
Chris Mantona09f3632016-02-09 14:48:42 -0800542 Settings.Global.putInt(getContentResolver(), Settings.Global.ENABLE_CELLULAR_ON_BOOT, 0);
543 PhoneUtils.setRadioPower(false);
544 }
545
546 private void setRadioPowerOn(Context context) {
547 Log.i(LOG_TAG, "Turning radio on - airplane");
548 Settings.Global.putInt(context.getContentResolver(), Settings.Global.CELL_ON,
549 PhoneConstants.CELL_ON_FLAG);
550 Settings.Global.putInt(getContentResolver(), Settings.Global.ENABLE_CELLULAR_ON_BOOT,
551 1);
Sooraj Sasindran798bafa2017-04-03 22:49:00 -0700552 SystemProperties.set("persist.radio.airplane_mode_on", "0");
Chris Mantona09f3632016-02-09 14:48:42 -0800553 PhoneUtils.setRadioPower(true);
554 }
555
556 private void maybeTurnCellOff(Context context, boolean isAirplaneNewlyOn) {
557 if (isAirplaneNewlyOn) {
Santos Cordone18902f2016-03-22 17:16:04 -0700558 // If we are trying to turn off the radio, make sure there are no active
559 // emergency calls. If there are, switch airplane mode back to off.
Tyler Gunn900d8fd2018-09-21 09:22:12 -0700560 TelecomManager tm = (TelecomManager) context.getSystemService(TELECOM_SERVICE);
561
562 if (tm != null && tm.isInEmergencyCall()) {
Santos Cordone18902f2016-03-22 17:16:04 -0700563 // Switch airplane mode back to off.
564 ConnectivityManager.from(this).setAirplaneMode(false);
565 Toast.makeText(this, R.string.radio_off_during_emergency_call, Toast.LENGTH_LONG)
566 .show();
567 Log.i(LOG_TAG, "Ignoring airplane mode: emergency call. Turning airplane off");
Chris Mantona09f3632016-02-09 14:48:42 -0800568 } else if (isCellOffInAirplaneMode(context)) {
569 setRadioPowerOff(context);
Santos Cordone18902f2016-03-22 17:16:04 -0700570 } else {
Chris Mantona09f3632016-02-09 14:48:42 -0800571 Log.i(LOG_TAG, "Ignoring airplane mode: settings prevent cell radio power off");
Santos Cordone18902f2016-03-22 17:16:04 -0700572 }
Chris Mantona09f3632016-02-09 14:48:42 -0800573 }
574 }
575
576 private void maybeTurnCellOn(Context context, boolean isAirplaneNewlyOn) {
577 if (!isAirplaneNewlyOn) {
578 setRadioPowerOn(context);
Santos Cordone18902f2016-03-22 17:16:04 -0700579 }
580 }
581
Santos Cordon593ab382013-08-06 21:58:23 -0700582 /**
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700583 * Receiver for misc intent broadcasts the Phone app cares about.
584 */
585 private class PhoneAppBroadcastReceiver extends BroadcastReceiver {
586 @Override
587 public void onReceive(Context context, Intent intent) {
588 String action = intent.getAction();
589 if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
Santos Cordone18902f2016-03-22 17:16:04 -0700590 int airplaneMode = Settings.Global.getInt(getContentResolver(),
591 Settings.Global.AIRPLANE_MODE_ON, AIRPLANE_OFF);
592 // Treat any non-OFF values as ON.
593 if (airplaneMode != AIRPLANE_OFF) {
594 airplaneMode = AIRPLANE_ON;
595 }
Chris Mantona09f3632016-02-09 14:48:42 -0800596 handleAirplaneModeChange(context, airplaneMode);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700597 } else if ((action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) &&
598 (mPUKEntryActivity != null)) {
599 // if an attempt to un-PUK-lock the device was made, while we're
600 // receiving this state change notification, notify the handler.
601 // NOTE: This is ONLY triggered if an attempt to un-PUK-lock has
602 // been attempted.
603 mHandler.sendMessage(mHandler.obtainMessage(EVENT_SIM_STATE_CHANGED,
604 intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE)));
605 } else if (action.equals(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED)) {
606 String newPhone = intent.getStringExtra(PhoneConstants.PHONE_NAME_KEY);
fionaxu80126972017-02-01 17:01:26 -0800607 Log.d(LOG_TAG, "Radio technology switched. Now " + newPhone + " is active.");
608 initForNewRadioTechnology();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700609 } else if (action.equals(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED)) {
610 handleServiceStateChanged(intent);
611 } else if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) {
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530612 int phoneId = intent.getIntExtra(PhoneConstants.PHONE_KEY, 0);
Srikanth Chintala079912a2016-03-03 16:35:01 +0530613 phoneInEcm = PhoneFactory.getPhone(phoneId);
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530614 Log.d(LOG_TAG, "Emergency Callback Mode. phoneId:" + phoneId);
615 if (phoneInEcm != null) {
616 if (TelephonyCapabilities.supportsEcm(phoneInEcm)) {
617 Log.d(LOG_TAG, "Emergency Callback Mode arrived in PhoneApp.");
618 // Start Emergency Callback Mode service
619 if (intent.getBooleanExtra("phoneinECMState", false)) {
620 context.startService(new Intent(context,
621 EmergencyCallbackModeService.class));
622 } else {
623 phoneInEcm = null;
624 }
625 } else {
626 // It doesn't make sense to get ACTION_EMERGENCY_CALLBACK_MODE_CHANGED
627 // on a device that doesn't support ECM in the first place.
628 Log.e(LOG_TAG, "Got ACTION_EMERGENCY_CALLBACK_MODE_CHANGED, but "
629 + "ECM isn't supported for phone: " + phoneInEcm.getPhoneName());
630 phoneInEcm = null;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700631 }
632 } else {
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530633 Log.w(LOG_TAG, "phoneInEcm is null.");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700634 }
Jack Yu1a2fc352017-07-14 17:14:37 -0700635 } else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
636 // Roaming status could be overridden by carrier config, so we need to update it.
637 if (VDBG) Log.v(LOG_TAG, "carrier config changed.");
638 updateDataRoamingStatus();
639 } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
640 // We also need to pay attention when default data subscription changes.
641 if (VDBG) Log.v(LOG_TAG, "default data sub changed.");
642 mDefaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId();
643 registerSettingsObserver();
644 Phone phone = getPhone(mDefaultDataSubId);
645 if (phone != null) {
646 updateDataRoamingStatus();
647 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700648 }
649 }
650 }
651
Brad Ebinger28626122017-08-10 14:13:35 -0700652 private class SipReceiver extends BroadcastReceiver {
653
654 @Override
655 public void onReceive(Context context, Intent intent) {
656 String action = intent.getAction();
657
658 SipAccountRegistry sipAccountRegistry = SipAccountRegistry.getInstance();
659 if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
660 SipUtil.startSipService();
661 } else if (action.equals(SipManager.ACTION_SIP_SERVICE_UP)
662 || action.equals(SipManager.ACTION_SIP_CALL_OPTION_CHANGED)) {
663 sipAccountRegistry.setup(context);
664 } else if (action.equals(SipManager.ACTION_SIP_REMOVE_PHONE)) {
665 if (DBG) {
666 Log.d(LOG_TAG, "SIP_REMOVE_PHONE "
667 + intent.getStringExtra(SipManager.EXTRA_LOCAL_URI));
668 }
669 sipAccountRegistry.removeSipProfile(intent.getStringExtra(
670 SipManager.EXTRA_LOCAL_URI));
671 } else {
672 if (DBG) Log.d(LOG_TAG, "onReceive, action not processed: " + action);
673 }
674 }
675 }
676
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700677 private void handleServiceStateChanged(Intent intent) {
678 /**
679 * This used to handle updating EriTextWidgetProvider this routine
680 * and and listening for ACTION_SERVICE_STATE_CHANGED intents could
681 * be removed. But leaving just in case it might be needed in the near
682 * future.
683 */
684
Jack Yu1a2fc352017-07-14 17:14:37 -0700685 if (VDBG) Log.v(LOG_TAG, "handleServiceStateChanged");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700686 // If service just returned, start sending out the queued messages
Santos Cordonc593d002015-06-03 15:41:15 -0700687 Bundle extras = intent.getExtras();
688 if (extras != null) {
689 ServiceState ss = ServiceState.newFromBundle(extras);
690 if (ss != null) {
691 int state = ss.getState();
Jayachandran C2ef9a482017-05-12 22:07:47 -0700692 int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
693 SubscriptionManager.INVALID_SUBSCRIPTION_ID);
694 notificationMgr.updateNetworkSelection(state, subId);
Jack Yu1a2fc352017-07-14 17:14:37 -0700695
696 if (VDBG) {
697 Log.v(LOG_TAG, "subId=" + subId + ",mDefaultDataSubId="
698 + mDefaultDataSubId + ",ss roaming=" + ss.getDataRoaming());
699 }
700 if (subId == mDefaultDataSubId) {
701 updateDataRoamingStatus();
702 }
Santos Cordonc593d002015-06-03 15:41:15 -0700703 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700704 }
705 }
706
Jack Yu1a2fc352017-07-14 17:14:37 -0700707 /**
708 * When roaming, if mobile data cannot be established due to data roaming not enabled, we need
709 * to notify the user so they can enable it through settings. Vise versa if the condition
710 * changes, we need to dismiss the notification.
711 */
712 private void updateDataRoamingStatus() {
713 if (VDBG) Log.v(LOG_TAG, "updateDataRoamingStatus");
714 Phone phone = getPhone(mDefaultDataSubId);
715 if (phone == null) {
716 Log.w(LOG_TAG, "Can't get phone with sub id = " + mDefaultDataSubId);
717 return;
718 }
719
720 DataConnectionReasons reasons = new DataConnectionReasons();
Jack Yu311536f2018-11-26 11:20:48 -0800721 boolean dataAllowed = phone.isDataAllowed(ApnSetting.TYPE_DEFAULT, reasons);
Jack Yu1a2fc352017-07-14 17:14:37 -0700722 mDataRoamingNotifLog.log("dataAllowed=" + dataAllowed + ", reasons=" + reasons);
723 if (VDBG) Log.v(LOG_TAG, "dataAllowed=" + dataAllowed + ", reasons=" + reasons);
724 if (!mNoDataDueToRoaming
725 && !dataAllowed
726 && reasons.containsOnly(DataDisallowedReasonType.ROAMING_DISABLED)) {
727 // If the only reason of no data is data roaming disabled, then we notify the user
728 // so the user can turn on data roaming.
729 mNoDataDueToRoaming = true;
730 Log.d(LOG_TAG, "Show roaming disconnected notification");
731 mDataRoamingNotifLog.log("Show");
Pengquan Meng8783d932017-10-16 14:57:40 -0700732 Message msg = mHandler.obtainMessage(EVENT_DATA_ROAMING_DISCONNECTED);
733 msg.arg1 = mDefaultDataSubId;
734 msg.sendToTarget();
Jack Yu1a2fc352017-07-14 17:14:37 -0700735 } else if (mNoDataDueToRoaming && (dataAllowed
736 || !reasons.containsOnly(DataDisallowedReasonType.ROAMING_DISABLED))) {
737 // Otherwise dismiss the notification we showed earlier.
738 mNoDataDueToRoaming = false;
739 Log.d(LOG_TAG, "Dismiss roaming disconnected notification");
740 mDataRoamingNotifLog.log("Hide. data allowed=" + dataAllowed + ", reasons=" + reasons);
741 mHandler.sendEmptyMessage(EVENT_DATA_ROAMING_OK);
742 }
743 }
744
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530745 public Phone getPhoneInEcm() {
746 return phoneInEcm;
747 }
748
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700749 /**
Tyler Gunn9c1071f2014-12-09 10:07:54 -0800750 * Triggers a refresh of the message waiting (voicemail) indicator.
751 *
752 * @param subId the subscription id we should refresh the notification for.
753 */
754 public void refreshMwiIndicator(int subId) {
755 notificationMgr.refreshMwi(subId);
756 }
757
758 /**
Pengquan Mengdd9ac822018-09-20 15:25:35 -0700759 * Called when the network selection on the subscription {@code subId} is changed by the user.
760 *
761 * @param subId the subscription id.
762 */
763 public void onNetworkSelectionChanged(int subId) {
764 Phone phone = getPhone(subId);
765 if (phone != null) {
766 notificationMgr.updateNetworkSelection(phone.getServiceState().getState(), subId);
767 } else {
768 Log.w(LOG_TAG, "onNetworkSelectionChanged on null phone, subId: " + subId);
769 }
770 }
771
772 /**
Jack Yu1a2fc352017-07-14 17:14:37 -0700773 * Dump the state of the object, add calls to other objects as desired.
774 *
775 * @param fd File descriptor
776 * @param printWriter Print writer
777 * @param args Arguments
778 */
779 public void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) {
780 IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, " ");
781 pw.println("------- PhoneGlobals -------");
782 pw.increaseIndent();
783 pw.println("mNoDataDueToRoaming=" + mNoDataDueToRoaming);
784 pw.println("mDefaultDataSubId=" + mDefaultDataSubId);
785 pw.println("mDataRoamingNotifLog:");
786 pw.increaseIndent();
787 mDataRoamingNotifLog.dump(fd, pw, args);
788 pw.decreaseIndent();
789 pw.decreaseIndent();
790 pw.println("------- End PhoneGlobals -------");
791 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700792}