blob: 78a734a1772071e3ee99f706279cb3a5b83caaf6 [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
Jordan Liuff2ccd72019-07-23 15:54:41 -070019import android.annotation.IntDef;
Ling Ma317906d2022-12-05 15:58:14 -080020import android.annotation.Nullable;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070021import android.app.Activity;
22import android.app.KeyguardManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070023import android.app.ProgressDialog;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070024import android.content.BroadcastReceiver;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070025import android.content.ContentResolver;
26import android.content.Context;
27import android.content.ContextWrapper;
28import android.content.Intent;
29import android.content.IntentFilter;
Brad Ebinger05f52c22019-12-05 13:03:21 -080030import android.content.pm.PackageManager;
Youming Ye47a6adc2018-11-19 15:33:36 -080031import android.content.res.XmlResourceParser;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070032import android.media.AudioManager;
Santos Cordone18902f2016-03-22 17:16:04 -070033import android.net.ConnectivityManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070034import android.net.Uri;
35import android.os.AsyncResult;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070036import android.os.Handler;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070037import android.os.Message;
Jonathan Basseric31f1f32015-05-12 10:13:03 -070038import android.os.PersistableBundle;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070039import android.os.PowerManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070040import android.os.SystemProperties;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070041import android.preference.PreferenceManager;
Sanket Padawe4c699232016-02-09 11:07:22 -080042import android.provider.Settings;
Meng Wang61307622019-10-23 14:08:43 -070043import android.sysprop.TelephonyProperties;
Tyler Gunn900d8fd2018-09-21 09:22:12 -070044import android.telecom.TelecomManager;
Nathan Haroldf9df6ea2019-03-08 11:54:22 -080045import android.telephony.AnomalyReporter;
Junda Liu12f7d802015-05-01 12:06:44 -070046import android.telephony.CarrierConfigManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070047import android.telephony.ServiceState;
chen xubaf9fe52019-07-02 17:28:24 -070048import android.telephony.SubscriptionInfo;
Andrew Lee385019f2014-11-24 14:19:50 -080049import android.telephony.SubscriptionManager;
Sarah Chin072ffb22022-05-03 17:58:59 -070050import android.telephony.TelephonyCallback;
Hall Liuaa4211e2021-01-20 15:43:39 -080051import android.telephony.TelephonyLocalConnection;
Jack Yu1a2fc352017-07-14 17:14:37 -070052import android.telephony.TelephonyManager;
Ling Ma317906d2022-12-05 15:58:14 -080053import android.util.ArraySet;
Jack Yu1a2fc352017-07-14 17:14:37 -070054import android.util.LocalLog;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070055import android.util.Log;
Santos Cordone18902f2016-03-22 17:16:04 -070056import android.widget.Toast;
Ta-wei Yenb29425b2016-09-21 17:28:14 -070057
Brad Ebingere3ae65a2020-09-11 12:45:11 -070058import com.android.ims.ImsFeatureBinderRepository;
Siim Sammul182d61b2021-05-04 16:01:42 +010059import com.android.internal.os.BinderCallsStats;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070060import com.android.internal.telephony.CallManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070061import com.android.internal.telephony.IccCardConstants;
62import com.android.internal.telephony.MmiCode;
63import com.android.internal.telephony.Phone;
Sarah Chin072ffb22022-05-03 17:58:59 -070064import com.android.internal.telephony.PhoneConfigurationManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070065import com.android.internal.telephony.PhoneConstants;
66import com.android.internal.telephony.PhoneFactory;
Jack Yu1a2fc352017-07-14 17:14:37 -070067import com.android.internal.telephony.SettingsObserver;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070068import com.android.internal.telephony.TelephonyCapabilities;
Youming Ye47a6adc2018-11-19 15:33:36 -080069import com.android.internal.telephony.TelephonyComponentFactory;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070070import com.android.internal.telephony.TelephonyIntents;
Jack Yu3e2ac6e2022-03-26 13:59:45 -070071import com.android.internal.telephony.data.DataEvaluation.DataDisallowedReason;
Hwangoo Parkba21cf22022-11-30 14:34:04 +000072import com.android.internal.telephony.domainselection.DomainSelectionResolver;
Daniel Bantab26e96f2022-10-19 23:25:35 +000073import com.android.internal.telephony.emergency.EmergencyStateTracker;
Brad Ebinger05f52c22019-12-05 13:03:21 -080074import com.android.internal.telephony.ims.ImsResolver;
Tyler Gunn92479152021-01-20 16:30:10 -080075import com.android.internal.telephony.imsphone.ImsPhone;
76import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
Muralidhar Reddy472c2ae2021-09-29 19:38:40 +000077import com.android.internal.telephony.uicc.UiccPort;
Jordan Liu06bdef12021-03-24 17:25:46 -070078import com.android.internal.telephony.uicc.UiccProfile;
Jack Yu1a2fc352017-07-14 17:14:37 -070079import com.android.internal.util.IndentingPrintWriter;
Andrew Leefb7f92e2015-02-26 16:23:32 -080080import com.android.phone.settings.SettingsConstants;
Ta-wei Yenf0a71bc2017-05-17 12:28:28 -070081import com.android.phone.vvm.CarrierVvmPackageInstalledReceiver;
Hwangoo Parkba21cf22022-11-30 14:34:04 +000082import com.android.services.telephony.domainselection.TelephonyDomainSelectionService;
James.cf Linc9f35a42020-01-15 02:35:22 +080083import com.android.services.telephony.rcs.TelephonyRcsService;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070084
Jack Yu1a2fc352017-07-14 17:14:37 -070085import java.io.FileDescriptor;
86import java.io.PrintWriter;
Jordan Liuff2ccd72019-07-23 15:54:41 -070087import java.lang.annotation.Retention;
88import java.lang.annotation.RetentionPolicy;
chen xubaf9fe52019-07-02 17:28:24 -070089import java.util.List;
Jack Yu1a2fc352017-07-14 17:14:37 -070090
Santos Cordon7d4ddf62013-07-10 11:58:08 -070091/**
92 * Global state for the telephony subsystem when running in the primary
93 * phone process.
94 */
Sailesh Nepalbf900542014-07-15 16:18:32 -070095public class PhoneGlobals extends ContextWrapper {
Jack Yu1a2fc352017-07-14 17:14:37 -070096 public static final String LOG_TAG = "PhoneGlobals";
Santos Cordon7d4ddf62013-07-10 11:58:08 -070097
98 /**
99 * Phone app-wide debug level:
100 * 0 - no debug logging
101 * 1 - normal debug logging if ro.debuggable is set (which is true in
102 * "eng" and "userdebug" builds but not "user" builds)
103 * 2 - ultra-verbose debug logging
104 *
105 * Most individual classes in the phone app have a local DBG constant,
106 * typically set to
107 * (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1)
108 * or else
109 * (PhoneApp.DBG_LEVEL >= 2)
110 * depending on the desired verbosity.
111 *
112 * ***** DO NOT SUBMIT WITH DBG_LEVEL > 0 *************
113 */
Andrew Lee88b51e22014-10-29 15:48:51 -0700114 public static final int DBG_LEVEL = 0;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700115
116 private static final boolean DBG =
117 (PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
118 private static final boolean VDBG = (PhoneGlobals.DBG_LEVEL >= 2);
119
120 // Message codes; see mHandler below.
121 private static final int EVENT_SIM_NETWORK_LOCKED = 3;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700122 private static final int EVENT_SIM_STATE_CHANGED = 8;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700123 private static final int EVENT_DATA_ROAMING_DISCONNECTED = 10;
Jordan Liuff2ccd72019-07-23 15:54:41 -0700124 private static final int EVENT_DATA_ROAMING_CONNECTED = 11;
125 private static final int EVENT_DATA_ROAMING_OK = 12;
126 private static final int EVENT_UNSOL_CDMA_INFO_RECORD = 13;
Jordan Liuff2ccd72019-07-23 15:54:41 -0700127 private static final int EVENT_DATA_ROAMING_SETTINGS_CHANGED = 15;
128 private static final int EVENT_MOBILE_DATA_SETTINGS_CHANGED = 16;
Lei Liu863eac02020-06-24 20:12:55 +0800129 private static final int EVENT_CARRIER_CONFIG_CHANGED = 17;
Sarah Chin072ffb22022-05-03 17:58:59 -0700130 private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 18;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700131
132 // The MMI codes are also used by the InCallScreen.
133 public static final int MMI_INITIATE = 51;
134 public static final int MMI_COMPLETE = 52;
135 public static final int MMI_CANCEL = 53;
136 // Don't use message codes larger than 99 here; those are reserved for
137 // the individual Activities of the Phone UI.
138
Santos Cordone18902f2016-03-22 17:16:04 -0700139 public static final int AIRPLANE_ON = 1;
140 public static final int AIRPLANE_OFF = 0;
141
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700142 /**
143 * Allowable values for the wake lock code.
144 * SLEEP means the device can be put to sleep.
145 * PARTIAL means wake the processor, but we display can be kept off.
146 * FULL means wake both the processor and the display.
147 */
148 public enum WakeState {
149 SLEEP,
150 PARTIAL,
151 FULL
152 }
153
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700154 private static PhoneGlobals sMe;
155
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700156 CallManager mCM;
Santos Cordon63a84242013-07-23 13:32:52 -0700157 CallNotifier notifier;
Santos Cordon63a84242013-07-23 13:32:52 -0700158 NotificationMgr notificationMgr;
James.cf Linc9f35a42020-01-15 02:35:22 +0800159 TelephonyRcsService mTelephonyRcsService;
Andrew Lee9431b832015-03-09 18:46:45 -0700160 public PhoneInterfaceManager phoneMgr;
James.cf Linaf3183c2019-10-24 00:59:00 +0800161 public ImsRcsController imsRcsController;
Hunsuk Choi3b742d62021-10-25 19:48:34 +0000162 public ImsStateCallbackController mImsStateCallbackController;
joonhunshincffb7fc2021-11-28 07:32:01 +0000163 public ImsProvisioningController mImsProvisioningController;
Jonathan Basseri6465afd2015-02-25 13:05:57 -0800164 CarrierConfigLoader configLoader;
Hwangoo Parkba21cf22022-11-30 14:34:04 +0000165 TelephonyDomainSelectionService mDomainSelectionService;
Santos Cordon63a84242013-07-23 13:32:52 -0700166
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530167 private Phone phoneInEcm;
Santos Cordon63a84242013-07-23 13:32:52 -0700168
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700169 static boolean sVoiceCapable = true;
170
Santos Cordonc593d002015-06-03 15:41:15 -0700171 // TODO: Remove, no longer used.
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700172 CdmaPhoneCallState cdmaPhoneCallState;
173
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700174 // The currently-active PUK entry activity and progress dialog.
175 // Normally, these are the Emergency Dialer and the subsequent
176 // progress dialog. null if there is are no such objects in
177 // the foreground.
178 private Activity mPUKEntryActivity;
179 private ProgressDialog mPUKEntryProgressDialog;
180
Jordan Liuff2ccd72019-07-23 15:54:41 -0700181 /** @hide */
182 @Retention(RetentionPolicy.SOURCE)
183 @IntDef(prefix = {"ROAMING_NOTIFICATION_"},
184 value = {
185 ROAMING_NOTIFICATION_NO_NOTIFICATION,
186 ROAMING_NOTIFICATION_CONNECTED,
187 ROAMING_NOTIFICATION_DISCONNECTED})
188 public @interface RoamingNotification {}
189
190 private static final int ROAMING_NOTIFICATION_NO_NOTIFICATION = 0;
191 private static final int ROAMING_NOTIFICATION_CONNECTED = 1;
192 private static final int ROAMING_NOTIFICATION_DISCONNECTED = 2;
193
194 @RoamingNotification
195 private int mPrevRoamingNotification = ROAMING_NOTIFICATION_NO_NOTIFICATION;
Jack Yu953f9352017-05-18 14:41:06 -0700196
Ling Ma317906d2022-12-05 15:58:14 -0800197 /** Operator numerics for which we've shown is-roaming notifications. **/
198 private ArraySet<String> mPrevRoamingOperatorNumerics = new ArraySet<>();
199
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700200 private WakeState mWakeState = WakeState.SLEEP;
201
202 private PowerManager mPowerManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700203 private PowerManager.WakeLock mWakeLock;
204 private PowerManager.WakeLock mPartialWakeLock;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700205 private KeyguardManager mKeyguardManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700206
Jack Yu1a2fc352017-07-14 17:14:37 -0700207 private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
208 private final LocalLog mDataRoamingNotifLog = new LocalLog(50);
209
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700210 // Broadcast receiver for various intent broadcasts (see onCreate())
211 private final BroadcastReceiver mReceiver = new PhoneAppBroadcastReceiver();
212
Ta-wei Yenf0a71bc2017-05-17 12:28:28 -0700213 private final CarrierVvmPackageInstalledReceiver mCarrierVvmPackageInstalledReceiver =
214 new CarrierVvmPackageInstalledReceiver();
215
Jack Yu1a2fc352017-07-14 17:14:37 -0700216 private final SettingsObserver mSettingsObserver;
Siim Sammul182d61b2021-05-04 16:01:42 +0100217 private BinderCallsStats.SettingsObserver mBinderCallsSettingsObserver;
Jack Yu1a2fc352017-07-14 17:14:37 -0700218
Sarah Chin072ffb22022-05-03 17:58:59 -0700219 // Mapping of phone ID to the associated TelephonyCallback. These should be registered without
220 // fine or coarse location since we only use ServiceState for
221 private PhoneAppCallback[] mTelephonyCallbacks;
222
223 private class PhoneAppCallback extends TelephonyCallback implements
224 TelephonyCallback.ServiceStateListener {
225 private final int mSubId;
226
227 PhoneAppCallback(int subId) {
228 mSubId = subId;
229 }
230
231 @Override
232 public void onServiceStateChanged(ServiceState serviceState) {
233 // Note when registering that we should be registering with INCLUDE_LOCATION_DATA_NONE.
234 // PhoneGlobals only uses the state and roaming status, which does not require location.
235 handleServiceStateChanged(serviceState, mSubId);
236 }
237
238 public int getSubId() {
239 return mSubId;
240 }
241 }
242
Nazish Tabassum160d2112019-12-23 17:31:33 +0530243 private static class EventSimStateChangedBag {
244 final int mPhoneId;
245 final String mIccStatus;
246
247 EventSimStateChangedBag(int phoneId, String iccStatus) {
248 mPhoneId = phoneId;
249 mIccStatus = iccStatus;
250 }
251 }
252
Jordan Liu06bdef12021-03-24 17:25:46 -0700253 // Some carrier config settings disable the network lock screen, so we call handleSimLock
254 // when either SIM_LOCK or CARRIER_CONFIG changes so that no matter which one happens first,
255 // we still do the right thing
256 private void handleSimLock(int subType, Phone phone) {
257 PersistableBundle cc = getCarrierConfigForSubId(phone.getSubId());
258 if (!CarrierConfigManager.isConfigForIdentifiedCarrier(cc)) {
259 // If we only have the default carrier config just return, to avoid popping up the
260 // the SIM lock screen when it's disabled by the carrier.
261 Log.i(LOG_TAG, "Not showing 'SIM network unlock' screen. Carrier config not loaded");
262 return;
263 }
264 if (cc.getBoolean(CarrierConfigManager.KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL)) {
265 // Some products don't have the concept of a "SIM network lock"
266 Log.i(LOG_TAG, "Not showing 'SIM network unlock' screen. Disabled by carrier config");
267 return;
268 }
269
270 // if passed in subType is unknown, retrieve it here.
271 if (subType == -1) {
Muralidhar Reddy472c2ae2021-09-29 19:38:40 +0000272 final UiccPort uiccPort = phone.getUiccPort();
273 if (uiccPort == null) {
Jordan Liu06bdef12021-03-24 17:25:46 -0700274 Log.e(LOG_TAG,
Muralidhar Reddy472c2ae2021-09-29 19:38:40 +0000275 "handleSimLock: uiccPort for phone " + phone.getPhoneId() + " is null");
Jordan Liu06bdef12021-03-24 17:25:46 -0700276 return;
277 }
Muralidhar Reddy472c2ae2021-09-29 19:38:40 +0000278 final UiccProfile uiccProfile = uiccPort.getUiccProfile();
Jordan Liu06bdef12021-03-24 17:25:46 -0700279 if (uiccProfile == null) {
280 Log.e(LOG_TAG,
281 "handleSimLock: uiccProfile for phone " + phone.getPhoneId() + " is null");
282 return;
283 }
284 subType = uiccProfile.getApplication(
285 uiccProfile.mCurrentAppType).getPersoSubState().ordinal();
286 }
287 // Normal case: show the "SIM network unlock" PIN entry screen.
288 // The user won't be able to do anything else until
289 // they enter a valid SIM network PIN.
290 Log.i(LOG_TAG, "show sim depersonal panel");
291 IccNetworkDepersonalizationPanel.showDialog(phone, subType);
292 }
293
294 private boolean isSimLocked(Phone phone) {
295 TelephonyManager tm = getSystemService(TelephonyManager.class);
296 return tm.createForSubscriptionId(phone.getSubId()).getSimState()
297 == TelephonyManager.SIM_STATE_NETWORK_LOCKED;
298 }
299
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700300 Handler mHandler = new Handler() {
301 @Override
302 public void handleMessage(Message msg) {
303 PhoneConstants.State phoneState;
Jack Yu1a2fc352017-07-14 17:14:37 -0700304 if (VDBG) Log.v(LOG_TAG, "event=" + msg.what);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700305 switch (msg.what) {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700306 // TODO: This event should be handled by the lock screen, just
307 // like the "SIM missing" and "Sim locked" cases (bug 1804111).
308 case EVENT_SIM_NETWORK_LOCKED:
Jordan Liu06bdef12021-03-24 17:25:46 -0700309 int subType = (Integer) ((AsyncResult) msg.obj).result;
310 Phone phone = (Phone) ((AsyncResult) msg.obj).userObj;
311 handleSimLock(subType, phone);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700312 break;
313
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700314 case EVENT_DATA_ROAMING_DISCONNECTED:
Jordan Liuff2ccd72019-07-23 15:54:41 -0700315 notificationMgr.showDataRoamingNotification(msg.arg1, false);
316 break;
317
318 case EVENT_DATA_ROAMING_CONNECTED:
319 notificationMgr.showDataRoamingNotification(msg.arg1, true);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700320 break;
321
322 case EVENT_DATA_ROAMING_OK:
Jordan Liuff2ccd72019-07-23 15:54:41 -0700323 notificationMgr.hideDataRoamingNotification();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700324 break;
325
326 case MMI_COMPLETE:
327 onMMIComplete((AsyncResult) msg.obj);
328 break;
329
330 case MMI_CANCEL:
Stuart Scottdcf40a92014-12-09 10:45:01 -0800331 PhoneUtils.cancelMmiCode(mCM.getFgPhone());
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700332 break;
333
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700334 case EVENT_SIM_STATE_CHANGED:
335 // Marks the event where the SIM goes into ready state.
336 // Right now, this is only used for the PUK-unlocking
337 // process.
Nazish Tabassum160d2112019-12-23 17:31:33 +0530338 EventSimStateChangedBag bag = (EventSimStateChangedBag)msg.obj;
Tyler Gunn3fc09c02020-05-08 16:35:55 -0700339 if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(bag.mIccStatus)
Nazish Tabassum59126a92020-07-03 21:44:49 +0530340 || IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(bag.mIccStatus)
341 || IccCardConstants.INTENT_VALUE_ICC_NOT_READY.equals(bag.mIccStatus)
342 || IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(bag.mIccStatus)) {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700343 // when the right event is triggered and there
344 // are UI objects in the foreground, we close
345 // them to display the lock panel.
346 if (mPUKEntryActivity != null) {
Tyler Gunn3fc09c02020-05-08 16:35:55 -0700347 Log.i(LOG_TAG, "Dismiss puk entry activity");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700348 mPUKEntryActivity.finish();
349 mPUKEntryActivity = null;
350 }
351 if (mPUKEntryProgressDialog != null) {
Tyler Gunn3fc09c02020-05-08 16:35:55 -0700352 Log.i(LOG_TAG, "Dismiss puk progress dialog");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700353 mPUKEntryProgressDialog.dismiss();
354 mPUKEntryProgressDialog = null;
355 }
Nazish Tabassum59126a92020-07-03 21:44:49 +0530356 Log.i(LOG_TAG, "Dismissing depersonal panel" + (bag.mIccStatus));
Nazish Tabassum160d2112019-12-23 17:31:33 +0530357 IccNetworkDepersonalizationPanel.dialogDismiss(bag.mPhoneId);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700358 }
359 break;
360
361 case EVENT_UNSOL_CDMA_INFO_RECORD:
362 //TODO: handle message here;
363 break;
Jack Yu1a2fc352017-07-14 17:14:37 -0700364 case EVENT_DATA_ROAMING_SETTINGS_CHANGED:
365 case EVENT_MOBILE_DATA_SETTINGS_CHANGED:
366 updateDataRoamingStatus();
367 break;
Lei Liu863eac02020-06-24 20:12:55 +0800368 case EVENT_CARRIER_CONFIG_CHANGED:
369 int subId = (Integer) msg.obj;
370 // The voicemail number could be overridden by carrier config, so need to
371 // refresh the message waiting (voicemail) indicator.
372 refreshMwiIndicator(subId);
Jordan Liu06bdef12021-03-24 17:25:46 -0700373 phone = getPhone(subId);
Sarah Chin072ffb22022-05-03 17:58:59 -0700374 if (phone != null) {
375 if (isSimLocked(phone)) {
376 // pass in subType=-1 so handleSimLock can find the actual subType if
377 // needed. This is safe as valid values for subType are >= 0
378 handleSimLock(-1, phone);
379 }
380 TelephonyManager tm = getSystemService(TelephonyManager.class);
381 PhoneAppCallback callback = mTelephonyCallbacks[phone.getPhoneId()];
382 // TODO: We may need to figure out a way to unregister if subId is invalid
383 tm.createForSubscriptionId(callback.getSubId())
384 .unregisterTelephonyCallback(callback);
385 callback = new PhoneAppCallback(subId);
386 tm.createForSubscriptionId(subId).registerTelephonyCallback(
Ling Ma317906d2022-12-05 15:58:14 -0800387 TelephonyManager.INCLUDE_LOCATION_DATA_COARSE, mHandler::post,
Sarah Chin072ffb22022-05-03 17:58:59 -0700388 callback);
389 mTelephonyCallbacks[phone.getPhoneId()] = callback;
390 }
391 break;
392 case EVENT_MULTI_SIM_CONFIG_CHANGED:
393 int activeModems = (int) ((AsyncResult) msg.obj).result;
394 TelephonyManager tm = getSystemService(TelephonyManager.class);
395 // Unregister all previous callbacks
396 for (int phoneId = 0; phoneId < mTelephonyCallbacks.length; phoneId++) {
397 PhoneAppCallback callback = mTelephonyCallbacks[phoneId];
398 if (callback != null) {
399 tm.createForSubscriptionId(callback.getSubId())
400 .unregisterTelephonyCallback(callback);
401 mTelephonyCallbacks[phoneId] = null;
402 }
403 }
404 // Register callbacks for all active modems
405 for (int phoneId = 0; phoneId < activeModems; phoneId++) {
406 int sub = PhoneFactory.getPhone(phoneId).getSubId();
407 PhoneAppCallback callback = new PhoneAppCallback(sub);
408 tm.createForSubscriptionId(sub).registerTelephonyCallback(
409 TelephonyManager.INCLUDE_LOCATION_DATA_NONE, mHandler::post,
410 callback);
411 mTelephonyCallbacks[phoneId] = callback;
Jordan Liu06bdef12021-03-24 17:25:46 -0700412 }
Lei Liu863eac02020-06-24 20:12:55 +0800413 break;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700414 }
415 }
416 };
417
418 public PhoneGlobals(Context context) {
419 super(context);
420 sMe = this;
Jack Yu1a2fc352017-07-14 17:14:37 -0700421 mSettingsObserver = new SettingsObserver(context, mHandler);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700422 }
423
424 public void onCreate() {
425 if (VDBG) Log.v(LOG_TAG, "onCreate()...");
426
427 ContentResolver resolver = getContentResolver();
428
Hall Liuaa4211e2021-01-20 15:43:39 -0800429 // Initialize the shim from frameworks/opt/telephony into packages/services/Telephony.
430 TelephonyLocalConnection.setInstance(new LocalConnectionImpl(this));
431
Sarah Chin072ffb22022-05-03 17:58:59 -0700432 TelephonyManager tm = getSystemService(TelephonyManager.class);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700433 // Cache the "voice capable" flag.
434 // This flag currently comes from a resource (which is
435 // overrideable on a per-product basis):
Sarah Chin072ffb22022-05-03 17:58:59 -0700436 sVoiceCapable = tm.isVoiceCapable();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700437 // ...but this might eventually become a PackageManager "system
438 // feature" instead, in which case we'd do something like:
439 // sVoiceCapable =
440 // getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_VOICE_CALLS);
441
Stuart Scottdcf40a92014-12-09 10:45:01 -0800442 if (mCM == null) {
Nathan Haroldf9df6ea2019-03-08 11:54:22 -0800443 // Initialize AnomalyReporter early so that it can be used
444 AnomalyReporter.initialize(this);
Nathan Harold0db5c5e2019-01-22 20:18:56 -0800445
Youming Ye47a6adc2018-11-19 15:33:36 -0800446 // Inject telephony component factory if configured using other jars.
447 XmlResourceParser parser = getResources().getXml(R.xml.telephony_injection);
448 TelephonyComponentFactory.getInstance().injectTheComponentFactory(parser);
Hwangoo Parkba21cf22022-11-30 14:34:04 +0000449
450 // Create DomainSelectionResolver always, but it MUST be initialized only when
451 // the device supports AOSP domain selection architecture and
452 // has new IRadio that supports its related HAL APIs.
453 DomainSelectionResolver.make(this,
454 getResources().getBoolean(R.bool.config_enable_aosp_domain_selection));
455
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700456 // Initialize the telephony framework
457 PhoneFactory.makeDefaultPhones(this);
458
Hwangoo Parkba21cf22022-11-30 14:34:04 +0000459 // Initialize the DomainSelectionResolver after creating the Phone instance
460 // to check the Radio HAL version.
461 if (DomainSelectionResolver.getInstance().isDomainSelectionSupported()) {
462 mDomainSelectionService = new TelephonyDomainSelectionService(this);
463 DomainSelectionResolver.getInstance().initialize(mDomainSelectionService);
Daniel Bantab26e96f2022-10-19 23:25:35 +0000464 // Initialize EmergencyStateTracker if domain selection is supported
465 boolean isSuplDdsSwitchRequiredForEmergencyCall = getResources()
466 .getBoolean(R.bool.config_gnss_supl_requires_default_data_for_emergency);
467 EmergencyStateTracker.make(this, isSuplDdsSwitchRequiredForEmergencyCall);
Hwangoo Parkba21cf22022-11-30 14:34:04 +0000468 }
469
Brad Ebinger05f52c22019-12-05 13:03:21 -0800470 // Only bring up ImsResolver if the device supports having an IMS stack.
471 if (getPackageManager().hasSystemFeature(
472 PackageManager.FEATURE_TELEPHONY_IMS)) {
473 // Get the package name of the default IMS implementation.
474 String defaultImsMmtelPackage = getResources().getString(
475 R.string.config_ims_mmtel_package);
476 String defaultImsRcsPackage = getResources().getString(
477 R.string.config_ims_rcs_package);
Brad Ebingerd1947d82021-05-17 20:54:49 +0000478 ImsResolver.make(this, defaultImsMmtelPackage,
Brad Ebingere3ae65a2020-09-11 12:45:11 -0700479 defaultImsRcsPackage, PhoneFactory.getPhones().length,
480 new ImsFeatureBinderRepository());
Brad Ebingerd1947d82021-05-17 20:54:49 +0000481 ImsResolver.getInstance().initialize();
Tyler Gunn92479152021-01-20 16:30:10 -0800482
483 // With the IMS phone created, load static config.xml values from the phone process
484 // so that it can be provided to the ImsPhoneCallTracker.
485 for (Phone p : PhoneFactory.getPhones()) {
486 Phone imsPhone = p.getImsPhone();
487 if (imsPhone != null && imsPhone instanceof ImsPhone) {
488 ImsPhone theImsPhone = (ImsPhone) imsPhone;
489 if (theImsPhone.getCallTracker() instanceof ImsPhoneCallTracker) {
490 ImsPhoneCallTracker ict = (ImsPhoneCallTracker)
491 theImsPhone.getCallTracker();
492
493 ImsPhoneCallTracker.Config config = new ImsPhoneCallTracker.Config();
494 config.isD2DCommunicationSupported = getResources().getBoolean(
495 R.bool.config_use_device_to_device_communication);
496 ict.setConfig(config);
497 }
498 }
499 }
Hui Wang068ab862020-10-31 05:12:53 +0000500 RcsProvisioningMonitor.make(this);
Brad Ebinger05f52c22019-12-05 13:03:21 -0800501 }
502
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700503 // Start TelephonyDebugService After the default phone is created.
504 Intent intent = new Intent(this, TelephonyDebugService.class);
505 startService(intent);
506
507 mCM = CallManager.getInstance();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700508
509 // Create the NotificationMgr singleton, which is used to display
510 // status bar icons and control other status bar behavior.
511 notificationMgr = NotificationMgr.init(this);
512
Anthony Lee03ebdfc2015-07-27 08:12:02 -0700513 // Create an instance of CdmaPhoneCallState and initialize it to IDLE
514 cdmaPhoneCallState = new CdmaPhoneCallState();
515 cdmaPhoneCallState.CdmaPhoneCallStateInit();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700516
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700517 // before registering for phone state changes
518 mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
519 mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, LOG_TAG);
520 // lock used to keep the processor awake, when we don't care for the display.
521 mPartialWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK
522 | PowerManager.ON_AFTER_RELEASE, LOG_TAG);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700523
524 mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
525
Nazanin Bakhshi2f2cc692018-12-11 15:15:39 -0800526 phoneMgr = PhoneInterfaceManager.init(this);
Santos Cordon406c0342013-08-28 00:07:47 -0700527
James.cf Linaf3183c2019-10-24 00:59:00 +0800528 imsRcsController = ImsRcsController.init(this);
529
James.cf Linc9f35a42020-01-15 02:35:22 +0800530 if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS)) {
Hunsuk Choi3b742d62021-10-25 19:48:34 +0000531 mImsStateCallbackController =
532 ImsStateCallbackController.make(this, PhoneFactory.getPhones().length);
Brad Ebingera68a4972020-01-30 17:31:23 -0800533 mTelephonyRcsService = new TelephonyRcsService(this,
534 PhoneFactory.getPhones().length);
535 mTelephonyRcsService.initialize();
James.cf Linc9f35a42020-01-15 02:35:22 +0800536 imsRcsController.setRcsService(mTelephonyRcsService);
joonhunshincffb7fc2021-11-28 07:32:01 +0000537 mImsProvisioningController =
538 ImsProvisioningController.make(this, PhoneFactory.getPhones().length);
James.cf Linc9f35a42020-01-15 02:35:22 +0800539 }
540
Jonathan Basseri6465afd2015-02-25 13:05:57 -0800541 configLoader = CarrierConfigLoader.init(this);
542
Jack Yu1a2fc352017-07-14 17:14:37 -0700543 // Create the CallNotifier singleton, which handles
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700544 // asynchronous events from the telephony layer (like
545 // launching the incoming-call UI when an incoming call comes
546 // in.)
Brad Ebingera9c6b6d2016-01-07 17:24:16 -0800547 notifier = CallNotifier.init(this);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700548
Stuart Scottdcf40a92014-12-09 10:45:01 -0800549 PhoneUtils.registerIccStatus(mHandler, EVENT_SIM_NETWORK_LOCKED);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700550
551 // register for MMI/USSD
552 mCM.registerForMmiComplete(mHandler, MMI_COMPLETE, null);
553
Qiong Liucc3fe812019-09-23 15:25:44 +0800554 // Initialize cell status using current airplane mode.
Taesu Lee62f826d2020-08-10 16:01:18 +0900555 handleAirplaneModeChange(
556 Settings.Global.getInt(
557 getContentResolver(),
558 Settings.Global.AIRPLANE_MODE_ON,
559 AIRPLANE_OFF)
560 == AIRPLANE_ON);
Qiong Liucc3fe812019-09-23 15:25:44 +0800561
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700562 // Register for misc other intent broadcasts.
563 IntentFilter intentFilter =
564 new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700565 intentFilter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
566 intentFilter.addAction(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700567 intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
Jack Yu1a2fc352017-07-14 17:14:37 -0700568 intentFilter.addAction(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
569 intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700570 registerReceiver(mReceiver, intentFilter);
571
Sarah Chin072ffb22022-05-03 17:58:59 -0700572 PhoneConfigurationManager.registerForMultiSimConfigChange(
573 mHandler, EVENT_MULTI_SIM_CONFIG_CHANGED, null);
574
575 mTelephonyCallbacks = new PhoneAppCallback[tm.getSupportedModemCount()];
Fangyuan Li7f5c2752022-06-29 18:02:31 +0800576 if (tm.getSupportedModemCount() > 0) {
577 for (Phone phone : PhoneFactory.getPhones()) {
578 int subId = phone.getSubId();
579 PhoneAppCallback callback = new PhoneAppCallback(subId);
580 tm.createForSubscriptionId(subId).registerTelephonyCallback(
581 TelephonyManager.INCLUDE_LOCATION_DATA_NONE, mHandler::post, callback);
582 mTelephonyCallbacks[phone.getPhoneId()] = callback;
583 }
Sarah Chin072ffb22022-05-03 17:58:59 -0700584 }
Ta-wei Yenf0a71bc2017-05-17 12:28:28 -0700585 mCarrierVvmPackageInstalledReceiver.register(this);
586
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700587 //set the default values for the preferences in the phone.
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700588 PreferenceManager.setDefaultValues(this, R.xml.call_feature_setting, false);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700589 }
590
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700591 // XXX pre-load the SimProvider so that it's ready
592 resolver.getType(Uri.parse("content://icc/adn"));
593
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700594 // TODO: Register for Cdma Information Records
595 // phone.registerCdmaInformationRecord(mHandler, EVENT_UNSOL_CDMA_INFO_RECORD, null);
596
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700597 // Read HAC settings and configure audio hardware
598 if (getResources().getBoolean(R.bool.hac_enabled)) {
Stuart Scottdcf40a92014-12-09 10:45:01 -0800599 int hac = android.provider.Settings.System.getInt(
600 getContentResolver(),
601 android.provider.Settings.System.HEARING_AID,
602 0);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700603 AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
Jordan Liuf71aeef2019-08-21 11:46:09 -0700604 audioManager.setParameters(
605 SettingsConstants.HAC_KEY + "=" + (hac == SettingsConstants.HAC_ENABLED
606 ? SettingsConstants.HAC_VAL_ON : SettingsConstants.HAC_VAL_OFF));
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700607 }
Siim Sammul182d61b2021-05-04 16:01:42 +0100608
609 // Start tracking Binder latency for the phone process.
610 mBinderCallsSettingsObserver = new BinderCallsStats.SettingsObserver(
611 getApplicationContext(),
Siim Sammula6950092021-06-22 17:14:03 +0100612 new BinderCallsStats(
613 new BinderCallsStats.Injector(),
614 com.android.internal.os.BinderLatencyProto.Dims.TELEPHONY));
Santos Cordonff506f52013-11-21 19:13:19 -0800615 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700616
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700617 /**
618 * Returns the singleton instance of the PhoneApp.
619 */
Sailesh Nepal1eaf22b2014-02-22 17:00:49 -0800620 public static PhoneGlobals getInstance() {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700621 if (sMe == null) {
622 throw new IllegalStateException("No PhoneGlobals here!");
623 }
624 return sMe;
625 }
626
627 /**
Stuart Scottdcf40a92014-12-09 10:45:01 -0800628 * Returns the default phone.
629 *
Andrew Lee385019f2014-11-24 14:19:50 -0800630 * WARNING: This method should be used carefully, now that there may be multiple phones.
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700631 */
Andrew Lee83383e42014-10-31 12:42:28 -0700632 public static Phone getPhone() {
Stuart Scottdcf40a92014-12-09 10:45:01 -0800633 return PhoneFactory.getDefaultPhone();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700634 }
635
Andrew Lee2fcb6c32014-12-04 14:52:35 -0800636 public static Phone getPhone(int subId) {
637 return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
Andrew Lee385019f2014-11-24 14:19:50 -0800638 }
639
Santos Cordonde10b752013-09-19 04:11:33 -0700640 /* package */ CallManager getCallManager() {
641 return mCM;
642 }
643
Chris Manton4e9fa912015-06-19 11:26:57 -0700644 public PersistableBundle getCarrierConfig() {
Shishir Agrawald3480e02016-01-25 13:05:49 -0800645 return getCarrierConfigForSubId(SubscriptionManager.getDefaultSubscriptionId());
Jonathan Basseri89b0ab42015-05-01 10:52:40 -0700646 }
647
Chris Manton4e9fa912015-06-19 11:26:57 -0700648 public PersistableBundle getCarrierConfigForSubId(int subId) {
Philip P. Moltmann0079aae2020-03-05 16:24:02 -0800649 return configLoader.getConfigForSubIdWithFeature(subId, getOpPackageName(),
650 getAttributionTag());
Junda Liu605148f2015-04-28 15:23:40 -0700651 }
652
Jack Yu1a2fc352017-07-14 17:14:37 -0700653 private void registerSettingsObserver() {
654 mSettingsObserver.unobserve();
655 String dataRoamingSetting = Settings.Global.DATA_ROAMING;
656 String mobileDataSetting = Settings.Global.MOBILE_DATA;
657 if (TelephonyManager.getDefault().getSimCount() > 1) {
658 int subId = mDefaultDataSubId;
659 if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
660 dataRoamingSetting += subId;
661 mobileDataSetting += subId;
662 }
663 }
664
665 // Listen for user data roaming setting changed event
666 mSettingsObserver.observe(Settings.Global.getUriFor(dataRoamingSetting),
667 EVENT_DATA_ROAMING_SETTINGS_CHANGED);
668
669 // Listen for mobile data setting changed event
670 mSettingsObserver.observe(Settings.Global.getUriFor(mobileDataSetting),
671 EVENT_MOBILE_DATA_SETTINGS_CHANGED);
672 }
673
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700674 /**
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700675 * Sets the activity responsible for un-PUK-blocking the device
676 * so that we may close it when we receive a positive result.
677 * mPUKEntryActivity is also used to indicate to the device that
678 * we are trying to un-PUK-lock the phone. In other words, iff
679 * it is NOT null, then we are trying to unlock and waiting for
680 * the SIM to move to READY state.
681 *
682 * @param activity is the activity to close when PUK has
683 * finished unlocking. Can be set to null to indicate the unlock
684 * or SIM READYing process is over.
685 */
686 void setPukEntryActivity(Activity activity) {
Tyler Gunn3fc09c02020-05-08 16:35:55 -0700687 Log.i(LOG_TAG, "setPukEntryActivity - set to " + (activity == null ? "null" : "activity"));
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700688 mPUKEntryActivity = activity;
689 }
690
691 Activity getPUKEntryActivity() {
692 return mPUKEntryActivity;
693 }
694
695 /**
696 * Sets the dialog responsible for notifying the user of un-PUK-
697 * blocking - SIM READYing progress, so that we may dismiss it
698 * when we receive a positive result.
699 *
700 * @param dialog indicates the progress dialog informing the user
701 * of the state of the device. Dismissed upon completion of
702 * READYing process
703 */
704 void setPukEntryProgressDialog(ProgressDialog dialog) {
Tyler Gunn3fc09c02020-05-08 16:35:55 -0700705 Log.i(LOG_TAG, "setPukEntryProgressDialog - set to "
706 + (dialog == null ? "null" : "activity"));
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700707 mPUKEntryProgressDialog = dialog;
708 }
709
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700710 KeyguardManager getKeyguardManager() {
711 return mKeyguardManager;
712 }
713
714 private void onMMIComplete(AsyncResult r) {
715 if (VDBG) Log.d(LOG_TAG, "onMMIComplete()...");
716 MmiCode mmiCode = (MmiCode) r.result;
Stuart Scottdcf40a92014-12-09 10:45:01 -0800717 PhoneUtils.displayMMIComplete(mmiCode.getPhone(), getInstance(), mmiCode, null, null);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700718 }
719
fionaxu80126972017-02-01 17:01:26 -0800720 private void initForNewRadioTechnology() {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700721 if (DBG) Log.d(LOG_TAG, "initForNewRadioTechnology...");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700722 notifier.updateCallNotifierRegistrationsAfterRadioTechnologyChange();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700723 }
724
Taesu Lee62f826d2020-08-10 16:01:18 +0900725 private void handleAirplaneModeChange(boolean isAirplaneNewlyOn) {
726 int cellState =
727 Settings.Global.getInt(
728 getContentResolver(), Settings.Global.CELL_ON, PhoneConstants.CELL_ON_FLAG);
Chris Mantona09f3632016-02-09 14:48:42 -0800729 switch (cellState) {
730 case PhoneConstants.CELL_OFF_FLAG:
731 // Airplane mode does not affect the cell radio if user
732 // has turned it off.
733 break;
734 case PhoneConstants.CELL_ON_FLAG:
Taesu Lee62f826d2020-08-10 16:01:18 +0900735 maybeTurnCellOff(isAirplaneNewlyOn);
Chris Mantona09f3632016-02-09 14:48:42 -0800736 break;
737 case PhoneConstants.CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG:
Taesu Lee62f826d2020-08-10 16:01:18 +0900738 maybeTurnCellOn(isAirplaneNewlyOn);
Chris Mantona09f3632016-02-09 14:48:42 -0800739 break;
740 }
Hall Liu7f56e1a2019-07-10 14:41:14 -0700741 for (Phone phone : PhoneFactory.getPhones()) {
742 phone.getServiceStateTracker().onAirplaneModeChanged(isAirplaneNewlyOn);
743 }
Chris Mantona09f3632016-02-09 14:48:42 -0800744 }
745
746 /*
747 * Returns true if the radio must be turned off when entering airplane mode.
748 */
Taesu Lee62f826d2020-08-10 16:01:18 +0900749 private boolean isCellOffInAirplaneMode() {
750 String airplaneModeRadios =
751 Settings.Global.getString(
752 getContentResolver(), Settings.Global.AIRPLANE_MODE_RADIOS);
Chris Mantona09f3632016-02-09 14:48:42 -0800753 return airplaneModeRadios == null
754 || airplaneModeRadios.contains(Settings.Global.RADIO_CELL);
755 }
756
Taesu Lee62f826d2020-08-10 16:01:18 +0900757 private void setRadioPowerOff() {
Chris Mantona09f3632016-02-09 14:48:42 -0800758 Log.i(LOG_TAG, "Turning radio off - airplane");
Taesu Lee62f826d2020-08-10 16:01:18 +0900759 Settings.Global.putInt(
760 getContentResolver(),
761 Settings.Global.CELL_ON,
762 PhoneConstants.CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG);
Chris Mantona09f3632016-02-09 14:48:42 -0800763 Settings.Global.putInt(getContentResolver(), Settings.Global.ENABLE_CELLULAR_ON_BOOT, 0);
Taesu Lee62f826d2020-08-10 16:01:18 +0900764 TelephonyProperties.airplane_mode_on(true); // true means int value 1
Chris Mantona09f3632016-02-09 14:48:42 -0800765 PhoneUtils.setRadioPower(false);
Ling Ma317906d2022-12-05 15:58:14 -0800766 clearCacheOnRadioOff();
767 }
768
769 /** Clear fields on power off radio **/
770 private void clearCacheOnRadioOff() {
771 // Re-show is-roaming notifications after APM mode
772 mPrevRoamingOperatorNumerics.clear();
Chris Mantona09f3632016-02-09 14:48:42 -0800773 }
774
Taesu Lee62f826d2020-08-10 16:01:18 +0900775 private void setRadioPowerOn() {
Chris Mantona09f3632016-02-09 14:48:42 -0800776 Log.i(LOG_TAG, "Turning radio on - airplane");
Taesu Lee62f826d2020-08-10 16:01:18 +0900777 Settings.Global.putInt(
778 getContentResolver(), Settings.Global.CELL_ON, PhoneConstants.CELL_ON_FLAG);
779 Settings.Global.putInt(getContentResolver(), Settings.Global.ENABLE_CELLULAR_ON_BOOT, 1);
Meng Wang61307622019-10-23 14:08:43 -0700780 TelephonyProperties.airplane_mode_on(false); // false means int value 0
Chris Mantona09f3632016-02-09 14:48:42 -0800781 PhoneUtils.setRadioPower(true);
782 }
783
Taesu Lee62f826d2020-08-10 16:01:18 +0900784 private void maybeTurnCellOff(boolean isAirplaneNewlyOn) {
Chris Mantona09f3632016-02-09 14:48:42 -0800785 if (isAirplaneNewlyOn) {
Santos Cordone18902f2016-03-22 17:16:04 -0700786 // If we are trying to turn off the radio, make sure there are no active
787 // emergency calls. If there are, switch airplane mode back to off.
Taesu Lee62f826d2020-08-10 16:01:18 +0900788 TelecomManager tm = (TelecomManager) getSystemService(TELECOM_SERVICE);
Tyler Gunn900d8fd2018-09-21 09:22:12 -0700789
790 if (tm != null && tm.isInEmergencyCall()) {
Santos Cordone18902f2016-03-22 17:16:04 -0700791 // Switch airplane mode back to off.
Jordan Liu0e819b12019-08-28 15:33:05 -0700792 ConnectivityManager cm =
Taesu Lee62f826d2020-08-10 16:01:18 +0900793 (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
Jordan Liu0e819b12019-08-28 15:33:05 -0700794 cm.setAirplaneMode(false);
Santos Cordone18902f2016-03-22 17:16:04 -0700795 Toast.makeText(this, R.string.radio_off_during_emergency_call, Toast.LENGTH_LONG)
796 .show();
797 Log.i(LOG_TAG, "Ignoring airplane mode: emergency call. Turning airplane off");
Taesu Lee62f826d2020-08-10 16:01:18 +0900798 } else if (isCellOffInAirplaneMode()) {
799 setRadioPowerOff();
Santos Cordone18902f2016-03-22 17:16:04 -0700800 } else {
Chris Mantona09f3632016-02-09 14:48:42 -0800801 Log.i(LOG_TAG, "Ignoring airplane mode: settings prevent cell radio power off");
Santos Cordone18902f2016-03-22 17:16:04 -0700802 }
Chris Mantona09f3632016-02-09 14:48:42 -0800803 }
804 }
805
Taesu Lee62f826d2020-08-10 16:01:18 +0900806 private void maybeTurnCellOn(boolean isAirplaneNewlyOn) {
Chris Mantona09f3632016-02-09 14:48:42 -0800807 if (!isAirplaneNewlyOn) {
Taesu Lee62f826d2020-08-10 16:01:18 +0900808 setRadioPowerOn();
Santos Cordone18902f2016-03-22 17:16:04 -0700809 }
810 }
811
Santos Cordon593ab382013-08-06 21:58:23 -0700812 /**
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700813 * Receiver for misc intent broadcasts the Phone app cares about.
814 */
815 private class PhoneAppBroadcastReceiver extends BroadcastReceiver {
816 @Override
817 public void onReceive(Context context, Intent intent) {
818 String action = intent.getAction();
819 if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
Taesu Lee3dc572b2020-08-07 18:16:22 +0900820 boolean airplaneMode = intent.getBooleanExtra("state", false);
Taesu Lee62f826d2020-08-10 16:01:18 +0900821 handleAirplaneModeChange(airplaneMode);
Amit Mahajanf5d92c82018-11-02 17:44:40 -0700822 } else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
823 // re-register as it may be a new IccCard
824 int phoneId = intent.getIntExtra(PhoneConstants.PHONE_KEY,
825 SubscriptionManager.INVALID_PHONE_INDEX);
826 if (SubscriptionManager.isValidPhoneId(phoneId)) {
827 PhoneUtils.unregisterIccStatus(mHandler, phoneId);
828 PhoneUtils.registerIccStatus(mHandler, EVENT_SIM_NETWORK_LOCKED, phoneId);
829 }
Nazish Tabassum160d2112019-12-23 17:31:33 +0530830 String iccStatus = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
831 mHandler.sendMessage(mHandler.obtainMessage(EVENT_SIM_STATE_CHANGED,
832 new EventSimStateChangedBag(phoneId, iccStatus)));
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700833 } else if (action.equals(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED)) {
834 String newPhone = intent.getStringExtra(PhoneConstants.PHONE_NAME_KEY);
fionaxu80126972017-02-01 17:01:26 -0800835 Log.d(LOG_TAG, "Radio technology switched. Now " + newPhone + " is active.");
836 initForNewRadioTechnology();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700837 } else if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) {
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530838 int phoneId = intent.getIntExtra(PhoneConstants.PHONE_KEY, 0);
Srikanth Chintala079912a2016-03-03 16:35:01 +0530839 phoneInEcm = PhoneFactory.getPhone(phoneId);
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530840 Log.d(LOG_TAG, "Emergency Callback Mode. phoneId:" + phoneId);
841 if (phoneInEcm != null) {
842 if (TelephonyCapabilities.supportsEcm(phoneInEcm)) {
843 Log.d(LOG_TAG, "Emergency Callback Mode arrived in PhoneApp.");
844 // Start Emergency Callback Mode service
Daniel Bright30efde42020-01-09 22:11:15 -0800845 if (intent.getBooleanExtra(
846 TelephonyManager.EXTRA_PHONE_IN_ECM_STATE, false)) {
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530847 context.startService(new Intent(context,
848 EmergencyCallbackModeService.class));
849 } else {
850 phoneInEcm = null;
851 }
852 } else {
853 // It doesn't make sense to get ACTION_EMERGENCY_CALLBACK_MODE_CHANGED
854 // on a device that doesn't support ECM in the first place.
855 Log.e(LOG_TAG, "Got ACTION_EMERGENCY_CALLBACK_MODE_CHANGED, but "
856 + "ECM isn't supported for phone: " + phoneInEcm.getPhoneName());
857 phoneInEcm = null;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700858 }
859 } else {
Sandeep Kuntade73a6a2014-10-15 18:45:56 +0530860 Log.w(LOG_TAG, "phoneInEcm is null.");
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700861 }
Jack Yu1a2fc352017-07-14 17:14:37 -0700862 } else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
863 // Roaming status could be overridden by carrier config, so we need to update it.
864 if (VDBG) Log.v(LOG_TAG, "carrier config changed.");
865 updateDataRoamingStatus();
chen xubaf9fe52019-07-02 17:28:24 -0700866 updateLimitedSimFunctionForDualSim();
Lei Liu863eac02020-06-24 20:12:55 +0800867 int subId = intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
868 SubscriptionManager.INVALID_SUBSCRIPTION_ID);
869 if (SubscriptionManager.isValidSubscriptionId(subId)) {
870 mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARRIER_CONFIG_CHANGED,
871 new Integer(subId)));
872 }
Jack Yu1a2fc352017-07-14 17:14:37 -0700873 } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
874 // We also need to pay attention when default data subscription changes.
875 if (VDBG) Log.v(LOG_TAG, "default data sub changed.");
876 mDefaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId();
877 registerSettingsObserver();
878 Phone phone = getPhone(mDefaultDataSubId);
879 if (phone != null) {
880 updateDataRoamingStatus();
881 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700882 }
883 }
884 }
885
Sarah Chin072ffb22022-05-03 17:58:59 -0700886 private void handleServiceStateChanged(ServiceState serviceState, int subId) {
Jack Yu1a2fc352017-07-14 17:14:37 -0700887 if (VDBG) Log.v(LOG_TAG, "handleServiceStateChanged");
Sarah Chin072ffb22022-05-03 17:58:59 -0700888 int state = serviceState.getState();
889 notificationMgr.updateNetworkSelection(state, subId);
Jack Yu1a2fc352017-07-14 17:14:37 -0700890
Sarah Chin072ffb22022-05-03 17:58:59 -0700891 if (VDBG) {
892 Log.v(LOG_TAG, "subId=" + subId + ", mDefaultDataSubId="
893 + mDefaultDataSubId + ", ss roaming=" + serviceState.getDataRoaming());
894 }
895 if (subId == mDefaultDataSubId) {
Ling Ma317906d2022-12-05 15:58:14 -0800896 updateDataRoamingStatus(serviceState.getOperatorNumeric());
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700897 }
898 }
899
Jack Yu1a2fc352017-07-14 17:14:37 -0700900 /**
901 * When roaming, if mobile data cannot be established due to data roaming not enabled, we need
902 * to notify the user so they can enable it through settings. Vise versa if the condition
903 * changes, we need to dismiss the notification.
904 */
905 private void updateDataRoamingStatus() {
Ling Ma317906d2022-12-05 15:58:14 -0800906 updateDataRoamingStatus(null /*roamingOperatorNumeric*/);
907 }
908
909 /**
910 * When roaming, if mobile data cannot be established due to data roaming not enabled, we need
911 * to notify the user so they can enable it through settings. Vise versa if the condition
912 * changes, we need to dismiss the notification.
913 * @param roamingOperatorNumeric The operator numeric for the current roaming. {@code null} if
914 * the current roaming operator numeric didn't change.
915 */
916 private void updateDataRoamingStatus(@Nullable String roamingOperatorNumeric) {
Jack Yu1a2fc352017-07-14 17:14:37 -0700917 if (VDBG) Log.v(LOG_TAG, "updateDataRoamingStatus");
918 Phone phone = getPhone(mDefaultDataSubId);
919 if (phone == null) {
920 Log.w(LOG_TAG, "Can't get phone with sub id = " + mDefaultDataSubId);
921 return;
922 }
923
Jack Yu3e2ac6e2022-03-26 13:59:45 -0700924 boolean dataAllowed;
925 boolean notAllowedDueToRoamingOff;
Sarah Chine04784a2022-10-31 20:32:34 -0700926 List<DataDisallowedReason> reasons = phone.getDataNetworkController()
927 .getInternetDataDisallowedReasons();
Jack Yu7968c6d2022-07-31 00:43:21 -0700928 dataAllowed = reasons.isEmpty();
929 notAllowedDueToRoamingOff = (reasons.size() == 1
930 && reasons.contains(DataDisallowedReason.ROAMING_DISABLED));
Ling Ma317906d2022-12-05 15:58:14 -0800931 mDataRoamingNotifLog.log("dataAllowed=" + dataAllowed + ", reasons=" + reasons
932 + ", roamingOperatorNumeric=" + roamingOperatorNumeric);
933 if (VDBG) {
934 Log.v(LOG_TAG, "dataAllowed=" + dataAllowed + ", reasons=" + reasons
935 + ", roamingOperatorNumeric=" + roamingOperatorNumeric);
936 }
Jack Yu3e2ac6e2022-03-26 13:59:45 -0700937
938 if (!dataAllowed && notAllowedDueToRoamingOff) {
Ling Ma4e15c322022-12-07 11:20:53 -0800939 // Don't show roaming notification if we've already shown for this MccMnc
940 if (roamingOperatorNumeric != null
941 && !mPrevRoamingOperatorNumerics.add(roamingOperatorNumeric)) {
942 Log.d(LOG_TAG, "Skip roaming disconnected notification since already shown in "
943 + "MccMnc " + roamingOperatorNumeric);
944 return;
945 }
Jordan Liuff2ccd72019-07-23 15:54:41 -0700946 // No need to show it again if we never cancelled it explicitly.
947 if (mPrevRoamingNotification == ROAMING_NOTIFICATION_DISCONNECTED) return;
Jack Yu1a2fc352017-07-14 17:14:37 -0700948 // If the only reason of no data is data roaming disabled, then we notify the user
949 // so the user can turn on data roaming.
Jordan Liuff2ccd72019-07-23 15:54:41 -0700950 mPrevRoamingNotification = ROAMING_NOTIFICATION_DISCONNECTED;
Jack Yu1a2fc352017-07-14 17:14:37 -0700951 Log.d(LOG_TAG, "Show roaming disconnected notification");
Jordan Liuff2ccd72019-07-23 15:54:41 -0700952 mDataRoamingNotifLog.log("Show roaming off.");
Pengquan Meng8783d932017-10-16 14:57:40 -0700953 Message msg = mHandler.obtainMessage(EVENT_DATA_ROAMING_DISCONNECTED);
954 msg.arg1 = mDefaultDataSubId;
955 msg.sendToTarget();
Ling Ma317906d2022-12-05 15:58:14 -0800956 } else if (dataAllowed && dataIsNowRoaming(mDefaultDataSubId)) {
Ling Ma4e15c322022-12-07 11:20:53 -0800957 boolean isShowRoamingNotificationEnabled = getCarrierConfigForSubId(mDefaultDataSubId)
958 .getBoolean(CarrierConfigManager
959 .KEY_SHOW_DATA_CONNECTED_ROAMING_NOTIFICATION_BOOL);
960 if (!isShowRoamingNotificationEnabled) return;
961 // Don't show roaming notification if we've already shown for this MccMnc
962 if (roamingOperatorNumeric != null
963 && !mPrevRoamingOperatorNumerics.add(roamingOperatorNumeric)) {
964 Log.d(LOG_TAG, "Skip roaming connected notification since already shown in "
965 + "MccMnc " + roamingOperatorNumeric);
966 return;
967 }
Jordan Liuff2ccd72019-07-23 15:54:41 -0700968 // No need to show it again if we never cancelled it explicitly, or carrier config
969 // indicates this is not needed.
970 if (mPrevRoamingNotification == ROAMING_NOTIFICATION_CONNECTED) return;
971 mPrevRoamingNotification = ROAMING_NOTIFICATION_CONNECTED;
972 Log.d(LOG_TAG, "Show roaming connected notification");
973 mDataRoamingNotifLog.log("Show roaming on.");
974 Message msg = mHandler.obtainMessage(EVENT_DATA_ROAMING_CONNECTED);
975 msg.arg1 = mDefaultDataSubId;
976 msg.sendToTarget();
977 } else if (mPrevRoamingNotification != ROAMING_NOTIFICATION_NO_NOTIFICATION) {
978 // Otherwise we either 1) we are not roaming or 2) roaming is off but ROAMING_DISABLED
979 // is not the only data disable reason. In this case we dismiss the notification we
980 // showed earlier.
981 mPrevRoamingNotification = ROAMING_NOTIFICATION_NO_NOTIFICATION;
982 Log.d(LOG_TAG, "Dismiss roaming notification");
Jack Yu3e2ac6e2022-03-26 13:59:45 -0700983 mDataRoamingNotifLog.log("Hide. data allowed=" + dataAllowed);
Jack Yu1a2fc352017-07-14 17:14:37 -0700984 mHandler.sendEmptyMessage(EVENT_DATA_ROAMING_OK);
985 }
986 }
987
Jordan Liuff2ccd72019-07-23 15:54:41 -0700988 /**
989 *
990 * @param subId to check roaming on
991 * @return whether we have transitioned to dataRoaming
992 */
993 private boolean dataIsNowRoaming(int subId) {
Sarah Chine04784a2022-10-31 20:32:34 -0700994 return getPhone(subId).getServiceState().getDataRoaming();
Jordan Liuff2ccd72019-07-23 15:54:41 -0700995 }
996
chen xubaf9fe52019-07-02 17:28:24 -0700997 private void updateLimitedSimFunctionForDualSim() {
998 if (DBG) Log.d(LOG_TAG, "updateLimitedSimFunctionForDualSim");
999 // check conditions to display limited SIM function notification under dual SIM
1000 SubscriptionManager subMgr = (SubscriptionManager) getSystemService(
1001 Context.TELEPHONY_SUBSCRIPTION_SERVICE);
1002 List<SubscriptionInfo> subList = subMgr.getActiveSubscriptionInfoList(false);
1003 if (subList != null && subList.size() > 1) {
1004 CarrierConfigManager configMgr = (CarrierConfigManager)
1005 getSystemService(Context.CARRIER_CONFIG_SERVICE);
1006 for (SubscriptionInfo info : subList) {
1007 PersistableBundle b = configMgr.getConfigForSubId(info.getSubscriptionId());
1008 if (b != null) {
1009 if (b.getBoolean(CarrierConfigManager
1010 .KEY_LIMITED_SIM_FUNCTION_NOTIFICATION_FOR_DSDS_BOOL)) {
1011 notificationMgr.showLimitedSimFunctionWarningNotification(
1012 info.getSubscriptionId(),
1013 info.getDisplayName().toString());
1014 } else {
1015 notificationMgr.dismissLimitedSimFunctionWarningNotification(
1016 info.getSubscriptionId());
1017 }
1018 }
1019 }
1020 } else {
1021 // cancel notifications for all subs
1022 notificationMgr.dismissLimitedSimFunctionWarningNotification(
1023 SubscriptionManager.INVALID_SUBSCRIPTION_ID);
1024 }
1025 notificationMgr.dismissLimitedSimFunctionWarningNotificationForInactiveSubs();
1026
1027 }
1028
Sandeep Kuntade73a6a2014-10-15 18:45:56 +05301029 public Phone getPhoneInEcm() {
1030 return phoneInEcm;
1031 }
1032
Santos Cordon7d4ddf62013-07-10 11:58:08 -07001033 /**
Tyler Gunn9c1071f2014-12-09 10:07:54 -08001034 * Triggers a refresh of the message waiting (voicemail) indicator.
1035 *
1036 * @param subId the subscription id we should refresh the notification for.
1037 */
1038 public void refreshMwiIndicator(int subId) {
1039 notificationMgr.refreshMwi(subId);
1040 }
1041
1042 /**
Pengquan Mengdd9ac822018-09-20 15:25:35 -07001043 * Called when the network selection on the subscription {@code subId} is changed by the user.
1044 *
1045 * @param subId the subscription id.
1046 */
1047 public void onNetworkSelectionChanged(int subId) {
1048 Phone phone = getPhone(subId);
1049 if (phone != null) {
1050 notificationMgr.updateNetworkSelection(phone.getServiceState().getState(), subId);
1051 } else {
1052 Log.w(LOG_TAG, "onNetworkSelectionChanged on null phone, subId: " + subId);
1053 }
1054 }
1055
1056 /**
James.cf Lin4b784aa2021-01-31 03:25:15 +08001057 * @return whether the device supports RCS User Capability Exchange or not.
1058 */
1059 public boolean getDeviceUceEnabled() {
1060 return (mTelephonyRcsService == null) ? false : mTelephonyRcsService.isDeviceUceEnabled();
1061 }
1062
1063 /**
1064 * Set the device supports RCS User Capability Exchange.
1065 * @param isEnabled true if the device supports UCE.
1066 */
1067 public void setDeviceUceEnabled(boolean isEnabled) {
1068 if (mTelephonyRcsService != null) {
1069 mTelephonyRcsService.setDeviceUceEnabled(isEnabled);
1070 }
1071 }
1072
1073 /**
Jack Yu1a2fc352017-07-14 17:14:37 -07001074 * Dump the state of the object, add calls to other objects as desired.
1075 *
1076 * @param fd File descriptor
1077 * @param printWriter Print writer
1078 * @param args Arguments
1079 */
1080 public void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) {
1081 IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, " ");
1082 pw.println("------- PhoneGlobals -------");
1083 pw.increaseIndent();
Jordan Liuff2ccd72019-07-23 15:54:41 -07001084 pw.println("mPrevRoamingNotification=" + mPrevRoamingNotification);
Jack Yu1a2fc352017-07-14 17:14:37 -07001085 pw.println("mDefaultDataSubId=" + mDefaultDataSubId);
1086 pw.println("mDataRoamingNotifLog:");
Keun young Parkdebb8532019-05-30 16:35:27 -07001087 pw.println("isSmsCapable=" + TelephonyManager.from(this).isSmsCapable());
Jack Yu1a2fc352017-07-14 17:14:37 -07001088 pw.increaseIndent();
1089 mDataRoamingNotifLog.dump(fd, pw, args);
1090 pw.decreaseIndent();
Brad Ebinger05f52c22019-12-05 13:03:21 -08001091 pw.println("ImsResolver:");
1092 pw.increaseIndent();
1093 try {
Brad Ebingerd1947d82021-05-17 20:54:49 +00001094 if (ImsResolver.getInstance() != null) ImsResolver.getInstance().dump(fd, pw, args);
Brad Ebinger05f52c22019-12-05 13:03:21 -08001095 } catch (Exception e) {
1096 e.printStackTrace();
1097 }
1098 pw.decreaseIndent();
Brad Ebingera68a4972020-01-30 17:31:23 -08001099 pw.println("RcsService:");
1100 try {
1101 if (mTelephonyRcsService != null) mTelephonyRcsService.dump(fd, pw, args);
1102 } catch (Exception e) {
1103 e.printStackTrace();
1104 }
Hunsuk Choi89bd22c2021-11-01 13:04:54 +00001105 pw.println("ImsStateCallbackController:");
1106 try {
1107 if (mImsStateCallbackController != null) mImsStateCallbackController.dump(pw);
1108 } catch (Exception e) {
1109 e.printStackTrace();
1110 }
Hwangoo Parkba21cf22022-11-30 14:34:04 +00001111 pw.println("DomainSelectionResolver:");
1112 pw.increaseIndent();
1113 try {
1114 if (DomainSelectionResolver.getInstance() != null) {
1115 DomainSelectionResolver.getInstance().dump(fd, pw, args);
1116 }
1117 } catch (Exception e) {
1118 e.printStackTrace();
1119 }
1120 pw.decreaseIndent();
1121 if (mDomainSelectionService != null) {
1122 mDomainSelectionService.dump(fd, pw, args);
1123 }
Jack Yu1a2fc352017-07-14 17:14:37 -07001124 pw.decreaseIndent();
Ling Ma317906d2022-12-05 15:58:14 -08001125 pw.println("mPrevRoamingOperatorNumerics:" + mPrevRoamingOperatorNumerics);
Jack Yu1a2fc352017-07-14 17:14:37 -07001126 pw.println("------- End PhoneGlobals -------");
1127 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -07001128}