Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.phone; |
| 18 | |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 19 | import android.annotation.IntDef; |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 20 | import android.annotation.Nullable; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 21 | import android.app.Activity; |
| 22 | import android.app.KeyguardManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 23 | import android.app.ProgressDialog; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 24 | import android.content.BroadcastReceiver; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 25 | import android.content.ContentResolver; |
| 26 | import android.content.Context; |
| 27 | import android.content.ContextWrapper; |
| 28 | import android.content.Intent; |
| 29 | import android.content.IntentFilter; |
Brad Ebinger | 05f52c2 | 2019-12-05 13:03:21 -0800 | [diff] [blame] | 30 | import android.content.pm.PackageManager; |
Youming Ye | 47a6adc | 2018-11-19 15:33:36 -0800 | [diff] [blame] | 31 | import android.content.res.XmlResourceParser; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 32 | import android.media.AudioManager; |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 33 | import android.net.ConnectivityManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 34 | import android.net.Uri; |
| 35 | import android.os.AsyncResult; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 36 | import android.os.Handler; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 37 | import android.os.Message; |
Jonathan Basseri | c31f1f3 | 2015-05-12 10:13:03 -0700 | [diff] [blame] | 38 | import android.os.PersistableBundle; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 39 | import android.os.PowerManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 40 | import android.os.SystemProperties; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 41 | import android.preference.PreferenceManager; |
Sanket Padawe | 4c69923 | 2016-02-09 11:07:22 -0800 | [diff] [blame] | 42 | import android.provider.Settings; |
Meng Wang | 6130762 | 2019-10-23 14:08:43 -0700 | [diff] [blame] | 43 | import android.sysprop.TelephonyProperties; |
Tyler Gunn | 900d8fd | 2018-09-21 09:22:12 -0700 | [diff] [blame] | 44 | import android.telecom.TelecomManager; |
Nathan Harold | f9df6ea | 2019-03-08 11:54:22 -0800 | [diff] [blame] | 45 | import android.telephony.AnomalyReporter; |
Junda Liu | 12f7d80 | 2015-05-01 12:06:44 -0700 | [diff] [blame] | 46 | import android.telephony.CarrierConfigManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 47 | import android.telephony.ServiceState; |
chen xu | baf9fe5 | 2019-07-02 17:28:24 -0700 | [diff] [blame] | 48 | import android.telephony.SubscriptionInfo; |
Andrew Lee | 385019f | 2014-11-24 14:19:50 -0800 | [diff] [blame] | 49 | import android.telephony.SubscriptionManager; |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 50 | import android.telephony.TelephonyCallback; |
Hall Liu | aa4211e | 2021-01-20 15:43:39 -0800 | [diff] [blame] | 51 | import android.telephony.TelephonyLocalConnection; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 52 | import android.telephony.TelephonyManager; |
Sarah Chin | 37b3907 | 2023-11-05 13:28:21 -0800 | [diff] [blame] | 53 | import android.text.TextUtils; |
Ling Ma | 317906d | 2022-12-05 15:58:14 -0800 | [diff] [blame] | 54 | import android.util.ArraySet; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 55 | import android.util.LocalLog; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 56 | import android.util.Log; |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 57 | import android.widget.Toast; |
Ta-wei Yen | b29425b | 2016-09-21 17:28:14 -0700 | [diff] [blame] | 58 | |
Brad Ebinger | e3ae65a | 2020-09-11 12:45:11 -0700 | [diff] [blame] | 59 | import com.android.ims.ImsFeatureBinderRepository; |
Siim Sammul | 182d61b | 2021-05-04 16:01:42 +0100 | [diff] [blame] | 60 | import com.android.internal.os.BinderCallsStats; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 61 | import com.android.internal.telephony.CallManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 62 | import com.android.internal.telephony.IccCardConstants; |
| 63 | import com.android.internal.telephony.MmiCode; |
| 64 | import com.android.internal.telephony.Phone; |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 65 | import com.android.internal.telephony.PhoneConfigurationManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 66 | import com.android.internal.telephony.PhoneConstants; |
| 67 | import com.android.internal.telephony.PhoneFactory; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 68 | import com.android.internal.telephony.SettingsObserver; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 69 | import com.android.internal.telephony.TelephonyCapabilities; |
Youming Ye | 47a6adc | 2018-11-19 15:33:36 -0800 | [diff] [blame] | 70 | import com.android.internal.telephony.TelephonyComponentFactory; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 71 | import com.android.internal.telephony.TelephonyIntents; |
Jack Yu | 3e2ac6e | 2022-03-26 13:59:45 -0700 | [diff] [blame] | 72 | import com.android.internal.telephony.data.DataEvaluation.DataDisallowedReason; |
Hwangoo Park | ba21cf2 | 2022-11-30 14:34:04 +0000 | [diff] [blame] | 73 | import com.android.internal.telephony.domainselection.DomainSelectionResolver; |
Daniel Banta | b26e96f | 2022-10-19 23:25:35 +0000 | [diff] [blame] | 74 | import com.android.internal.telephony.emergency.EmergencyStateTracker; |
Thomas Nguyen | 090fb00 | 2023-09-11 17:35:30 -0700 | [diff] [blame] | 75 | import com.android.internal.telephony.flags.FeatureFlags; |
Ling Ma | 51dd302 | 2023-08-29 11:46:38 -0700 | [diff] [blame] | 76 | import com.android.internal.telephony.flags.FeatureFlagsImpl; |
Brad Ebinger | 05f52c2 | 2019-12-05 13:03:21 -0800 | [diff] [blame] | 77 | import com.android.internal.telephony.ims.ImsResolver; |
Tyler Gunn | 9247915 | 2021-01-20 16:30:10 -0800 | [diff] [blame] | 78 | import com.android.internal.telephony.imsphone.ImsPhone; |
| 79 | import com.android.internal.telephony.imsphone.ImsPhoneCallTracker; |
Aishwarya Mallampati | 481aeee | 2023-02-17 21:32:22 +0000 | [diff] [blame] | 80 | import com.android.internal.telephony.satellite.SatelliteController; |
Nagendra Prasad Nagarle Basavaraju | f668eda | 2024-02-15 15:02:57 +0000 | [diff] [blame] | 81 | import com.android.internal.telephony.subscription.SubscriptionManagerService; |
Muralidhar Reddy | 472c2ae | 2021-09-29 19:38:40 +0000 | [diff] [blame] | 82 | import com.android.internal.telephony.uicc.UiccPort; |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 83 | import com.android.internal.telephony.uicc.UiccProfile; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 84 | import com.android.internal.util.IndentingPrintWriter; |
Andrew Lee | fb7f92e | 2015-02-26 16:23:32 -0800 | [diff] [blame] | 85 | import com.android.phone.settings.SettingsConstants; |
Ta-wei Yen | f0a71bc | 2017-05-17 12:28:28 -0700 | [diff] [blame] | 86 | import com.android.phone.vvm.CarrierVvmPackageInstalledReceiver; |
James.cf Lin | c9f35a4 | 2020-01-15 02:35:22 +0800 | [diff] [blame] | 87 | import com.android.services.telephony.rcs.TelephonyRcsService; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 88 | |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 89 | import java.io.FileDescriptor; |
| 90 | import java.io.PrintWriter; |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 91 | import java.lang.annotation.Retention; |
| 92 | import java.lang.annotation.RetentionPolicy; |
chen xu | baf9fe5 | 2019-07-02 17:28:24 -0700 | [diff] [blame] | 93 | import java.util.List; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 94 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 95 | /** |
| 96 | * Global state for the telephony subsystem when running in the primary |
| 97 | * phone process. |
| 98 | */ |
Sailesh Nepal | bf90054 | 2014-07-15 16:18:32 -0700 | [diff] [blame] | 99 | public class PhoneGlobals extends ContextWrapper { |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 100 | public static final String LOG_TAG = "PhoneGlobals"; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 101 | |
| 102 | /** |
| 103 | * Phone app-wide debug level: |
| 104 | * 0 - no debug logging |
| 105 | * 1 - normal debug logging if ro.debuggable is set (which is true in |
| 106 | * "eng" and "userdebug" builds but not "user" builds) |
| 107 | * 2 - ultra-verbose debug logging |
| 108 | * |
| 109 | * Most individual classes in the phone app have a local DBG constant, |
| 110 | * typically set to |
| 111 | * (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1) |
| 112 | * or else |
| 113 | * (PhoneApp.DBG_LEVEL >= 2) |
| 114 | * depending on the desired verbosity. |
| 115 | * |
| 116 | * ***** DO NOT SUBMIT WITH DBG_LEVEL > 0 ************* |
| 117 | */ |
Andrew Lee | 88b51e2 | 2014-10-29 15:48:51 -0700 | [diff] [blame] | 118 | public static final int DBG_LEVEL = 0; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 119 | |
| 120 | private static final boolean DBG = |
| 121 | (PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1); |
| 122 | private static final boolean VDBG = (PhoneGlobals.DBG_LEVEL >= 2); |
| 123 | |
| 124 | // Message codes; see mHandler below. |
| 125 | private static final int EVENT_SIM_NETWORK_LOCKED = 3; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 126 | private static final int EVENT_SIM_STATE_CHANGED = 8; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 127 | private static final int EVENT_DATA_ROAMING_DISCONNECTED = 10; |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 128 | private static final int EVENT_DATA_ROAMING_CONNECTED = 11; |
| 129 | private static final int EVENT_DATA_ROAMING_OK = 12; |
| 130 | private static final int EVENT_UNSOL_CDMA_INFO_RECORD = 13; |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 131 | private static final int EVENT_DATA_ROAMING_SETTINGS_CHANGED = 15; |
| 132 | private static final int EVENT_MOBILE_DATA_SETTINGS_CHANGED = 16; |
Lei Liu | 863eac0 | 2020-06-24 20:12:55 +0800 | [diff] [blame] | 133 | private static final int EVENT_CARRIER_CONFIG_CHANGED = 17; |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 134 | private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 18; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 135 | |
| 136 | // The MMI codes are also used by the InCallScreen. |
| 137 | public static final int MMI_INITIATE = 51; |
| 138 | public static final int MMI_COMPLETE = 52; |
| 139 | public static final int MMI_CANCEL = 53; |
| 140 | // Don't use message codes larger than 99 here; those are reserved for |
| 141 | // the individual Activities of the Phone UI. |
| 142 | |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 143 | public static final int AIRPLANE_ON = 1; |
| 144 | public static final int AIRPLANE_OFF = 0; |
| 145 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 146 | /** |
| 147 | * Allowable values for the wake lock code. |
| 148 | * SLEEP means the device can be put to sleep. |
| 149 | * PARTIAL means wake the processor, but we display can be kept off. |
| 150 | * FULL means wake both the processor and the display. |
| 151 | */ |
| 152 | public enum WakeState { |
| 153 | SLEEP, |
| 154 | PARTIAL, |
| 155 | FULL |
| 156 | } |
| 157 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 158 | private static PhoneGlobals sMe; |
| 159 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 160 | CallManager mCM; |
Santos Cordon | 63a8424 | 2013-07-23 13:32:52 -0700 | [diff] [blame] | 161 | CallNotifier notifier; |
Santos Cordon | 63a8424 | 2013-07-23 13:32:52 -0700 | [diff] [blame] | 162 | NotificationMgr notificationMgr; |
James.cf Lin | c9f35a4 | 2020-01-15 02:35:22 +0800 | [diff] [blame] | 163 | TelephonyRcsService mTelephonyRcsService; |
Andrew Lee | 9431b83 | 2015-03-09 18:46:45 -0700 | [diff] [blame] | 164 | public PhoneInterfaceManager phoneMgr; |
James.cf Lin | af3183c | 2019-10-24 00:59:00 +0800 | [diff] [blame] | 165 | public ImsRcsController imsRcsController; |
Hunsuk Choi | 3b742d6 | 2021-10-25 19:48:34 +0000 | [diff] [blame] | 166 | public ImsStateCallbackController mImsStateCallbackController; |
joonhunshin | cffb7fc | 2021-11-28 07:32:01 +0000 | [diff] [blame] | 167 | public ImsProvisioningController mImsProvisioningController; |
Jonathan Basseri | 6465afd | 2015-02-25 13:05:57 -0800 | [diff] [blame] | 168 | CarrierConfigLoader configLoader; |
Santos Cordon | 63a8424 | 2013-07-23 13:32:52 -0700 | [diff] [blame] | 169 | |
Sandeep Kunta | de73a6a | 2014-10-15 18:45:56 +0530 | [diff] [blame] | 170 | private Phone phoneInEcm; |
Santos Cordon | 63a8424 | 2013-07-23 13:32:52 -0700 | [diff] [blame] | 171 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 172 | static boolean sVoiceCapable = true; |
| 173 | |
Santos Cordon | c593d00 | 2015-06-03 15:41:15 -0700 | [diff] [blame] | 174 | // TODO: Remove, no longer used. |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 175 | CdmaPhoneCallState cdmaPhoneCallState; |
| 176 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 177 | // The currently-active PUK entry activity and progress dialog. |
| 178 | // Normally, these are the Emergency Dialer and the subsequent |
| 179 | // progress dialog. null if there is are no such objects in |
| 180 | // the foreground. |
| 181 | private Activity mPUKEntryActivity; |
| 182 | private ProgressDialog mPUKEntryProgressDialog; |
| 183 | |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 184 | /** @hide */ |
| 185 | @Retention(RetentionPolicy.SOURCE) |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 186 | @IntDef(prefix = {"ROAMING_NOTIFICATION_REASON_"}, |
| 187 | value = { |
| 188 | ROAMING_NOTIFICATION_REASON_DATA_SETTING_CHANGED, |
| 189 | ROAMING_NOTIFICATION_REASON_DATA_ROAMING_SETTING_CHANGED, |
| 190 | ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED, |
| 191 | ROAMING_NOTIFICATION_REASON_SERVICE_STATE_CHANGED, |
| 192 | ROAMING_NOTIFICATION_REASON_DEFAULT_DATA_SUBS_CHANGED}) |
| 193 | public @interface RoamingNotificationReason {} |
| 194 | private static final int ROAMING_NOTIFICATION_REASON_DATA_SETTING_CHANGED = 0; |
| 195 | private static final int ROAMING_NOTIFICATION_REASON_DATA_ROAMING_SETTING_CHANGED = 1; |
| 196 | private static final int ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED = 2; |
| 197 | private static final int ROAMING_NOTIFICATION_REASON_SERVICE_STATE_CHANGED = 3; |
| 198 | private static final int ROAMING_NOTIFICATION_REASON_DEFAULT_DATA_SUBS_CHANGED = 4; |
| 199 | |
| 200 | /** @hide */ |
| 201 | @Retention(RetentionPolicy.SOURCE) |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 202 | @IntDef(prefix = {"ROAMING_NOTIFICATION_"}, |
| 203 | value = { |
| 204 | ROAMING_NOTIFICATION_NO_NOTIFICATION, |
| 205 | ROAMING_NOTIFICATION_CONNECTED, |
| 206 | ROAMING_NOTIFICATION_DISCONNECTED}) |
| 207 | public @interface RoamingNotification {} |
| 208 | |
| 209 | private static final int ROAMING_NOTIFICATION_NO_NOTIFICATION = 0; |
| 210 | private static final int ROAMING_NOTIFICATION_CONNECTED = 1; |
| 211 | private static final int ROAMING_NOTIFICATION_DISCONNECTED = 2; |
| 212 | |
| 213 | @RoamingNotification |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 214 | private int mCurrentRoamingNotification = ROAMING_NOTIFICATION_NO_NOTIFICATION; |
Jack Yu | 953f935 | 2017-05-18 14:41:06 -0700 | [diff] [blame] | 215 | |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 216 | /** |
| 217 | * Reasons that have already shown notification to prevent duplicate shows for the same reason. |
| 218 | */ |
| 219 | private ArraySet<String> mShownNotificationReasons = new ArraySet<>(); |
Ling Ma | 317906d | 2022-12-05 15:58:14 -0800 | [diff] [blame] | 220 | |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 221 | // For reorganize_roaming_notification feature disabled. |
| 222 | @RoamingNotification |
| 223 | private int mPrevRoamingNotification = ROAMING_NOTIFICATION_NO_NOTIFICATION; |
| 224 | |
| 225 | // For reorganize_roaming_notification feature disabled. |
| 226 | /** Operator numerics for which we've shown is-roaming notifications. **/ |
| 227 | private ArraySet<String> mPrevRoamingOperatorNumerics = new ArraySet<>(); |
| 228 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 229 | private WakeState mWakeState = WakeState.SLEEP; |
| 230 | |
| 231 | private PowerManager mPowerManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 232 | private PowerManager.WakeLock mWakeLock; |
| 233 | private PowerManager.WakeLock mPartialWakeLock; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 234 | private KeyguardManager mKeyguardManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 235 | |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 236 | private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; |
| 237 | private final LocalLog mDataRoamingNotifLog = new LocalLog(50); |
| 238 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 239 | // Broadcast receiver for various intent broadcasts (see onCreate()) |
| 240 | private final BroadcastReceiver mReceiver = new PhoneAppBroadcastReceiver(); |
| 241 | |
Ta-wei Yen | f0a71bc | 2017-05-17 12:28:28 -0700 | [diff] [blame] | 242 | private final CarrierVvmPackageInstalledReceiver mCarrierVvmPackageInstalledReceiver = |
| 243 | new CarrierVvmPackageInstalledReceiver(); |
| 244 | |
joonhunshin | 051ab23 | 2024-02-06 02:21:46 +0000 | [diff] [blame] | 245 | private SettingsObserver mSettingsObserver; |
Siim Sammul | 182d61b | 2021-05-04 16:01:42 +0100 | [diff] [blame] | 246 | private BinderCallsStats.SettingsObserver mBinderCallsSettingsObserver; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 247 | |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 248 | // Mapping of phone ID to the associated TelephonyCallback. These should be registered without |
| 249 | // fine or coarse location since we only use ServiceState for |
| 250 | private PhoneAppCallback[] mTelephonyCallbacks; |
| 251 | |
joonhunshin | 051ab23 | 2024-02-06 02:21:46 +0000 | [diff] [blame] | 252 | private FeatureFlags mFeatureFlags = new FeatureFlagsImpl(); |
sangyun | 15019e0 | 2023-11-13 21:50:15 +0900 | [diff] [blame] | 253 | |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 254 | private class PhoneAppCallback extends TelephonyCallback implements |
| 255 | TelephonyCallback.ServiceStateListener { |
| 256 | private final int mSubId; |
| 257 | |
| 258 | PhoneAppCallback(int subId) { |
| 259 | mSubId = subId; |
| 260 | } |
| 261 | |
| 262 | @Override |
| 263 | public void onServiceStateChanged(ServiceState serviceState) { |
| 264 | // Note when registering that we should be registering with INCLUDE_LOCATION_DATA_NONE. |
| 265 | // PhoneGlobals only uses the state and roaming status, which does not require location. |
| 266 | handleServiceStateChanged(serviceState, mSubId); |
| 267 | } |
| 268 | |
| 269 | public int getSubId() { |
| 270 | return mSubId; |
| 271 | } |
| 272 | } |
| 273 | |
Nazish Tabassum | 160d211 | 2019-12-23 17:31:33 +0530 | [diff] [blame] | 274 | private static class EventSimStateChangedBag { |
| 275 | final int mPhoneId; |
| 276 | final String mIccStatus; |
| 277 | |
| 278 | EventSimStateChangedBag(int phoneId, String iccStatus) { |
| 279 | mPhoneId = phoneId; |
| 280 | mIccStatus = iccStatus; |
| 281 | } |
| 282 | } |
| 283 | |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 284 | // Some carrier config settings disable the network lock screen, so we call handleSimLock |
| 285 | // when either SIM_LOCK or CARRIER_CONFIG changes so that no matter which one happens first, |
| 286 | // we still do the right thing |
| 287 | private void handleSimLock(int subType, Phone phone) { |
| 288 | PersistableBundle cc = getCarrierConfigForSubId(phone.getSubId()); |
| 289 | if (!CarrierConfigManager.isConfigForIdentifiedCarrier(cc)) { |
| 290 | // If we only have the default carrier config just return, to avoid popping up the |
| 291 | // the SIM lock screen when it's disabled by the carrier. |
| 292 | Log.i(LOG_TAG, "Not showing 'SIM network unlock' screen. Carrier config not loaded"); |
| 293 | return; |
| 294 | } |
| 295 | if (cc.getBoolean(CarrierConfigManager.KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL)) { |
| 296 | // Some products don't have the concept of a "SIM network lock" |
| 297 | Log.i(LOG_TAG, "Not showing 'SIM network unlock' screen. Disabled by carrier config"); |
| 298 | return; |
| 299 | } |
| 300 | |
| 301 | // if passed in subType is unknown, retrieve it here. |
| 302 | if (subType == -1) { |
Muralidhar Reddy | 472c2ae | 2021-09-29 19:38:40 +0000 | [diff] [blame] | 303 | final UiccPort uiccPort = phone.getUiccPort(); |
| 304 | if (uiccPort == null) { |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 305 | Log.e(LOG_TAG, |
Muralidhar Reddy | 472c2ae | 2021-09-29 19:38:40 +0000 | [diff] [blame] | 306 | "handleSimLock: uiccPort for phone " + phone.getPhoneId() + " is null"); |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 307 | return; |
| 308 | } |
Muralidhar Reddy | 472c2ae | 2021-09-29 19:38:40 +0000 | [diff] [blame] | 309 | final UiccProfile uiccProfile = uiccPort.getUiccProfile(); |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 310 | if (uiccProfile == null) { |
| 311 | Log.e(LOG_TAG, |
| 312 | "handleSimLock: uiccProfile for phone " + phone.getPhoneId() + " is null"); |
| 313 | return; |
| 314 | } |
| 315 | subType = uiccProfile.getApplication( |
| 316 | uiccProfile.mCurrentAppType).getPersoSubState().ordinal(); |
| 317 | } |
| 318 | // Normal case: show the "SIM network unlock" PIN entry screen. |
| 319 | // The user won't be able to do anything else until |
| 320 | // they enter a valid SIM network PIN. |
| 321 | Log.i(LOG_TAG, "show sim depersonal panel"); |
| 322 | IccNetworkDepersonalizationPanel.showDialog(phone, subType); |
| 323 | } |
| 324 | |
| 325 | private boolean isSimLocked(Phone phone) { |
| 326 | TelephonyManager tm = getSystemService(TelephonyManager.class); |
| 327 | return tm.createForSubscriptionId(phone.getSubId()).getSimState() |
| 328 | == TelephonyManager.SIM_STATE_NETWORK_LOCKED; |
| 329 | } |
| 330 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 331 | Handler mHandler = new Handler() { |
| 332 | @Override |
| 333 | public void handleMessage(Message msg) { |
| 334 | PhoneConstants.State phoneState; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 335 | if (VDBG) Log.v(LOG_TAG, "event=" + msg.what); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 336 | switch (msg.what) { |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 337 | // TODO: This event should be handled by the lock screen, just |
| 338 | // like the "SIM missing" and "Sim locked" cases (bug 1804111). |
| 339 | case EVENT_SIM_NETWORK_LOCKED: |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 340 | int subType = (Integer) ((AsyncResult) msg.obj).result; |
| 341 | Phone phone = (Phone) ((AsyncResult) msg.obj).userObj; |
| 342 | handleSimLock(subType, phone); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 343 | break; |
| 344 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 345 | case EVENT_DATA_ROAMING_DISCONNECTED: |
Nagendra Prasad Nagarle Basavaraju | f668eda | 2024-02-15 15:02:57 +0000 | [diff] [blame] | 346 | if (SubscriptionManagerService.getInstance() |
| 347 | .isEsimBootStrapProvisioningActiveForSubId(msg.arg1)) { |
| 348 | Log.i(LOG_TAG, |
| 349 | "skip notification/warnings during esim bootstrap activation"); |
| 350 | } else { |
| 351 | notificationMgr.showDataRoamingNotification(msg.arg1, false); |
| 352 | } |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 353 | break; |
| 354 | |
| 355 | case EVENT_DATA_ROAMING_CONNECTED: |
Nagendra Prasad Nagarle Basavaraju | f668eda | 2024-02-15 15:02:57 +0000 | [diff] [blame] | 356 | if (SubscriptionManagerService.getInstance() |
| 357 | .isEsimBootStrapProvisioningActiveForSubId(msg.arg1)) { |
| 358 | Log.i(LOG_TAG, |
| 359 | "skip notification/warnings during esim bootstrap activation"); |
| 360 | } else { |
| 361 | notificationMgr.showDataRoamingNotification(msg.arg1, true); |
| 362 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 363 | break; |
| 364 | |
| 365 | case EVENT_DATA_ROAMING_OK: |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 366 | notificationMgr.hideDataRoamingNotification(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 367 | break; |
| 368 | |
| 369 | case MMI_COMPLETE: |
| 370 | onMMIComplete((AsyncResult) msg.obj); |
| 371 | break; |
| 372 | |
| 373 | case MMI_CANCEL: |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 374 | PhoneUtils.cancelMmiCode(mCM.getFgPhone()); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 375 | break; |
| 376 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 377 | case EVENT_SIM_STATE_CHANGED: |
Nazish Tabassum | 160d211 | 2019-12-23 17:31:33 +0530 | [diff] [blame] | 378 | EventSimStateChangedBag bag = (EventSimStateChangedBag)msg.obj; |
Sarah Chin | 010884c | 2023-06-14 15:55:08 -0700 | [diff] [blame] | 379 | // Dismiss the "No services" notification if the SIM is removed. |
| 380 | if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(bag.mIccStatus)) { |
| 381 | notificationMgr.dismissNetworkSelectionNotificationForInactiveSubId(); |
| 382 | } |
| 383 | |
| 384 | // Marks the event where the SIM goes into ready state. |
| 385 | // Right now, this is only used for the PUK-unlocking process. |
Tyler Gunn | 3fc09c0 | 2020-05-08 16:35:55 -0700 | [diff] [blame] | 386 | if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(bag.mIccStatus) |
Nazish Tabassum | 59126a9 | 2020-07-03 21:44:49 +0530 | [diff] [blame] | 387 | || IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(bag.mIccStatus) |
| 388 | || IccCardConstants.INTENT_VALUE_ICC_NOT_READY.equals(bag.mIccStatus) |
| 389 | || IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(bag.mIccStatus)) { |
Sarah Chin | 010884c | 2023-06-14 15:55:08 -0700 | [diff] [blame] | 390 | // When the right event is triggered and there are UI objects in the |
| 391 | // foreground, we close them to display the lock panel. |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 392 | if (mPUKEntryActivity != null) { |
Tyler Gunn | 3fc09c0 | 2020-05-08 16:35:55 -0700 | [diff] [blame] | 393 | Log.i(LOG_TAG, "Dismiss puk entry activity"); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 394 | mPUKEntryActivity.finish(); |
| 395 | mPUKEntryActivity = null; |
| 396 | } |
| 397 | if (mPUKEntryProgressDialog != null) { |
Tyler Gunn | 3fc09c0 | 2020-05-08 16:35:55 -0700 | [diff] [blame] | 398 | Log.i(LOG_TAG, "Dismiss puk progress dialog"); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 399 | mPUKEntryProgressDialog.dismiss(); |
| 400 | mPUKEntryProgressDialog = null; |
| 401 | } |
Nazish Tabassum | 59126a9 | 2020-07-03 21:44:49 +0530 | [diff] [blame] | 402 | Log.i(LOG_TAG, "Dismissing depersonal panel" + (bag.mIccStatus)); |
Nazish Tabassum | 160d211 | 2019-12-23 17:31:33 +0530 | [diff] [blame] | 403 | IccNetworkDepersonalizationPanel.dialogDismiss(bag.mPhoneId); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 404 | } |
| 405 | break; |
| 406 | |
| 407 | case EVENT_UNSOL_CDMA_INFO_RECORD: |
| 408 | //TODO: handle message here; |
| 409 | break; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 410 | case EVENT_DATA_ROAMING_SETTINGS_CHANGED: |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 411 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 412 | updateDataRoamingStatus( |
| 413 | ROAMING_NOTIFICATION_REASON_DATA_ROAMING_SETTING_CHANGED); |
| 414 | } else { |
| 415 | updateDataRoamingStatusForFeatureDisabled(null); |
| 416 | } |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 417 | break; |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 418 | case EVENT_MOBILE_DATA_SETTINGS_CHANGED: |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 419 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 420 | updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_DATA_SETTING_CHANGED); |
| 421 | } else { |
| 422 | updateDataRoamingStatusForFeatureDisabled(null); |
| 423 | } |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 424 | break; |
Lei Liu | 863eac0 | 2020-06-24 20:12:55 +0800 | [diff] [blame] | 425 | case EVENT_CARRIER_CONFIG_CHANGED: |
| 426 | int subId = (Integer) msg.obj; |
| 427 | // The voicemail number could be overridden by carrier config, so need to |
| 428 | // refresh the message waiting (voicemail) indicator. |
| 429 | refreshMwiIndicator(subId); |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 430 | phone = getPhone(subId); |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 431 | if (phone != null) { |
| 432 | if (isSimLocked(phone)) { |
| 433 | // pass in subType=-1 so handleSimLock can find the actual subType if |
| 434 | // needed. This is safe as valid values for subType are >= 0 |
| 435 | handleSimLock(-1, phone); |
| 436 | } |
| 437 | TelephonyManager tm = getSystemService(TelephonyManager.class); |
| 438 | PhoneAppCallback callback = mTelephonyCallbacks[phone.getPhoneId()]; |
| 439 | // TODO: We may need to figure out a way to unregister if subId is invalid |
| 440 | tm.createForSubscriptionId(callback.getSubId()) |
| 441 | .unregisterTelephonyCallback(callback); |
| 442 | callback = new PhoneAppCallback(subId); |
| 443 | tm.createForSubscriptionId(subId).registerTelephonyCallback( |
Ling Ma | 317906d | 2022-12-05 15:58:14 -0800 | [diff] [blame] | 444 | TelephonyManager.INCLUDE_LOCATION_DATA_COARSE, mHandler::post, |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 445 | callback); |
| 446 | mTelephonyCallbacks[phone.getPhoneId()] = callback; |
| 447 | } |
| 448 | break; |
| 449 | case EVENT_MULTI_SIM_CONFIG_CHANGED: |
| 450 | int activeModems = (int) ((AsyncResult) msg.obj).result; |
| 451 | TelephonyManager tm = getSystemService(TelephonyManager.class); |
| 452 | // Unregister all previous callbacks |
| 453 | for (int phoneId = 0; phoneId < mTelephonyCallbacks.length; phoneId++) { |
| 454 | PhoneAppCallback callback = mTelephonyCallbacks[phoneId]; |
| 455 | if (callback != null) { |
| 456 | tm.createForSubscriptionId(callback.getSubId()) |
| 457 | .unregisterTelephonyCallback(callback); |
| 458 | mTelephonyCallbacks[phoneId] = null; |
| 459 | } |
| 460 | } |
| 461 | // Register callbacks for all active modems |
| 462 | for (int phoneId = 0; phoneId < activeModems; phoneId++) { |
| 463 | int sub = PhoneFactory.getPhone(phoneId).getSubId(); |
| 464 | PhoneAppCallback callback = new PhoneAppCallback(sub); |
| 465 | tm.createForSubscriptionId(sub).registerTelephonyCallback( |
| 466 | TelephonyManager.INCLUDE_LOCATION_DATA_NONE, mHandler::post, |
| 467 | callback); |
| 468 | mTelephonyCallbacks[phoneId] = callback; |
Jordan Liu | 06bdef1 | 2021-03-24 17:25:46 -0700 | [diff] [blame] | 469 | } |
Lei Liu | 863eac0 | 2020-06-24 20:12:55 +0800 | [diff] [blame] | 470 | break; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 471 | } |
| 472 | } |
| 473 | }; |
| 474 | |
| 475 | public PhoneGlobals(Context context) { |
| 476 | super(context); |
| 477 | sMe = this; |
joonhunshin | 051ab23 | 2024-02-06 02:21:46 +0000 | [diff] [blame] | 478 | if (mFeatureFlags.enforceTelephonyFeatureMappingForPublicApis()) { |
| 479 | if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { |
| 480 | mSettingsObserver = new SettingsObserver(context, mHandler); |
| 481 | } |
| 482 | } else { |
| 483 | mSettingsObserver = new SettingsObserver(context, mHandler); |
| 484 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | public void onCreate() { |
| 488 | if (VDBG) Log.v(LOG_TAG, "onCreate()..."); |
| 489 | |
| 490 | ContentResolver resolver = getContentResolver(); |
| 491 | |
joonhunshin | 051ab23 | 2024-02-06 02:21:46 +0000 | [diff] [blame] | 492 | if (mFeatureFlags.enforceTelephonyFeatureMappingForPublicApis()) { |
| 493 | if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { |
| 494 | Log.v(LOG_TAG, "onCreate()... but not defined FEATURE_TELEPHONY"); |
| 495 | return; |
| 496 | } |
| 497 | } |
| 498 | |
Hall Liu | aa4211e | 2021-01-20 15:43:39 -0800 | [diff] [blame] | 499 | // Initialize the shim from frameworks/opt/telephony into packages/services/Telephony. |
| 500 | TelephonyLocalConnection.setInstance(new LocalConnectionImpl(this)); |
| 501 | |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 502 | TelephonyManager tm = getSystemService(TelephonyManager.class); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 503 | // Cache the "voice capable" flag. |
| 504 | // This flag currently comes from a resource (which is |
| 505 | // overrideable on a per-product basis): |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 506 | sVoiceCapable = tm.isVoiceCapable(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 507 | // ...but this might eventually become a PackageManager "system |
| 508 | // feature" instead, in which case we'd do something like: |
| 509 | // sVoiceCapable = |
| 510 | // getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_VOICE_CALLS); |
| 511 | |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 512 | if (mCM == null) { |
Nathan Harold | f9df6ea | 2019-03-08 11:54:22 -0800 | [diff] [blame] | 513 | // Initialize AnomalyReporter early so that it can be used |
| 514 | AnomalyReporter.initialize(this); |
Nathan Harold | 0db5c5e | 2019-01-22 20:18:56 -0800 | [diff] [blame] | 515 | |
Youming Ye | 47a6adc | 2018-11-19 15:33:36 -0800 | [diff] [blame] | 516 | // Inject telephony component factory if configured using other jars. |
| 517 | XmlResourceParser parser = getResources().getXml(R.xml.telephony_injection); |
| 518 | TelephonyComponentFactory.getInstance().injectTheComponentFactory(parser); |
Hwangoo Park | ba21cf2 | 2022-11-30 14:34:04 +0000 | [diff] [blame] | 519 | |
| 520 | // Create DomainSelectionResolver always, but it MUST be initialized only when |
| 521 | // the device supports AOSP domain selection architecture and |
| 522 | // has new IRadio that supports its related HAL APIs. |
Hwangoo Park | bf3968c | 2024-01-19 07:49:22 +0000 | [diff] [blame] | 523 | String dssComponentName = getResources().getString( |
| 524 | R.string.config_domain_selection_service_component_name); |
| 525 | DomainSelectionResolver.make(this, dssComponentName); |
Hwangoo Park | ba21cf2 | 2022-11-30 14:34:04 +0000 | [diff] [blame] | 526 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 527 | // Initialize the telephony framework |
sangyun | 15019e0 | 2023-11-13 21:50:15 +0900 | [diff] [blame] | 528 | PhoneFactory.makeDefaultPhones(this, mFeatureFlags); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 529 | |
Hwangoo Park | ba21cf2 | 2022-11-30 14:34:04 +0000 | [diff] [blame] | 530 | // Initialize the DomainSelectionResolver after creating the Phone instance |
| 531 | // to check the Radio HAL version. |
| 532 | if (DomainSelectionResolver.getInstance().isDomainSelectionSupported()) { |
Hwangoo Park | bf3968c | 2024-01-19 07:49:22 +0000 | [diff] [blame] | 533 | DomainSelectionResolver.getInstance().initialize(); |
Daniel Banta | b26e96f | 2022-10-19 23:25:35 +0000 | [diff] [blame] | 534 | // Initialize EmergencyStateTracker if domain selection is supported |
| 535 | boolean isSuplDdsSwitchRequiredForEmergencyCall = getResources() |
| 536 | .getBoolean(R.bool.config_gnss_supl_requires_default_data_for_emergency); |
| 537 | EmergencyStateTracker.make(this, isSuplDdsSwitchRequiredForEmergencyCall); |
Hwangoo Park | ba21cf2 | 2022-11-30 14:34:04 +0000 | [diff] [blame] | 538 | } |
| 539 | |
Brad Ebinger | 05f52c2 | 2019-12-05 13:03:21 -0800 | [diff] [blame] | 540 | // Only bring up ImsResolver if the device supports having an IMS stack. |
| 541 | if (getPackageManager().hasSystemFeature( |
| 542 | PackageManager.FEATURE_TELEPHONY_IMS)) { |
| 543 | // Get the package name of the default IMS implementation. |
| 544 | String defaultImsMmtelPackage = getResources().getString( |
| 545 | R.string.config_ims_mmtel_package); |
| 546 | String defaultImsRcsPackage = getResources().getString( |
| 547 | R.string.config_ims_rcs_package); |
Brad Ebinger | d1947d8 | 2021-05-17 20:54:49 +0000 | [diff] [blame] | 548 | ImsResolver.make(this, defaultImsMmtelPackage, |
Brad Ebinger | e3ae65a | 2020-09-11 12:45:11 -0700 | [diff] [blame] | 549 | defaultImsRcsPackage, PhoneFactory.getPhones().length, |
| 550 | new ImsFeatureBinderRepository()); |
Brad Ebinger | d1947d8 | 2021-05-17 20:54:49 +0000 | [diff] [blame] | 551 | ImsResolver.getInstance().initialize(); |
Tyler Gunn | 9247915 | 2021-01-20 16:30:10 -0800 | [diff] [blame] | 552 | |
| 553 | // With the IMS phone created, load static config.xml values from the phone process |
| 554 | // so that it can be provided to the ImsPhoneCallTracker. |
| 555 | for (Phone p : PhoneFactory.getPhones()) { |
| 556 | Phone imsPhone = p.getImsPhone(); |
| 557 | if (imsPhone != null && imsPhone instanceof ImsPhone) { |
| 558 | ImsPhone theImsPhone = (ImsPhone) imsPhone; |
| 559 | if (theImsPhone.getCallTracker() instanceof ImsPhoneCallTracker) { |
| 560 | ImsPhoneCallTracker ict = (ImsPhoneCallTracker) |
| 561 | theImsPhone.getCallTracker(); |
| 562 | |
| 563 | ImsPhoneCallTracker.Config config = new ImsPhoneCallTracker.Config(); |
| 564 | config.isD2DCommunicationSupported = getResources().getBoolean( |
| 565 | R.bool.config_use_device_to_device_communication); |
| 566 | ict.setConfig(config); |
| 567 | } |
| 568 | } |
| 569 | } |
Hui Wang | 068ab86 | 2020-10-31 05:12:53 +0000 | [diff] [blame] | 570 | RcsProvisioningMonitor.make(this); |
Brad Ebinger | 05f52c2 | 2019-12-05 13:03:21 -0800 | [diff] [blame] | 571 | } |
| 572 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 573 | // Start TelephonyDebugService After the default phone is created. |
| 574 | Intent intent = new Intent(this, TelephonyDebugService.class); |
| 575 | startService(intent); |
| 576 | |
| 577 | mCM = CallManager.getInstance(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 578 | |
| 579 | // Create the NotificationMgr singleton, which is used to display |
| 580 | // status bar icons and control other status bar behavior. |
| 581 | notificationMgr = NotificationMgr.init(this); |
| 582 | |
Aishwarya Mallampati | 481aeee | 2023-02-17 21:32:22 +0000 | [diff] [blame] | 583 | // Create the SatelliteController singleton, which acts as a backend service for |
| 584 | // {@link android.telephony.satellite.SatelliteManager}. |
sangyun | 15019e0 | 2023-11-13 21:50:15 +0900 | [diff] [blame] | 585 | SatelliteController.make(this, mFeatureFlags); |
Sarah Chin | 5f57c58 | 2023-02-14 04:16:10 -0800 | [diff] [blame] | 586 | |
Anthony Lee | 03ebdfc | 2015-07-27 08:12:02 -0700 | [diff] [blame] | 587 | // Create an instance of CdmaPhoneCallState and initialize it to IDLE |
| 588 | cdmaPhoneCallState = new CdmaPhoneCallState(); |
| 589 | cdmaPhoneCallState.CdmaPhoneCallStateInit(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 590 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 591 | // before registering for phone state changes |
| 592 | mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); |
| 593 | mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, LOG_TAG); |
| 594 | // lock used to keep the processor awake, when we don't care for the display. |
| 595 | mPartialWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK |
| 596 | | PowerManager.ON_AFTER_RELEASE, LOG_TAG); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 597 | |
| 598 | mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); |
| 599 | |
sangyun | 15019e0 | 2023-11-13 21:50:15 +0900 | [diff] [blame] | 600 | phoneMgr = PhoneInterfaceManager.init(this, mFeatureFlags); |
Santos Cordon | 406c034 | 2013-08-28 00:07:47 -0700 | [diff] [blame] | 601 | |
joonhunshin | 2c33ed9 | 2023-12-12 14:29:23 +0000 | [diff] [blame] | 602 | imsRcsController = ImsRcsController.init(this, mFeatureFlags); |
James.cf Lin | af3183c | 2019-10-24 00:59:00 +0800 | [diff] [blame] | 603 | |
joonhunshin | 21a8681 | 2023-12-10 08:21:25 +0000 | [diff] [blame] | 604 | configLoader = CarrierConfigLoader.init(this, mFeatureFlags); |
Brad Ebinger | 6c53e7f | 2023-01-27 16:26:44 -0800 | [diff] [blame] | 605 | |
James.cf Lin | c9f35a4 | 2020-01-15 02:35:22 +0800 | [diff] [blame] | 606 | if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS)) { |
Hunsuk Choi | 3b742d6 | 2021-10-25 19:48:34 +0000 | [diff] [blame] | 607 | mImsStateCallbackController = |
| 608 | ImsStateCallbackController.make(this, PhoneFactory.getPhones().length); |
Brad Ebinger | a68a497 | 2020-01-30 17:31:23 -0800 | [diff] [blame] | 609 | mTelephonyRcsService = new TelephonyRcsService(this, |
joonhunshin | d9dfe8d | 2024-02-05 09:08:06 +0000 | [diff] [blame] | 610 | PhoneFactory.getPhones().length, mFeatureFlags); |
Brad Ebinger | a68a497 | 2020-01-30 17:31:23 -0800 | [diff] [blame] | 611 | mTelephonyRcsService.initialize(); |
James.cf Lin | c9f35a4 | 2020-01-15 02:35:22 +0800 | [diff] [blame] | 612 | imsRcsController.setRcsService(mTelephonyRcsService); |
joonhunshin | cffb7fc | 2021-11-28 07:32:01 +0000 | [diff] [blame] | 613 | mImsProvisioningController = |
| 614 | ImsProvisioningController.make(this, PhoneFactory.getPhones().length); |
James.cf Lin | c9f35a4 | 2020-01-15 02:35:22 +0800 | [diff] [blame] | 615 | } |
| 616 | |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 617 | // Create the CallNotifier singleton, which handles |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 618 | // asynchronous events from the telephony layer (like |
| 619 | // launching the incoming-call UI when an incoming call comes |
| 620 | // in.) |
Brad Ebinger | a9c6b6d | 2016-01-07 17:24:16 -0800 | [diff] [blame] | 621 | notifier = CallNotifier.init(this); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 622 | |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 623 | PhoneUtils.registerIccStatus(mHandler, EVENT_SIM_NETWORK_LOCKED); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 624 | |
| 625 | // register for MMI/USSD |
| 626 | mCM.registerForMmiComplete(mHandler, MMI_COMPLETE, null); |
| 627 | |
Qiong Liu | cc3fe81 | 2019-09-23 15:25:44 +0800 | [diff] [blame] | 628 | // Initialize cell status using current airplane mode. |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 629 | handleAirplaneModeChange( |
| 630 | Settings.Global.getInt( |
| 631 | getContentResolver(), |
| 632 | Settings.Global.AIRPLANE_MODE_ON, |
| 633 | AIRPLANE_OFF) |
| 634 | == AIRPLANE_ON); |
Qiong Liu | cc3fe81 | 2019-09-23 15:25:44 +0800 | [diff] [blame] | 635 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 636 | // Register for misc other intent broadcasts. |
| 637 | IntentFilter intentFilter = |
| 638 | new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 639 | intentFilter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); |
| 640 | intentFilter.addAction(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 641 | intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 642 | intentFilter.addAction(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED); |
| 643 | intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 644 | registerReceiver(mReceiver, intentFilter); |
Jack Yu | ec14422 | 2023-12-13 16:03:03 -0800 | [diff] [blame] | 645 | int defaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId(); |
| 646 | if (SubscriptionManager.isValidSubscriptionId(defaultDataSubId)) { |
| 647 | if (VDBG) { |
| 648 | Log.v(LOG_TAG, "Loaded initial default data sub: " + defaultDataSubId); |
sangyun | 15019e0 | 2023-11-13 21:50:15 +0900 | [diff] [blame] | 649 | } |
Jack Yu | ec14422 | 2023-12-13 16:03:03 -0800 | [diff] [blame] | 650 | mDefaultDataSubId = defaultDataSubId; |
| 651 | registerSettingsObserver(); |
| 652 | updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_DEFAULT_DATA_SUBS_CHANGED); |
sangyun | dce559b | 2023-09-11 10:25:55 +0900 | [diff] [blame] | 653 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 654 | |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 655 | PhoneConfigurationManager.registerForMultiSimConfigChange( |
| 656 | mHandler, EVENT_MULTI_SIM_CONFIG_CHANGED, null); |
| 657 | |
| 658 | mTelephonyCallbacks = new PhoneAppCallback[tm.getSupportedModemCount()]; |
Fangyuan Li | 7f5c275 | 2022-06-29 18:02:31 +0800 | [diff] [blame] | 659 | if (tm.getSupportedModemCount() > 0) { |
| 660 | for (Phone phone : PhoneFactory.getPhones()) { |
| 661 | int subId = phone.getSubId(); |
| 662 | PhoneAppCallback callback = new PhoneAppCallback(subId); |
| 663 | tm.createForSubscriptionId(subId).registerTelephonyCallback( |
| 664 | TelephonyManager.INCLUDE_LOCATION_DATA_NONE, mHandler::post, callback); |
| 665 | mTelephonyCallbacks[phone.getPhoneId()] = callback; |
| 666 | } |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 667 | } |
Ta-wei Yen | f0a71bc | 2017-05-17 12:28:28 -0700 | [diff] [blame] | 668 | mCarrierVvmPackageInstalledReceiver.register(this); |
| 669 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 670 | //set the default values for the preferences in the phone. |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 671 | PreferenceManager.setDefaultValues(this, R.xml.call_feature_setting, false); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 672 | } |
| 673 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 674 | // XXX pre-load the SimProvider so that it's ready |
| 675 | resolver.getType(Uri.parse("content://icc/adn")); |
| 676 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 677 | // TODO: Register for Cdma Information Records |
| 678 | // phone.registerCdmaInformationRecord(mHandler, EVENT_UNSOL_CDMA_INFO_RECORD, null); |
| 679 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 680 | // Read HAC settings and configure audio hardware |
| 681 | if (getResources().getBoolean(R.bool.hac_enabled)) { |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 682 | int hac = android.provider.Settings.System.getInt( |
| 683 | getContentResolver(), |
| 684 | android.provider.Settings.System.HEARING_AID, |
| 685 | 0); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 686 | AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); |
Jordan Liu | f71aeef | 2019-08-21 11:46:09 -0700 | [diff] [blame] | 687 | audioManager.setParameters( |
| 688 | SettingsConstants.HAC_KEY + "=" + (hac == SettingsConstants.HAC_ENABLED |
| 689 | ? SettingsConstants.HAC_VAL_ON : SettingsConstants.HAC_VAL_OFF)); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 690 | } |
Siim Sammul | 182d61b | 2021-05-04 16:01:42 +0100 | [diff] [blame] | 691 | |
| 692 | // Start tracking Binder latency for the phone process. |
| 693 | mBinderCallsSettingsObserver = new BinderCallsStats.SettingsObserver( |
| 694 | getApplicationContext(), |
Siim Sammul | a695009 | 2021-06-22 17:14:03 +0100 | [diff] [blame] | 695 | new BinderCallsStats( |
| 696 | new BinderCallsStats.Injector(), |
| 697 | com.android.internal.os.BinderLatencyProto.Dims.TELEPHONY)); |
Santos Cordon | ff506f5 | 2013-11-21 19:13:19 -0800 | [diff] [blame] | 698 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 699 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 700 | /** |
| 701 | * Returns the singleton instance of the PhoneApp. |
| 702 | */ |
Sailesh Nepal | 1eaf22b | 2014-02-22 17:00:49 -0800 | [diff] [blame] | 703 | public static PhoneGlobals getInstance() { |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 704 | if (sMe == null) { |
| 705 | throw new IllegalStateException("No PhoneGlobals here!"); |
| 706 | } |
| 707 | return sMe; |
| 708 | } |
| 709 | |
| 710 | /** |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 711 | * Returns the default phone. |
| 712 | * |
Andrew Lee | 385019f | 2014-11-24 14:19:50 -0800 | [diff] [blame] | 713 | * WARNING: This method should be used carefully, now that there may be multiple phones. |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 714 | */ |
Andrew Lee | 83383e4 | 2014-10-31 12:42:28 -0700 | [diff] [blame] | 715 | public static Phone getPhone() { |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 716 | return PhoneFactory.getDefaultPhone(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 717 | } |
| 718 | |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 719 | public static Phone getPhone(int subId) { |
| 720 | return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId)); |
Andrew Lee | 385019f | 2014-11-24 14:19:50 -0800 | [diff] [blame] | 721 | } |
| 722 | |
Santos Cordon | de10b75 | 2013-09-19 04:11:33 -0700 | [diff] [blame] | 723 | /* package */ CallManager getCallManager() { |
| 724 | return mCM; |
| 725 | } |
| 726 | |
Chris Manton | 4e9fa91 | 2015-06-19 11:26:57 -0700 | [diff] [blame] | 727 | public PersistableBundle getCarrierConfig() { |
Shishir Agrawal | d3480e0 | 2016-01-25 13:05:49 -0800 | [diff] [blame] | 728 | return getCarrierConfigForSubId(SubscriptionManager.getDefaultSubscriptionId()); |
Jonathan Basseri | 89b0ab4 | 2015-05-01 10:52:40 -0700 | [diff] [blame] | 729 | } |
| 730 | |
Chris Manton | 4e9fa91 | 2015-06-19 11:26:57 -0700 | [diff] [blame] | 731 | public PersistableBundle getCarrierConfigForSubId(int subId) { |
Philip P. Moltmann | 0079aae | 2020-03-05 16:24:02 -0800 | [diff] [blame] | 732 | return configLoader.getConfigForSubIdWithFeature(subId, getOpPackageName(), |
| 733 | getAttributionTag()); |
Junda Liu | 605148f | 2015-04-28 15:23:40 -0700 | [diff] [blame] | 734 | } |
| 735 | |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 736 | private void registerSettingsObserver() { |
| 737 | mSettingsObserver.unobserve(); |
| 738 | String dataRoamingSetting = Settings.Global.DATA_ROAMING; |
| 739 | String mobileDataSetting = Settings.Global.MOBILE_DATA; |
| 740 | if (TelephonyManager.getDefault().getSimCount() > 1) { |
| 741 | int subId = mDefaultDataSubId; |
| 742 | if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { |
| 743 | dataRoamingSetting += subId; |
| 744 | mobileDataSetting += subId; |
| 745 | } |
| 746 | } |
| 747 | |
| 748 | // Listen for user data roaming setting changed event |
| 749 | mSettingsObserver.observe(Settings.Global.getUriFor(dataRoamingSetting), |
| 750 | EVENT_DATA_ROAMING_SETTINGS_CHANGED); |
| 751 | |
| 752 | // Listen for mobile data setting changed event |
| 753 | mSettingsObserver.observe(Settings.Global.getUriFor(mobileDataSetting), |
| 754 | EVENT_MOBILE_DATA_SETTINGS_CHANGED); |
| 755 | } |
| 756 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 757 | /** |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 758 | * Sets the activity responsible for un-PUK-blocking the device |
| 759 | * so that we may close it when we receive a positive result. |
| 760 | * mPUKEntryActivity is also used to indicate to the device that |
| 761 | * we are trying to un-PUK-lock the phone. In other words, iff |
| 762 | * it is NOT null, then we are trying to unlock and waiting for |
| 763 | * the SIM to move to READY state. |
| 764 | * |
| 765 | * @param activity is the activity to close when PUK has |
| 766 | * finished unlocking. Can be set to null to indicate the unlock |
| 767 | * or SIM READYing process is over. |
| 768 | */ |
| 769 | void setPukEntryActivity(Activity activity) { |
Tyler Gunn | 3fc09c0 | 2020-05-08 16:35:55 -0700 | [diff] [blame] | 770 | Log.i(LOG_TAG, "setPukEntryActivity - set to " + (activity == null ? "null" : "activity")); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 771 | mPUKEntryActivity = activity; |
| 772 | } |
| 773 | |
| 774 | Activity getPUKEntryActivity() { |
| 775 | return mPUKEntryActivity; |
| 776 | } |
| 777 | |
| 778 | /** |
| 779 | * Sets the dialog responsible for notifying the user of un-PUK- |
| 780 | * blocking - SIM READYing progress, so that we may dismiss it |
| 781 | * when we receive a positive result. |
| 782 | * |
| 783 | * @param dialog indicates the progress dialog informing the user |
| 784 | * of the state of the device. Dismissed upon completion of |
| 785 | * READYing process |
| 786 | */ |
| 787 | void setPukEntryProgressDialog(ProgressDialog dialog) { |
Tyler Gunn | 3fc09c0 | 2020-05-08 16:35:55 -0700 | [diff] [blame] | 788 | Log.i(LOG_TAG, "setPukEntryProgressDialog - set to " |
| 789 | + (dialog == null ? "null" : "activity")); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 790 | mPUKEntryProgressDialog = dialog; |
| 791 | } |
| 792 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 793 | KeyguardManager getKeyguardManager() { |
| 794 | return mKeyguardManager; |
| 795 | } |
| 796 | |
| 797 | private void onMMIComplete(AsyncResult r) { |
| 798 | if (VDBG) Log.d(LOG_TAG, "onMMIComplete()..."); |
| 799 | MmiCode mmiCode = (MmiCode) r.result; |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 800 | PhoneUtils.displayMMIComplete(mmiCode.getPhone(), getInstance(), mmiCode, null, null); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 801 | } |
| 802 | |
fionaxu | 8012697 | 2017-02-01 17:01:26 -0800 | [diff] [blame] | 803 | private void initForNewRadioTechnology() { |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 804 | if (DBG) Log.d(LOG_TAG, "initForNewRadioTechnology..."); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 805 | notifier.updateCallNotifierRegistrationsAfterRadioTechnologyChange(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 806 | } |
| 807 | |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 808 | private void handleAirplaneModeChange(boolean isAirplaneNewlyOn) { |
Sarah Chin | 9ec6e1e | 2022-08-10 13:29:40 -0700 | [diff] [blame] | 809 | Log.i(LOG_TAG, "handleAirplaneModeChange: isAirplaneNewlyOn=" + isAirplaneNewlyOn); |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 810 | int cellState = |
| 811 | Settings.Global.getInt( |
| 812 | getContentResolver(), Settings.Global.CELL_ON, PhoneConstants.CELL_ON_FLAG); |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 813 | switch (cellState) { |
| 814 | case PhoneConstants.CELL_OFF_FLAG: |
Sarah Chin | 9ec6e1e | 2022-08-10 13:29:40 -0700 | [diff] [blame] | 815 | // Airplane mode does not affect the cell radio if user has turned it off. |
| 816 | Log.i(LOG_TAG, "Ignore airplane mode change due to cell off."); |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 817 | break; |
| 818 | case PhoneConstants.CELL_ON_FLAG: |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 819 | maybeTurnCellOff(isAirplaneNewlyOn); |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 820 | break; |
| 821 | case PhoneConstants.CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG: |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 822 | maybeTurnCellOn(isAirplaneNewlyOn); |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 823 | break; |
| 824 | } |
Hall Liu | 7f56e1a | 2019-07-10 14:41:14 -0700 | [diff] [blame] | 825 | for (Phone phone : PhoneFactory.getPhones()) { |
| 826 | phone.getServiceStateTracker().onAirplaneModeChanged(isAirplaneNewlyOn); |
| 827 | } |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 828 | } |
| 829 | |
| 830 | /* |
| 831 | * Returns true if the radio must be turned off when entering airplane mode. |
| 832 | */ |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 833 | private boolean isCellOffInAirplaneMode() { |
| 834 | String airplaneModeRadios = |
| 835 | Settings.Global.getString( |
| 836 | getContentResolver(), Settings.Global.AIRPLANE_MODE_RADIOS); |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 837 | return airplaneModeRadios == null |
| 838 | || airplaneModeRadios.contains(Settings.Global.RADIO_CELL); |
| 839 | } |
| 840 | |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 841 | private void setRadioPowerOff() { |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 842 | Log.i(LOG_TAG, "Turning radio off - airplane"); |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 843 | Settings.Global.putInt( |
| 844 | getContentResolver(), |
| 845 | Settings.Global.CELL_ON, |
| 846 | PhoneConstants.CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG); |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 847 | Settings.Global.putInt(getContentResolver(), Settings.Global.ENABLE_CELLULAR_ON_BOOT, 0); |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 848 | TelephonyProperties.airplane_mode_on(true); // true means int value 1 |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 849 | PhoneUtils.setRadioPower(false); |
Ling Ma | 317906d | 2022-12-05 15:58:14 -0800 | [diff] [blame] | 850 | clearCacheOnRadioOff(); |
| 851 | } |
| 852 | |
| 853 | /** Clear fields on power off radio **/ |
| 854 | private void clearCacheOnRadioOff() { |
| 855 | // Re-show is-roaming notifications after APM mode |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 856 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 857 | mShownNotificationReasons.clear(); |
| 858 | } else { |
| 859 | mPrevRoamingOperatorNumerics.clear(); |
| 860 | } |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 861 | } |
| 862 | |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 863 | private void setRadioPowerOn() { |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 864 | Log.i(LOG_TAG, "Turning radio on - airplane"); |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 865 | Settings.Global.putInt( |
| 866 | getContentResolver(), Settings.Global.CELL_ON, PhoneConstants.CELL_ON_FLAG); |
| 867 | Settings.Global.putInt(getContentResolver(), Settings.Global.ENABLE_CELLULAR_ON_BOOT, 1); |
Meng Wang | 6130762 | 2019-10-23 14:08:43 -0700 | [diff] [blame] | 868 | TelephonyProperties.airplane_mode_on(false); // false means int value 0 |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 869 | PhoneUtils.setRadioPower(true); |
| 870 | } |
| 871 | |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 872 | private void maybeTurnCellOff(boolean isAirplaneNewlyOn) { |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 873 | if (isAirplaneNewlyOn) { |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 874 | // If we are trying to turn off the radio, make sure there are no active |
| 875 | // emergency calls. If there are, switch airplane mode back to off. |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 876 | TelecomManager tm = (TelecomManager) getSystemService(TELECOM_SERVICE); |
Tyler Gunn | 900d8fd | 2018-09-21 09:22:12 -0700 | [diff] [blame] | 877 | |
| 878 | if (tm != null && tm.isInEmergencyCall()) { |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 879 | // Switch airplane mode back to off. |
Jordan Liu | 0e819b1 | 2019-08-28 15:33:05 -0700 | [diff] [blame] | 880 | ConnectivityManager cm = |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 881 | (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); |
Jordan Liu | 0e819b1 | 2019-08-28 15:33:05 -0700 | [diff] [blame] | 882 | cm.setAirplaneMode(false); |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 883 | Toast.makeText(this, R.string.radio_off_during_emergency_call, Toast.LENGTH_LONG) |
| 884 | .show(); |
| 885 | Log.i(LOG_TAG, "Ignoring airplane mode: emergency call. Turning airplane off"); |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 886 | } else if (isCellOffInAirplaneMode()) { |
| 887 | setRadioPowerOff(); |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 888 | } else { |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 889 | Log.i(LOG_TAG, "Ignoring airplane mode: settings prevent cell radio power off"); |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 890 | } |
Sarah Chin | 9ec6e1e | 2022-08-10 13:29:40 -0700 | [diff] [blame] | 891 | } else { |
| 892 | Log.i(LOG_TAG, "Ignoring airplane mode: not newly on"); |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 893 | } |
| 894 | } |
| 895 | |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 896 | private void maybeTurnCellOn(boolean isAirplaneNewlyOn) { |
Chris Manton | a09f363 | 2016-02-09 14:48:42 -0800 | [diff] [blame] | 897 | if (!isAirplaneNewlyOn) { |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 898 | setRadioPowerOn(); |
Sarah Chin | 9ec6e1e | 2022-08-10 13:29:40 -0700 | [diff] [blame] | 899 | } else { |
| 900 | Log.i(LOG_TAG, "Ignoring airplane mode off: radio is already on."); |
Santos Cordon | e18902f | 2016-03-22 17:16:04 -0700 | [diff] [blame] | 901 | } |
| 902 | } |
| 903 | |
Santos Cordon | 593ab38 | 2013-08-06 21:58:23 -0700 | [diff] [blame] | 904 | /** |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 905 | * Receiver for misc intent broadcasts the Phone app cares about. |
| 906 | */ |
| 907 | private class PhoneAppBroadcastReceiver extends BroadcastReceiver { |
| 908 | @Override |
| 909 | public void onReceive(Context context, Intent intent) { |
| 910 | String action = intent.getAction(); |
| 911 | if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) { |
Taesu Lee | 3dc572b | 2020-08-07 18:16:22 +0900 | [diff] [blame] | 912 | boolean airplaneMode = intent.getBooleanExtra("state", false); |
Taesu Lee | 62f826d | 2020-08-10 16:01:18 +0900 | [diff] [blame] | 913 | handleAirplaneModeChange(airplaneMode); |
Amit Mahajan | f5d92c8 | 2018-11-02 17:44:40 -0700 | [diff] [blame] | 914 | } else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) { |
| 915 | // re-register as it may be a new IccCard |
| 916 | int phoneId = intent.getIntExtra(PhoneConstants.PHONE_KEY, |
| 917 | SubscriptionManager.INVALID_PHONE_INDEX); |
| 918 | if (SubscriptionManager.isValidPhoneId(phoneId)) { |
| 919 | PhoneUtils.unregisterIccStatus(mHandler, phoneId); |
| 920 | PhoneUtils.registerIccStatus(mHandler, EVENT_SIM_NETWORK_LOCKED, phoneId); |
| 921 | } |
Nazish Tabassum | 160d211 | 2019-12-23 17:31:33 +0530 | [diff] [blame] | 922 | String iccStatus = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); |
| 923 | mHandler.sendMessage(mHandler.obtainMessage(EVENT_SIM_STATE_CHANGED, |
| 924 | new EventSimStateChangedBag(phoneId, iccStatus))); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 925 | } else if (action.equals(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED)) { |
| 926 | String newPhone = intent.getStringExtra(PhoneConstants.PHONE_NAME_KEY); |
fionaxu | 8012697 | 2017-02-01 17:01:26 -0800 | [diff] [blame] | 927 | Log.d(LOG_TAG, "Radio technology switched. Now " + newPhone + " is active."); |
| 928 | initForNewRadioTechnology(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 929 | } else if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) { |
Sandeep Kunta | de73a6a | 2014-10-15 18:45:56 +0530 | [diff] [blame] | 930 | int phoneId = intent.getIntExtra(PhoneConstants.PHONE_KEY, 0); |
Srikanth Chintala | 079912a | 2016-03-03 16:35:01 +0530 | [diff] [blame] | 931 | phoneInEcm = PhoneFactory.getPhone(phoneId); |
Sandeep Kunta | de73a6a | 2014-10-15 18:45:56 +0530 | [diff] [blame] | 932 | Log.d(LOG_TAG, "Emergency Callback Mode. phoneId:" + phoneId); |
| 933 | if (phoneInEcm != null) { |
| 934 | if (TelephonyCapabilities.supportsEcm(phoneInEcm)) { |
| 935 | Log.d(LOG_TAG, "Emergency Callback Mode arrived in PhoneApp."); |
| 936 | // Start Emergency Callback Mode service |
Daniel Bright | 30efde4 | 2020-01-09 22:11:15 -0800 | [diff] [blame] | 937 | if (intent.getBooleanExtra( |
| 938 | TelephonyManager.EXTRA_PHONE_IN_ECM_STATE, false)) { |
Sandeep Kunta | de73a6a | 2014-10-15 18:45:56 +0530 | [diff] [blame] | 939 | context.startService(new Intent(context, |
| 940 | EmergencyCallbackModeService.class)); |
| 941 | } else { |
| 942 | phoneInEcm = null; |
| 943 | } |
| 944 | } else { |
| 945 | // It doesn't make sense to get ACTION_EMERGENCY_CALLBACK_MODE_CHANGED |
| 946 | // on a device that doesn't support ECM in the first place. |
| 947 | Log.e(LOG_TAG, "Got ACTION_EMERGENCY_CALLBACK_MODE_CHANGED, but " |
| 948 | + "ECM isn't supported for phone: " + phoneInEcm.getPhoneName()); |
| 949 | phoneInEcm = null; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 950 | } |
| 951 | } else { |
Sandeep Kunta | de73a6a | 2014-10-15 18:45:56 +0530 | [diff] [blame] | 952 | Log.w(LOG_TAG, "phoneInEcm is null."); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 953 | } |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 954 | } else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) { |
| 955 | // Roaming status could be overridden by carrier config, so we need to update it. |
| 956 | if (VDBG) Log.v(LOG_TAG, "carrier config changed."); |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 957 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 958 | updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED); |
| 959 | } else { |
| 960 | updateDataRoamingStatusForFeatureDisabled(null); |
| 961 | } |
chen xu | baf9fe5 | 2019-07-02 17:28:24 -0700 | [diff] [blame] | 962 | updateLimitedSimFunctionForDualSim(); |
Lei Liu | 863eac0 | 2020-06-24 20:12:55 +0800 | [diff] [blame] | 963 | int subId = intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, |
| 964 | SubscriptionManager.INVALID_SUBSCRIPTION_ID); |
| 965 | if (SubscriptionManager.isValidSubscriptionId(subId)) { |
| 966 | mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARRIER_CONFIG_CHANGED, |
| 967 | new Integer(subId))); |
| 968 | } |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 969 | } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) { |
| 970 | // We also need to pay attention when default data subscription changes. |
| 971 | if (VDBG) Log.v(LOG_TAG, "default data sub changed."); |
| 972 | mDefaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId(); |
| 973 | registerSettingsObserver(); |
| 974 | Phone phone = getPhone(mDefaultDataSubId); |
| 975 | if (phone != null) { |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 976 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 977 | updateDataRoamingStatus( |
| 978 | ROAMING_NOTIFICATION_REASON_DEFAULT_DATA_SUBS_CHANGED); |
| 979 | } else { |
| 980 | updateDataRoamingStatusForFeatureDisabled(null); |
| 981 | } |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 982 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 983 | } |
| 984 | } |
| 985 | } |
| 986 | |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 987 | private void handleServiceStateChanged(ServiceState serviceState, int subId) { |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 988 | if (VDBG) Log.v(LOG_TAG, "handleServiceStateChanged"); |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 989 | int state = serviceState.getState(); |
| 990 | notificationMgr.updateNetworkSelection(state, subId); |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 991 | |
Sarah Chin | 072ffb2 | 2022-05-03 17:58:59 -0700 | [diff] [blame] | 992 | if (VDBG) { |
| 993 | Log.v(LOG_TAG, "subId=" + subId + ", mDefaultDataSubId=" |
| 994 | + mDefaultDataSubId + ", ss roaming=" + serviceState.getDataRoaming()); |
| 995 | } |
| 996 | if (subId == mDefaultDataSubId) { |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 997 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 998 | updateDataRoamingStatus(ROAMING_NOTIFICATION_REASON_SERVICE_STATE_CHANGED); |
| 999 | } else { |
| 1000 | updateDataRoamingStatusForFeatureDisabled(serviceState.getOperatorNumeric()); |
| 1001 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 1002 | } |
| 1003 | } |
| 1004 | |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1005 | /** |
| 1006 | * When roaming, if mobile data cannot be established due to data roaming not enabled, we need |
| 1007 | * to notify the user so they can enable it through settings. Vise versa if the condition |
| 1008 | * changes, we need to dismiss the notification. |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1009 | * @param reason to inform which event is called for notification update. |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1010 | */ |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1011 | private void updateDataRoamingStatus(@RoamingNotificationReason int reason) { |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1012 | if (VDBG) Log.v(LOG_TAG, "updateDataRoamingStatus"); |
| 1013 | Phone phone = getPhone(mDefaultDataSubId); |
| 1014 | if (phone == null) { |
| 1015 | Log.w(LOG_TAG, "Can't get phone with sub id = " + mDefaultDataSubId); |
| 1016 | return; |
| 1017 | } |
| 1018 | |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1019 | ServiceState serviceState = phone.getServiceState(); |
Thomas Nguyen | 4f9c89e | 2023-12-18 10:51:57 -0800 | [diff] [blame] | 1020 | if (serviceState == null) { |
| 1021 | Log.e(LOG_TAG, "updateDataRoamingStatus: serviceState is null"); |
| 1022 | return; |
| 1023 | } |
| 1024 | |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1025 | String roamingNumeric = serviceState.getOperatorNumeric(); |
| 1026 | String roamingNumericReason = "RoamingNumeric=" + roamingNumeric; |
| 1027 | String callingReason = "CallingReason=" + reason; |
| 1028 | boolean dataIsNowRoaming = serviceState.getDataRoaming(); |
Jack Yu | 3e2ac6e | 2022-03-26 13:59:45 -0700 | [diff] [blame] | 1029 | boolean dataAllowed; |
| 1030 | boolean notAllowedDueToRoamingOff; |
Sarah Chin | e04784a | 2022-10-31 20:32:34 -0700 | [diff] [blame] | 1031 | List<DataDisallowedReason> reasons = phone.getDataNetworkController() |
| 1032 | .getInternetDataDisallowedReasons(); |
Jack Yu | 7968c6d | 2022-07-31 00:43:21 -0700 | [diff] [blame] | 1033 | dataAllowed = reasons.isEmpty(); |
| 1034 | notAllowedDueToRoamingOff = (reasons.size() == 1 |
| 1035 | && reasons.contains(DataDisallowedReason.ROAMING_DISABLED)); |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1036 | StringBuilder sb = new StringBuilder("updateDataRoamingStatus"); |
| 1037 | sb.append(" dataAllowed=").append(dataAllowed); |
| 1038 | sb.append(", reasons=").append(reasons); |
| 1039 | sb.append(", dataIsNowRoaming=").append(dataIsNowRoaming); |
| 1040 | sb.append(", ").append(roamingNumericReason); |
| 1041 | sb.append(", ").append(callingReason); |
| 1042 | mDataRoamingNotifLog.log(sb.toString()); |
Ling Ma | 317906d | 2022-12-05 15:58:14 -0800 | [diff] [blame] | 1043 | if (VDBG) { |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1044 | Log.v(LOG_TAG, sb.toString()); |
Ling Ma | 317906d | 2022-12-05 15:58:14 -0800 | [diff] [blame] | 1045 | } |
Jack Yu | 3e2ac6e | 2022-03-26 13:59:45 -0700 | [diff] [blame] | 1046 | |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1047 | // Determine if a given roaming numeric has never been shown. |
| 1048 | boolean shownInThisNumeric = false; |
| 1049 | if (reason == ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED |
| 1050 | || reason == ROAMING_NOTIFICATION_REASON_SERVICE_STATE_CHANGED) { |
| 1051 | shownInThisNumeric = mShownNotificationReasons.contains(roamingNumericReason); |
| 1052 | } |
| 1053 | // Determine if a notification has never been shown by given calling reason. |
| 1054 | boolean shownForThisReason = mShownNotificationReasons.contains(callingReason); |
| 1055 | |
Jack Yu | 3e2ac6e | 2022-03-26 13:59:45 -0700 | [diff] [blame] | 1056 | if (!dataAllowed && notAllowedDueToRoamingOff) { |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1057 | if (!shownInThisNumeric && roamingNumeric != null) { |
| 1058 | mShownNotificationReasons.add(roamingNumericReason); |
| 1059 | } |
| 1060 | if (!shownForThisReason |
| 1061 | && reason == ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED) { |
| 1062 | mShownNotificationReasons.add(callingReason); |
Ling Ma | 4e15c32 | 2022-12-07 11:20:53 -0800 | [diff] [blame] | 1063 | } |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 1064 | // No need to show it again if we never cancelled it explicitly. |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1065 | if (getCurrentRoamingNotification() == ROAMING_NOTIFICATION_DISCONNECTED) { |
| 1066 | return; |
| 1067 | } |
| 1068 | |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1069 | // If the only reason of no data is data roaming disabled, then we notify the user |
| 1070 | // so the user can turn on data roaming. |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1071 | if (!shownInThisNumeric && !shownForThisReason) { |
| 1072 | updateDataRoamingNotification(ROAMING_NOTIFICATION_DISCONNECTED); |
| 1073 | } else { |
| 1074 | // Don't show roaming notification if we've already shown for this MccMnc |
| 1075 | Log.d(LOG_TAG, "Skip roaming disconnected notification since already" |
| 1076 | + " shownInThisNumeric=" + shownInThisNumeric |
| 1077 | + " shownForThisReason=" + shownForThisReason); |
| 1078 | // Dismiss notification if the other notification is shown. |
| 1079 | if (getCurrentRoamingNotification() != ROAMING_NOTIFICATION_NO_NOTIFICATION) { |
| 1080 | updateDataRoamingNotification(ROAMING_NOTIFICATION_NO_NOTIFICATION); |
| 1081 | } |
| 1082 | } |
| 1083 | } else if (dataAllowed && dataIsNowRoaming) { |
| 1084 | if (!shownInThisNumeric && roamingNumeric != null) { |
| 1085 | mShownNotificationReasons.add(roamingNumericReason); |
| 1086 | } |
| 1087 | if (!shownForThisReason |
| 1088 | && reason == ROAMING_NOTIFICATION_REASON_CARRIER_CONFIG_CHANGED) { |
| 1089 | mShownNotificationReasons.add(callingReason); |
| 1090 | } |
Sarah Chin | 37b3907 | 2023-11-05 13:28:21 -0800 | [diff] [blame] | 1091 | boolean shouldShowRoamingNotification = shouldShowRoamingNotification(roamingNumeric); |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1092 | // No need to show it again if we never cancelled it explicitly. |
| 1093 | if (getCurrentRoamingNotification() == ROAMING_NOTIFICATION_CONNECTED) { |
Ling Ma | 4e15c32 | 2022-12-07 11:20:53 -0800 | [diff] [blame] | 1094 | return; |
| 1095 | } |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1096 | |
| 1097 | // Inform users that roaming charges may apply. |
Sarah Chin | 37b3907 | 2023-11-05 13:28:21 -0800 | [diff] [blame] | 1098 | if (!shownInThisNumeric && !shownForThisReason && shouldShowRoamingNotification) { |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1099 | updateDataRoamingNotification(ROAMING_NOTIFICATION_CONNECTED); |
| 1100 | } else { |
| 1101 | // Don't show roaming notification if we've already shown for this MccMnc or |
| 1102 | // disabled from carrier config. |
| 1103 | Log.d(LOG_TAG, "Skip roaming connected notification since already" |
| 1104 | + " shownInThisNumeric:" + shownInThisNumeric |
| 1105 | + " shownForThisReason:" + shownForThisReason |
Sarah Chin | 37b3907 | 2023-11-05 13:28:21 -0800 | [diff] [blame] | 1106 | + " shouldShowRoamingNotification:" + shouldShowRoamingNotification); |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1107 | // Dismiss notification if the other notification is shown. |
| 1108 | if (getCurrentRoamingNotification() != ROAMING_NOTIFICATION_NO_NOTIFICATION) { |
| 1109 | updateDataRoamingNotification(ROAMING_NOTIFICATION_NO_NOTIFICATION); |
| 1110 | } |
| 1111 | } |
| 1112 | } else if (getCurrentRoamingNotification() != ROAMING_NOTIFICATION_NO_NOTIFICATION) { |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 1113 | // Otherwise we either 1) we are not roaming or 2) roaming is off but ROAMING_DISABLED |
| 1114 | // is not the only data disable reason. In this case we dismiss the notification we |
| 1115 | // showed earlier. |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1116 | updateDataRoamingNotification(ROAMING_NOTIFICATION_NO_NOTIFICATION); |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1117 | } |
| 1118 | } |
| 1119 | |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1120 | private void updateDataRoamingNotification(@RoamingNotification int roamingNotification) { |
| 1121 | int event; |
| 1122 | switch (roamingNotification) { |
| 1123 | case ROAMING_NOTIFICATION_NO_NOTIFICATION: |
| 1124 | Log.d(LOG_TAG, "Dismiss roaming notification"); |
| 1125 | mDataRoamingNotifLog.log("Hide roaming."); |
| 1126 | event = EVENT_DATA_ROAMING_OK; |
| 1127 | break; |
| 1128 | case ROAMING_NOTIFICATION_CONNECTED: |
| 1129 | Log.d(LOG_TAG, "Show roaming connected notification"); |
| 1130 | mDataRoamingNotifLog.log("Show roaming on."); |
| 1131 | event = EVENT_DATA_ROAMING_CONNECTED; |
| 1132 | break; |
| 1133 | case ROAMING_NOTIFICATION_DISCONNECTED: |
| 1134 | Log.d(LOG_TAG, "Show roaming disconnected notification"); |
| 1135 | mDataRoamingNotifLog.log("Show roaming off."); |
| 1136 | event = EVENT_DATA_ROAMING_DISCONNECTED; |
| 1137 | break; |
| 1138 | default: |
| 1139 | Log.d(LOG_TAG, "Should never reach here."); |
| 1140 | mDataRoamingNotifLog.log("Should never reach here."); |
| 1141 | return; |
| 1142 | } |
| 1143 | mCurrentRoamingNotification = roamingNotification; |
| 1144 | mHandler.obtainMessage(event, mDefaultDataSubId, 0).sendToTarget(); |
| 1145 | } |
| 1146 | |
| 1147 | private @RoamingNotification int getCurrentRoamingNotification() { |
| 1148 | return mCurrentRoamingNotification; |
| 1149 | } |
| 1150 | |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 1151 | // For reorganize_roaming_notification feature disabled. |
| 1152 | /** |
| 1153 | * When roaming, if mobile data cannot be established due to data roaming not enabled, we need |
| 1154 | * to notify the user so they can enable it through settings. Vise versa if the condition |
| 1155 | * changes, we need to dismiss the notification. |
| 1156 | * @param roamingOperatorNumeric The operator numeric for the current roaming. {@code null} if |
| 1157 | * the current roaming operator numeric didn't change. |
| 1158 | */ |
| 1159 | private void updateDataRoamingStatusForFeatureDisabled( |
| 1160 | @Nullable String roamingOperatorNumeric) { |
| 1161 | if (VDBG) Log.v(LOG_TAG, "updateDataRoamingStatusForFeatureDisabled"); |
| 1162 | Phone phone = getPhone(mDefaultDataSubId); |
| 1163 | if (phone == null) { |
| 1164 | Log.w(LOG_TAG, "Can't get phone with sub id = " + mDefaultDataSubId); |
| 1165 | return; |
| 1166 | } |
| 1167 | |
| 1168 | boolean dataAllowed; |
| 1169 | boolean notAllowedDueToRoamingOff; |
| 1170 | List<DataDisallowedReason> reasons = phone.getDataNetworkController() |
| 1171 | .getInternetDataDisallowedReasons(); |
| 1172 | dataAllowed = reasons.isEmpty(); |
| 1173 | notAllowedDueToRoamingOff = (reasons.size() == 1 |
| 1174 | && reasons.contains(DataDisallowedReason.ROAMING_DISABLED)); |
| 1175 | mDataRoamingNotifLog.log("dataAllowed=" + dataAllowed + ", reasons=" + reasons |
| 1176 | + ", roamingOperatorNumeric=" + roamingOperatorNumeric); |
| 1177 | if (VDBG) { |
| 1178 | Log.v(LOG_TAG, "dataAllowed=" + dataAllowed + ", reasons=" + reasons |
| 1179 | + ", roamingOperatorNumeric=" + roamingOperatorNumeric); |
| 1180 | } |
| 1181 | |
| 1182 | if (!dataAllowed && notAllowedDueToRoamingOff) { |
| 1183 | // Don't show roaming notification if we've already shown for this MccMnc |
| 1184 | if (roamingOperatorNumeric != null |
| 1185 | && !mPrevRoamingOperatorNumerics.add(roamingOperatorNumeric)) { |
| 1186 | Log.d(LOG_TAG, "Skip roaming disconnected notification since already shown in " |
| 1187 | + "MccMnc " + roamingOperatorNumeric); |
| 1188 | return; |
| 1189 | } |
| 1190 | // No need to show it again if we never cancelled it explicitly. |
| 1191 | if (mPrevRoamingNotification == ROAMING_NOTIFICATION_DISCONNECTED) return; |
| 1192 | // If the only reason of no data is data roaming disabled, then we notify the user |
| 1193 | // so the user can turn on data roaming. |
| 1194 | mPrevRoamingNotification = ROAMING_NOTIFICATION_DISCONNECTED; |
| 1195 | Log.d(LOG_TAG, "Show roaming disconnected notification"); |
| 1196 | mDataRoamingNotifLog.log("Show roaming off."); |
| 1197 | Message msg = mHandler.obtainMessage(EVENT_DATA_ROAMING_DISCONNECTED); |
| 1198 | msg.arg1 = mDefaultDataSubId; |
| 1199 | msg.sendToTarget(); |
| 1200 | } else if (dataAllowed && dataIsNowRoaming(mDefaultDataSubId)) { |
sangyun | 5abbf7e | 2024-02-01 00:47:30 +0900 | [diff] [blame] | 1201 | if (!shouldShowRoamingNotification(roamingOperatorNumeric != null |
| 1202 | ? roamingOperatorNumeric : phone.getServiceState().getOperatorNumeric())) { |
Sarah Chin | 37b3907 | 2023-11-05 13:28:21 -0800 | [diff] [blame] | 1203 | Log.d(LOG_TAG, "Skip showing roaming connected notification."); |
| 1204 | return; |
| 1205 | } |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 1206 | // Don't show roaming notification if we've already shown for this MccMnc |
| 1207 | if (roamingOperatorNumeric != null |
| 1208 | && !mPrevRoamingOperatorNumerics.add(roamingOperatorNumeric)) { |
| 1209 | Log.d(LOG_TAG, "Skip roaming connected notification since already shown in " |
| 1210 | + "MccMnc " + roamingOperatorNumeric); |
| 1211 | return; |
| 1212 | } |
| 1213 | // No need to show it again if we never cancelled it explicitly, or carrier config |
| 1214 | // indicates this is not needed. |
| 1215 | if (mPrevRoamingNotification == ROAMING_NOTIFICATION_CONNECTED) return; |
| 1216 | mPrevRoamingNotification = ROAMING_NOTIFICATION_CONNECTED; |
| 1217 | Log.d(LOG_TAG, "Show roaming connected notification"); |
| 1218 | mDataRoamingNotifLog.log("Show roaming on."); |
| 1219 | Message msg = mHandler.obtainMessage(EVENT_DATA_ROAMING_CONNECTED); |
| 1220 | msg.arg1 = mDefaultDataSubId; |
| 1221 | msg.sendToTarget(); |
| 1222 | } else if (mPrevRoamingNotification != ROAMING_NOTIFICATION_NO_NOTIFICATION) { |
| 1223 | // Otherwise we either 1) we are not roaming or 2) roaming is off but ROAMING_DISABLED |
| 1224 | // is not the only data disable reason. In this case we dismiss the notification we |
| 1225 | // showed earlier. |
| 1226 | mPrevRoamingNotification = ROAMING_NOTIFICATION_NO_NOTIFICATION; |
| 1227 | Log.d(LOG_TAG, "Dismiss roaming notification"); |
| 1228 | mDataRoamingNotifLog.log("Hide. data allowed=" + dataAllowed); |
| 1229 | mHandler.sendEmptyMessage(EVENT_DATA_ROAMING_OK); |
| 1230 | } |
| 1231 | } |
| 1232 | |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 1233 | /** |
| 1234 | * |
| 1235 | * @param subId to check roaming on |
| 1236 | * @return whether we have transitioned to dataRoaming |
| 1237 | */ |
| 1238 | private boolean dataIsNowRoaming(int subId) { |
Sarah Chin | e04784a | 2022-10-31 20:32:34 -0700 | [diff] [blame] | 1239 | return getPhone(subId).getServiceState().getDataRoaming(); |
Jordan Liu | ff2ccd7 | 2019-07-23 15:54:41 -0700 | [diff] [blame] | 1240 | } |
| 1241 | |
Sarah Chin | 37b3907 | 2023-11-05 13:28:21 -0800 | [diff] [blame] | 1242 | private boolean shouldShowRoamingNotification(String roamingNumeric) { |
| 1243 | PersistableBundle config = getCarrierConfigForSubId(mDefaultDataSubId); |
| 1244 | boolean showRoamingNotification = config.getBoolean( |
| 1245 | CarrierConfigManager.KEY_SHOW_DATA_CONNECTED_ROAMING_NOTIFICATION_BOOL); |
| 1246 | |
| 1247 | if (TextUtils.isEmpty(roamingNumeric) || !mFeatureFlags.hideRoamingIcon()) { |
| 1248 | Log.d(LOG_TAG, "shouldShowRoamingNotification: roamingNumeric=" + roamingNumeric |
| 1249 | + ", hideRoaming=" + mFeatureFlags.hideRoamingIcon()); |
| 1250 | return showRoamingNotification; |
| 1251 | } |
| 1252 | |
| 1253 | String[] includedMccMncs = config.getStringArray(CarrierConfigManager |
| 1254 | .KEY_DATA_CONNECTED_ROAMING_NOTIFICATION_INCLUDED_MCC_MNCS_STRING_ARRAY); |
| 1255 | if (includedMccMncs != null) { |
| 1256 | for (String mccMnc : includedMccMncs) { |
| 1257 | if (roamingNumeric.equals(mccMnc)) { |
| 1258 | Log.d(LOG_TAG, "shouldShowRoamingNotification: show for MCC/MNC " + mccMnc); |
| 1259 | return showRoamingNotification; |
| 1260 | } |
| 1261 | } |
| 1262 | } |
| 1263 | |
| 1264 | String[] excludedMccs = config.getStringArray(CarrierConfigManager |
| 1265 | .KEY_DATA_CONNECTED_ROAMING_NOTIFICATION_EXCLUDED_MCCS_STRING_ARRAY); |
| 1266 | String roamingMcc = roamingNumeric.length() < 3 ? "" : roamingNumeric.substring(0, 3); |
| 1267 | if (excludedMccs != null && !TextUtils.isEmpty(roamingMcc)) { |
| 1268 | for (String mcc : excludedMccs) { |
| 1269 | if (roamingMcc.equals(mcc)) { |
| 1270 | Log.d(LOG_TAG, "shouldShowRoamingNotification: ignore for MCC " + mcc); |
| 1271 | return false; |
| 1272 | } |
| 1273 | } |
| 1274 | } |
| 1275 | |
| 1276 | if (showRoamingNotification) { |
| 1277 | Log.d(LOG_TAG, "shouldShowRoamingNotification: show for numeric " + roamingNumeric); |
| 1278 | } |
| 1279 | return showRoamingNotification; |
| 1280 | } |
| 1281 | |
chen xu | baf9fe5 | 2019-07-02 17:28:24 -0700 | [diff] [blame] | 1282 | private void updateLimitedSimFunctionForDualSim() { |
| 1283 | if (DBG) Log.d(LOG_TAG, "updateLimitedSimFunctionForDualSim"); |
| 1284 | // check conditions to display limited SIM function notification under dual SIM |
| 1285 | SubscriptionManager subMgr = (SubscriptionManager) getSystemService( |
| 1286 | Context.TELEPHONY_SUBSCRIPTION_SERVICE); |
| 1287 | List<SubscriptionInfo> subList = subMgr.getActiveSubscriptionInfoList(false); |
| 1288 | if (subList != null && subList.size() > 1) { |
| 1289 | CarrierConfigManager configMgr = (CarrierConfigManager) |
| 1290 | getSystemService(Context.CARRIER_CONFIG_SERVICE); |
| 1291 | for (SubscriptionInfo info : subList) { |
| 1292 | PersistableBundle b = configMgr.getConfigForSubId(info.getSubscriptionId()); |
| 1293 | if (b != null) { |
| 1294 | if (b.getBoolean(CarrierConfigManager |
| 1295 | .KEY_LIMITED_SIM_FUNCTION_NOTIFICATION_FOR_DSDS_BOOL)) { |
| 1296 | notificationMgr.showLimitedSimFunctionWarningNotification( |
| 1297 | info.getSubscriptionId(), |
| 1298 | info.getDisplayName().toString()); |
| 1299 | } else { |
| 1300 | notificationMgr.dismissLimitedSimFunctionWarningNotification( |
| 1301 | info.getSubscriptionId()); |
| 1302 | } |
| 1303 | } |
| 1304 | } |
| 1305 | } else { |
| 1306 | // cancel notifications for all subs |
| 1307 | notificationMgr.dismissLimitedSimFunctionWarningNotification( |
| 1308 | SubscriptionManager.INVALID_SUBSCRIPTION_ID); |
| 1309 | } |
| 1310 | notificationMgr.dismissLimitedSimFunctionWarningNotificationForInactiveSubs(); |
| 1311 | |
| 1312 | } |
| 1313 | |
Sandeep Kunta | de73a6a | 2014-10-15 18:45:56 +0530 | [diff] [blame] | 1314 | public Phone getPhoneInEcm() { |
| 1315 | return phoneInEcm; |
| 1316 | } |
| 1317 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 1318 | /** |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 1319 | * Triggers a refresh of the message waiting (voicemail) indicator. |
| 1320 | * |
| 1321 | * @param subId the subscription id we should refresh the notification for. |
| 1322 | */ |
| 1323 | public void refreshMwiIndicator(int subId) { |
| 1324 | notificationMgr.refreshMwi(subId); |
| 1325 | } |
| 1326 | |
| 1327 | /** |
Pengquan Meng | dd9ac82 | 2018-09-20 15:25:35 -0700 | [diff] [blame] | 1328 | * Called when the network selection on the subscription {@code subId} is changed by the user. |
| 1329 | * |
| 1330 | * @param subId the subscription id. |
| 1331 | */ |
| 1332 | public void onNetworkSelectionChanged(int subId) { |
| 1333 | Phone phone = getPhone(subId); |
| 1334 | if (phone != null) { |
| 1335 | notificationMgr.updateNetworkSelection(phone.getServiceState().getState(), subId); |
| 1336 | } else { |
| 1337 | Log.w(LOG_TAG, "onNetworkSelectionChanged on null phone, subId: " + subId); |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1341 | /** |
James.cf Lin | 4b784aa | 2021-01-31 03:25:15 +0800 | [diff] [blame] | 1342 | * @return whether the device supports RCS User Capability Exchange or not. |
| 1343 | */ |
| 1344 | public boolean getDeviceUceEnabled() { |
| 1345 | return (mTelephonyRcsService == null) ? false : mTelephonyRcsService.isDeviceUceEnabled(); |
| 1346 | } |
| 1347 | |
| 1348 | /** |
| 1349 | * Set the device supports RCS User Capability Exchange. |
| 1350 | * @param isEnabled true if the device supports UCE. |
| 1351 | */ |
| 1352 | public void setDeviceUceEnabled(boolean isEnabled) { |
| 1353 | if (mTelephonyRcsService != null) { |
| 1354 | mTelephonyRcsService.setDeviceUceEnabled(isEnabled); |
| 1355 | } |
| 1356 | } |
| 1357 | |
| 1358 | /** |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1359 | * Dump the state of the object, add calls to other objects as desired. |
| 1360 | * |
| 1361 | * @param fd File descriptor |
| 1362 | * @param printWriter Print writer |
| 1363 | * @param args Arguments |
| 1364 | */ |
| 1365 | public void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) { |
| 1366 | IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, " "); |
| 1367 | pw.println("------- PhoneGlobals -------"); |
| 1368 | pw.increaseIndent(); |
sangyun | 15019e0 | 2023-11-13 21:50:15 +0900 | [diff] [blame] | 1369 | pw.println("FeatureFlags:"); |
| 1370 | pw.increaseIndent(); |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 1371 | pw.println("reorganizeRoamingNotification=" |
| 1372 | + mFeatureFlags.reorganizeRoamingNotification()); |
sangyun | d5f37ab | 2023-11-13 22:52:28 +0900 | [diff] [blame] | 1373 | pw.println("dismissNetworkSelectionNotificationOnSimDisable=" |
| 1374 | + mFeatureFlags.dismissNetworkSelectionNotificationOnSimDisable()); |
sangyun | 15019e0 | 2023-11-13 21:50:15 +0900 | [diff] [blame] | 1375 | pw.decreaseIndent(); |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 1376 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 1377 | pw.println("mCurrentRoamingNotification=" + mCurrentRoamingNotification); |
| 1378 | } else { |
| 1379 | pw.println("mPrevRoamingNotification=" + mPrevRoamingNotification); |
| 1380 | } |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1381 | pw.println("mDefaultDataSubId=" + mDefaultDataSubId); |
Keun young Park | debb853 | 2019-05-30 16:35:27 -0700 | [diff] [blame] | 1382 | pw.println("isSmsCapable=" + TelephonyManager.from(this).isSmsCapable()); |
sangyun | 35f23f8 | 2023-07-18 01:37:53 +0900 | [diff] [blame] | 1383 | pw.println("mDataRoamingNotifLog:"); |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1384 | pw.increaseIndent(); |
| 1385 | mDataRoamingNotifLog.dump(fd, pw, args); |
| 1386 | pw.decreaseIndent(); |
Brad Ebinger | 05f52c2 | 2019-12-05 13:03:21 -0800 | [diff] [blame] | 1387 | pw.println("ImsResolver:"); |
| 1388 | pw.increaseIndent(); |
| 1389 | try { |
Brad Ebinger | d1947d8 | 2021-05-17 20:54:49 +0000 | [diff] [blame] | 1390 | if (ImsResolver.getInstance() != null) ImsResolver.getInstance().dump(fd, pw, args); |
Brad Ebinger | 05f52c2 | 2019-12-05 13:03:21 -0800 | [diff] [blame] | 1391 | } catch (Exception e) { |
| 1392 | e.printStackTrace(); |
| 1393 | } |
| 1394 | pw.decreaseIndent(); |
Brad Ebinger | a68a497 | 2020-01-30 17:31:23 -0800 | [diff] [blame] | 1395 | pw.println("RcsService:"); |
| 1396 | try { |
| 1397 | if (mTelephonyRcsService != null) mTelephonyRcsService.dump(fd, pw, args); |
| 1398 | } catch (Exception e) { |
| 1399 | e.printStackTrace(); |
| 1400 | } |
Hunsuk Choi | 89bd22c | 2021-11-01 13:04:54 +0000 | [diff] [blame] | 1401 | pw.println("ImsStateCallbackController:"); |
| 1402 | try { |
| 1403 | if (mImsStateCallbackController != null) mImsStateCallbackController.dump(pw); |
| 1404 | } catch (Exception e) { |
| 1405 | e.printStackTrace(); |
| 1406 | } |
Hwangoo Park | ba21cf2 | 2022-11-30 14:34:04 +0000 | [diff] [blame] | 1407 | pw.println("DomainSelectionResolver:"); |
| 1408 | pw.increaseIndent(); |
| 1409 | try { |
| 1410 | if (DomainSelectionResolver.getInstance() != null) { |
| 1411 | DomainSelectionResolver.getInstance().dump(fd, pw, args); |
| 1412 | } |
| 1413 | } catch (Exception e) { |
| 1414 | e.printStackTrace(); |
| 1415 | } |
| 1416 | pw.decreaseIndent(); |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1417 | pw.decreaseIndent(); |
sangyun | 1c1918a | 2023-11-13 22:37:50 +0900 | [diff] [blame] | 1418 | if (mFeatureFlags.reorganizeRoamingNotification()) { |
| 1419 | pw.println("mShownNotificationReasons=" + mShownNotificationReasons); |
| 1420 | } else { |
| 1421 | pw.println("mPrevRoamingOperatorNumerics:" + mPrevRoamingOperatorNumerics); |
| 1422 | } |
Jack Yu | 1a2fc35 | 2017-07-14 17:14:37 -0700 | [diff] [blame] | 1423 | pw.println("------- End PhoneGlobals -------"); |
| 1424 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 1425 | } |