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 | |
| 19 | import android.app.Notification; |
| 20 | import android.app.NotificationManager; |
| 21 | import android.app.PendingIntent; |
| 22 | import android.app.StatusBarManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 23 | import android.content.ComponentName; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 24 | import android.content.Context; |
| 25 | import android.content.Intent; |
| 26 | import android.content.SharedPreferences; |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 27 | import android.content.pm.UserInfo; |
Nancy Chen | b4a9270 | 2014-12-04 15:57:29 -0800 | [diff] [blame] | 28 | import android.content.res.Resources; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 29 | import android.net.Uri; |
Jonathan Basseri | c31f1f3 | 2015-05-12 10:13:03 -0700 | [diff] [blame] | 30 | import android.os.PersistableBundle; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 31 | import android.os.SystemProperties; |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 32 | import android.os.UserHandle; |
| 33 | import android.os.UserManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 34 | import android.preference.PreferenceManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 35 | import android.provider.ContactsContract.PhoneLookup; |
| 36 | import android.provider.Settings; |
Tyler Gunn | 4d45d1c | 2014-09-12 22:17:53 -0700 | [diff] [blame] | 37 | import android.telecom.PhoneAccount; |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 38 | import android.telecom.PhoneAccountHandle; |
| 39 | import android.telecom.TelecomManager; |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 40 | import android.telephony.CarrierConfigManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 41 | import android.telephony.PhoneNumberUtils; |
| 42 | import android.telephony.ServiceState; |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 43 | import android.telephony.SubscriptionInfo; |
Andrew Lee | a82b820 | 2014-11-21 16:18:28 -0800 | [diff] [blame] | 44 | import android.telephony.SubscriptionManager; |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 45 | import android.telephony.TelephonyManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 46 | import android.text.TextUtils; |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 47 | import android.util.ArrayMap; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 48 | import android.util.Log; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 49 | import android.widget.Toast; |
| 50 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 51 | import com.android.internal.telephony.Phone; |
| 52 | import com.android.internal.telephony.PhoneBase; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 53 | import com.android.internal.telephony.TelephonyCapabilities; |
Andrew Lee | bf07f76 | 2015-04-07 19:05:50 -0700 | [diff] [blame] | 54 | import com.android.phone.settings.VoicemailSettingsActivity; |
Andrew Lee | 8d66d81 | 2014-11-24 14:54:02 -0800 | [diff] [blame] | 55 | import com.android.phone.settings.VoicemailNotificationSettingsUtil; |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 56 | import com.android.phone.settings.VoicemailProviderSettingsUtil; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 57 | |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 58 | import java.util.Iterator; |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 59 | import java.util.List; |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 60 | import java.util.Map; |
| 61 | import java.util.Set; |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 62 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 63 | /** |
| 64 | * NotificationManager-related utility code for the Phone app. |
| 65 | * |
| 66 | * This is a singleton object which acts as the interface to the |
| 67 | * framework's NotificationManager, and is used to display status bar |
| 68 | * icons and control other status bar-related behavior. |
| 69 | * |
| 70 | * @see PhoneGlobals.notificationMgr |
| 71 | */ |
Chiao Cheng | 312b9c9 | 2013-09-16 15:40:53 -0700 | [diff] [blame] | 72 | public class NotificationMgr { |
Andrew Lee | a82b820 | 2014-11-21 16:18:28 -0800 | [diff] [blame] | 73 | private static final String LOG_TAG = NotificationMgr.class.getSimpleName(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 74 | private static final boolean DBG = |
| 75 | (PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1); |
| 76 | // Do not check in with VDBG = true, since that may write PII to the system log. |
| 77 | private static final boolean VDBG = false; |
| 78 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 79 | // notification types |
Santos Cordon | f68db2e | 2014-07-02 14:40:44 -0700 | [diff] [blame] | 80 | static final int MMI_NOTIFICATION = 1; |
| 81 | static final int NETWORK_SELECTION_NOTIFICATION = 2; |
| 82 | static final int VOICEMAIL_NOTIFICATION = 3; |
| 83 | static final int CALL_FORWARD_NOTIFICATION = 4; |
| 84 | static final int DATA_DISCONNECTED_ROAMING_NOTIFICATION = 5; |
| 85 | static final int SELECTED_OPERATOR_FAIL_NOTIFICATION = 6; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 86 | |
| 87 | /** The singleton NotificationMgr instance. */ |
| 88 | private static NotificationMgr sInstance; |
| 89 | |
| 90 | private PhoneGlobals mApp; |
| 91 | private Phone mPhone; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 92 | |
| 93 | private Context mContext; |
| 94 | private NotificationManager mNotificationManager; |
| 95 | private StatusBarManager mStatusBarManager; |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 96 | private UserManager mUserManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 97 | private Toast mToast; |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 98 | private SubscriptionManager mSubscriptionManager; |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 99 | private TelecomManager mTelecomManager; |
| 100 | private TelephonyManager mTelephonyManager; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 101 | |
| 102 | public StatusBarHelper statusBarHelper; |
| 103 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 104 | // used to track the notification of selected network unavailable |
| 105 | private boolean mSelectedUnavailableNotify = false; |
| 106 | |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 107 | // used to track whether the message waiting indicator is visible, per subscription id. |
| 108 | private ArrayMap<Integer, Boolean> mMwiVisible = new ArrayMap<Integer, Boolean>(); |
| 109 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 110 | /** |
| 111 | * Private constructor (this is a singleton). |
Santos Cordon | f68db2e | 2014-07-02 14:40:44 -0700 | [diff] [blame] | 112 | * @see #init(PhoneGlobals) |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 113 | */ |
| 114 | private NotificationMgr(PhoneGlobals app) { |
| 115 | mApp = app; |
| 116 | mContext = app; |
| 117 | mNotificationManager = |
| 118 | (NotificationManager) app.getSystemService(Context.NOTIFICATION_SERVICE); |
| 119 | mStatusBarManager = |
| 120 | (StatusBarManager) app.getSystemService(Context.STATUS_BAR_SERVICE); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 121 | mUserManager = (UserManager) app.getSystemService(Context.USER_SERVICE); |
Stuart Scott | dcf40a9 | 2014-12-09 10:45:01 -0800 | [diff] [blame] | 122 | mPhone = app.mCM.getDefaultPhone(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 123 | statusBarHelper = new StatusBarHelper(); |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 124 | mSubscriptionManager = SubscriptionManager.from(mContext); |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 125 | mTelecomManager = TelecomManager.from(mContext); |
| 126 | mTelephonyManager = (TelephonyManager) app.getSystemService(Context.TELEPHONY_SERVICE); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Initialize the singleton NotificationMgr instance. |
| 131 | * |
| 132 | * This is only done once, at startup, from PhoneApp.onCreate(). |
| 133 | * From then on, the NotificationMgr instance is available via the |
| 134 | * PhoneApp's public "notificationMgr" field, which is why there's no |
| 135 | * getInstance() method here. |
| 136 | */ |
| 137 | /* package */ static NotificationMgr init(PhoneGlobals app) { |
| 138 | synchronized (NotificationMgr.class) { |
| 139 | if (sInstance == null) { |
| 140 | sInstance = new NotificationMgr(app); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 141 | } else { |
| 142 | Log.wtf(LOG_TAG, "init() called multiple times! sInstance = " + sInstance); |
| 143 | } |
| 144 | return sInstance; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Helper class that's a wrapper around the framework's |
| 150 | * StatusBarManager.disable() API. |
| 151 | * |
| 152 | * This class is used to control features like: |
| 153 | * |
| 154 | * - Disabling the status bar "notification windowshade" |
| 155 | * while the in-call UI is up |
| 156 | * |
| 157 | * - Disabling notification alerts (audible or vibrating) |
| 158 | * while a phone call is active |
| 159 | * |
| 160 | * - Disabling navigation via the system bar (the "soft buttons" at |
| 161 | * the bottom of the screen on devices with no hard buttons) |
| 162 | * |
| 163 | * We control these features through a single point of control to make |
| 164 | * sure that the various StatusBarManager.disable() calls don't |
| 165 | * interfere with each other. |
| 166 | */ |
| 167 | public class StatusBarHelper { |
| 168 | // Current desired state of status bar / system bar behavior |
| 169 | private boolean mIsNotificationEnabled = true; |
| 170 | private boolean mIsExpandedViewEnabled = true; |
| 171 | private boolean mIsSystemBarNavigationEnabled = true; |
| 172 | |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 173 | private StatusBarHelper() { |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Enables or disables auditory / vibrational alerts. |
| 178 | * |
| 179 | * (We disable these any time a voice call is active, regardless |
| 180 | * of whether or not the in-call UI is visible.) |
| 181 | */ |
| 182 | public void enableNotificationAlerts(boolean enable) { |
| 183 | if (mIsNotificationEnabled != enable) { |
| 184 | mIsNotificationEnabled = enable; |
| 185 | updateStatusBar(); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Enables or disables the expanded view of the status bar |
| 191 | * (i.e. the ability to pull down the "notification windowshade"). |
| 192 | * |
| 193 | * (This feature is disabled by the InCallScreen while the in-call |
| 194 | * UI is active.) |
| 195 | */ |
| 196 | public void enableExpandedView(boolean enable) { |
| 197 | if (mIsExpandedViewEnabled != enable) { |
| 198 | mIsExpandedViewEnabled = enable; |
| 199 | updateStatusBar(); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Enables or disables the navigation via the system bar (the |
| 205 | * "soft buttons" at the bottom of the screen) |
| 206 | * |
| 207 | * (This feature is disabled while an incoming call is ringing, |
| 208 | * because it's easy to accidentally touch the system bar while |
| 209 | * pulling the phone out of your pocket.) |
| 210 | */ |
| 211 | public void enableSystemBarNavigation(boolean enable) { |
| 212 | if (mIsSystemBarNavigationEnabled != enable) { |
| 213 | mIsSystemBarNavigationEnabled = enable; |
| 214 | updateStatusBar(); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Updates the status bar to reflect the current desired state. |
| 220 | */ |
| 221 | private void updateStatusBar() { |
| 222 | int state = StatusBarManager.DISABLE_NONE; |
| 223 | |
| 224 | if (!mIsExpandedViewEnabled) { |
| 225 | state |= StatusBarManager.DISABLE_EXPAND; |
| 226 | } |
| 227 | if (!mIsNotificationEnabled) { |
| 228 | state |= StatusBarManager.DISABLE_NOTIFICATION_ALERTS; |
| 229 | } |
| 230 | if (!mIsSystemBarNavigationEnabled) { |
| 231 | // Disable *all* possible navigation via the system bar. |
| 232 | state |= StatusBarManager.DISABLE_HOME; |
| 233 | state |= StatusBarManager.DISABLE_RECENT; |
| 234 | state |= StatusBarManager.DISABLE_BACK; |
Christine Chen | b685f17 | 2013-09-25 18:32:59 -0700 | [diff] [blame] | 235 | state |= StatusBarManager.DISABLE_SEARCH; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | if (DBG) log("updateStatusBar: state = 0x" + Integer.toHexString(state)); |
| 239 | mStatusBarManager.disable(state); |
| 240 | } |
| 241 | } |
| 242 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 243 | /** The projection to use when querying the phones table */ |
| 244 | static final String[] PHONES_PROJECTION = new String[] { |
| 245 | PhoneLookup.NUMBER, |
| 246 | PhoneLookup.DISPLAY_NAME, |
| 247 | PhoneLookup._ID |
| 248 | }; |
| 249 | |
| 250 | /** |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 251 | * Re-creates the message waiting indicator (voicemail) notification if it is showing. Used to |
| 252 | * refresh the voicemail intent on the indicator when the user changes it via the voicemail |
| 253 | * settings screen. The voicemail notification sound is suppressed. |
| 254 | * |
| 255 | * @param subId The subscription Id. |
| 256 | */ |
| 257 | /* package */ void refreshMwi(int subId) { |
| 258 | // In a single-sim device, subId can be -1 which means "no sub id". In this case we will |
| 259 | // reference the single subid stored in the mMwiVisible map. |
| 260 | if (subId == SubscriptionInfoHelper.NO_SUB_ID) { |
| 261 | if (mMwiVisible.keySet().size() == 1) { |
| 262 | Set<Integer> keySet = mMwiVisible.keySet(); |
| 263 | Iterator<Integer> keyIt = keySet.iterator(); |
| 264 | if (!keyIt.hasNext()) { |
| 265 | return; |
| 266 | } |
| 267 | subId = keyIt.next(); |
| 268 | } |
| 269 | } |
| 270 | if (mMwiVisible.containsKey(subId)) { |
| 271 | boolean mwiVisible = mMwiVisible.get(subId); |
| 272 | if (mwiVisible) { |
| 273 | updateMwi(subId, mwiVisible, false /* enableNotificationSound */); |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /** |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 279 | * Updates the message waiting indicator (voicemail) notification. |
| 280 | * |
| 281 | * @param visible true if there are messages waiting |
| 282 | */ |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 283 | /* package */ void updateMwi(int subId, boolean visible) { |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 284 | updateMwi(subId, visible, true /* enableNotificationSound */); |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Updates the message waiting indicator (voicemail) notification. |
| 289 | * |
| 290 | * @param subId the subId to update. |
| 291 | * @param visible true if there are messages waiting |
| 292 | * @param enableNotificationSound {@code true} if the notification sound should be played. |
| 293 | */ |
| 294 | void updateMwi(int subId, boolean visible, boolean enableNotificationSound) { |
Andrew Lee | a82b820 | 2014-11-21 16:18:28 -0800 | [diff] [blame] | 295 | if (!PhoneGlobals.sVoiceCapable) { |
| 296 | // Do not show the message waiting indicator on devices which are not voice capable. |
| 297 | // These events *should* be blocked at the telephony layer for such devices. |
| 298 | Log.w(LOG_TAG, "Called updateMwi() on non-voice-capable device! Ignoring..."); |
| 299 | return; |
| 300 | } |
| 301 | |
Yorke Lee | 67a62a2 | 2014-12-15 18:46:17 -0800 | [diff] [blame] | 302 | Log.i(LOG_TAG, "updateMwi(): subId " + subId + " update to " + visible); |
Andrew Lee | f8ad78f | 2014-12-15 16:17:29 -0800 | [diff] [blame] | 303 | mMwiVisible.put(subId, visible); |
| 304 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 305 | if (visible) { |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 306 | Phone phone = PhoneGlobals.getPhone(subId); |
| 307 | if (phone == null) { |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 308 | Log.w(LOG_TAG, "Found null phone for: " + subId); |
| 309 | return; |
| 310 | } |
| 311 | |
| 312 | SubscriptionInfo subInfo = mSubscriptionManager.getActiveSubscriptionInfo(subId); |
| 313 | if (subInfo == null) { |
| 314 | Log.w(LOG_TAG, "Found null subscription info for: " + subId); |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 315 | return; |
| 316 | } |
| 317 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 318 | int resId = android.R.drawable.stat_notify_voicemail; |
| 319 | |
| 320 | // This Notification can get a lot fancier once we have more |
| 321 | // information about the current voicemail messages. |
| 322 | // (For example, the current voicemail system can't tell |
| 323 | // us the caller-id or timestamp of a message, or tell us the |
| 324 | // message count.) |
| 325 | |
| 326 | // But for now, the UI is ultra-simple: if the MWI indication |
| 327 | // is supposed to be visible, just show a single generic |
| 328 | // notification. |
| 329 | |
| 330 | String notificationTitle = mContext.getString(R.string.notification_voicemail_title); |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 331 | String vmNumber = phone.getVoiceMailNumber(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 332 | if (DBG) log("- got vm number: '" + vmNumber + "'"); |
| 333 | |
Andrew Lee | a82b820 | 2014-11-21 16:18:28 -0800 | [diff] [blame] | 334 | // The voicemail number may be null because: |
| 335 | // (1) This phone has no voicemail number. |
| 336 | // (2) This phone has a voicemail number, but the SIM isn't ready yet. This may |
| 337 | // happen when the device first boots if we get a MWI notification when we |
| 338 | // register on the network before the SIM has loaded. In this case, the |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 339 | // SubscriptionListener in CallNotifier will update this once the SIM is loaded. |
| 340 | if ((vmNumber == null) && !phone.getIccRecordsLoaded()) { |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 341 | if (DBG) log("- Null vm number: SIM records not loaded (yet)..."); |
Andrew Lee | a82b820 | 2014-11-21 16:18:28 -0800 | [diff] [blame] | 342 | return; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 343 | } |
| 344 | |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 345 | if (TelephonyCapabilities.supportsVoiceMessageCount(phone)) { |
| 346 | int vmCount = phone.getVoiceMessageCount(); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 347 | String titleFormat = mContext.getString(R.string.notification_voicemail_title_count); |
| 348 | notificationTitle = String.format(titleFormat, vmCount); |
| 349 | } |
| 350 | |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 351 | // This pathway only applies to PSTN accounts; only SIMS have subscription ids. |
| 352 | PhoneAccountHandle phoneAccountHandle = PhoneUtils.makePstnPhoneAccountHandle(phone); |
| 353 | |
| 354 | Intent intent; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 355 | String notificationText; |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 356 | if (TextUtils.isEmpty(vmNumber)) { |
| 357 | notificationText = mContext.getString( |
| 358 | R.string.notification_voicemail_no_vm_number); |
| 359 | |
| 360 | // If the voicemail number if unknown, instead of calling voicemail, take the user |
| 361 | // to the voicemail settings. |
| 362 | notificationText = mContext.getString( |
| 363 | R.string.notification_voicemail_no_vm_number); |
Andrew Lee | bf07f76 | 2015-04-07 19:05:50 -0700 | [diff] [blame] | 364 | intent = new Intent(VoicemailSettingsActivity.ACTION_ADD_VOICEMAIL); |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 365 | intent.putExtra(SubscriptionInfoHelper.SUB_ID_EXTRA, subId); |
Andrew Lee | bf07f76 | 2015-04-07 19:05:50 -0700 | [diff] [blame] | 366 | intent.setClass(mContext, VoicemailSettingsActivity.class); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 367 | } else { |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 368 | if (mTelephonyManager.getPhoneCount() > 1) { |
| 369 | notificationText = subInfo.getDisplayName().toString(); |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 370 | } else { |
| 371 | notificationText = String.format( |
| 372 | mContext.getString(R.string.notification_voicemail_text_format), |
| 373 | PhoneNumberUtils.formatNumber(vmNumber)); |
| 374 | } |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 375 | intent = new Intent( |
| 376 | Intent.ACTION_CALL, Uri.fromParts(PhoneAccount.SCHEME_VOICEMAIL, "", |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 377 | null)); |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 378 | intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 379 | } |
| 380 | |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 381 | PendingIntent pendingIntent = |
| 382 | PendingIntent.getActivity(mContext, subId /* requestCode */, intent, 0); |
Tyler Gunn | 9c1071f | 2014-12-09 10:07:54 -0800 | [diff] [blame] | 383 | Uri ringtoneUri = null; |
| 384 | |
| 385 | if (enableNotificationSound) { |
| 386 | ringtoneUri = VoicemailNotificationSettingsUtil.getRingtoneUri(mPhone); |
| 387 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 388 | |
Nancy Chen | b4a9270 | 2014-12-04 15:57:29 -0800 | [diff] [blame] | 389 | Resources res = mContext.getResources(); |
Jonathan Basseri | c31f1f3 | 2015-05-12 10:13:03 -0700 | [diff] [blame] | 390 | PersistableBundle carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId( |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 391 | mPhone.getSubId()); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 392 | Notification.Builder builder = new Notification.Builder(mContext); |
| 393 | builder.setSmallIcon(resId) |
| 394 | .setWhen(System.currentTimeMillis()) |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 395 | .setColor(subInfo.getIconTint()) |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 396 | .setContentTitle(notificationTitle) |
| 397 | .setContentText(notificationText) |
| 398 | .setContentIntent(pendingIntent) |
Yorke Lee | acb5f74 | 2014-08-19 09:08:42 -0700 | [diff] [blame] | 399 | .setSound(ringtoneUri) |
Nancy Chen | b4a9270 | 2014-12-04 15:57:29 -0800 | [diff] [blame] | 400 | .setColor(res.getColor(R.color.dialer_theme_color)) |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 401 | .setOngoing(carrierConfig.getBoolean( |
| 402 | CarrierConfigManager.BOOL_VOICEMAIL_NOTIFICATION_PERSISTENT)); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 403 | |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 404 | if (VoicemailNotificationSettingsUtil.isVibrationEnabled(phone)) { |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 405 | builder.setDefaults(Notification.DEFAULT_VIBRATE); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 406 | } |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 407 | |
| 408 | final Notification notification = builder.build(); |
| 409 | List<UserInfo> users = mUserManager.getUsers(true); |
| 410 | for (int i = 0; i < users.size(); i++) { |
Yorke Lee | 047b1f9 | 2014-10-24 10:22:41 -0700 | [diff] [blame] | 411 | final UserInfo user = users.get(i); |
| 412 | final UserHandle userHandle = user.getUserHandle(); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 413 | if (!mUserManager.hasUserRestriction( |
Yorke Lee | 047b1f9 | 2014-10-24 10:22:41 -0700 | [diff] [blame] | 414 | UserManager.DISALLOW_OUTGOING_CALLS, userHandle) |
Jonathan Basseri | 3649bdb | 2015-04-30 22:39:11 -0700 | [diff] [blame] | 415 | && !user.isManagedProfile()) { |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 416 | mNotificationManager.notifyAsUser( |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 417 | Integer.toString(subId) /* tag */, |
| 418 | VOICEMAIL_NOTIFICATION, |
| 419 | notification, |
| 420 | userHandle); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 421 | } |
| 422 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 423 | } else { |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 424 | mNotificationManager.cancelAsUser( |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 425 | Integer.toString(subId) /* tag */, |
| 426 | VOICEMAIL_NOTIFICATION, |
| 427 | UserHandle.ALL); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 428 | } |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * Updates the message call forwarding indicator notification. |
| 433 | * |
| 434 | * @param visible true if there are messages waiting |
| 435 | */ |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 436 | /* package */ void updateCfi(int subId, boolean visible) { |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 437 | if (DBG) log("updateCfi(): " + visible); |
| 438 | if (visible) { |
| 439 | // If Unconditional Call Forwarding (forward all calls) for VOICE |
| 440 | // is enabled, just show a notification. We'll default to expanded |
| 441 | // view for now, so the there is less confusion about the icon. If |
| 442 | // it is deemed too weird to have CF indications as expanded views, |
| 443 | // then we'll flip the flag back. |
| 444 | |
| 445 | // TODO: We may want to take a look to see if the notification can |
| 446 | // display the target to forward calls to. This will require some |
| 447 | // effort though, since there are multiple layers of messages that |
| 448 | // will need to propagate that information. |
| 449 | |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 450 | SubscriptionInfo subInfo = mSubscriptionManager.getActiveSubscriptionInfo(subId); |
| 451 | if (subInfo == null) { |
| 452 | Log.w(LOG_TAG, "Found null subscription info for: " + subId); |
| 453 | return; |
| 454 | } |
| 455 | |
| 456 | String notificationTitle; |
| 457 | if (mTelephonyManager.getPhoneCount() > 1) { |
| 458 | notificationTitle = subInfo.getDisplayName().toString(); |
| 459 | } else { |
| 460 | notificationTitle = mContext.getString(R.string.labelCF); |
| 461 | } |
| 462 | |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 463 | Notification.Builder builder = new Notification.Builder(mContext) |
| 464 | .setSmallIcon(R.drawable.stat_sys_phone_call_forward) |
Andrew Lee | d5165b0 | 2014-12-05 15:53:58 -0800 | [diff] [blame] | 465 | .setColor(subInfo.getIconTint()) |
| 466 | .setContentTitle(notificationTitle) |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 467 | .setContentText(mContext.getString(R.string.sum_cfu_enabled_indicator)) |
| 468 | .setShowWhen(false) |
| 469 | .setOngoing(true); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 470 | |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 471 | Intent intent = new Intent(Intent.ACTION_MAIN); |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 472 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 473 | intent.setClassName("com.android.phone", "com.android.phone.CallFeaturesSetting"); |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 474 | SubscriptionInfoHelper.addExtrasToIntent( |
| 475 | intent, mSubscriptionManager.getActiveSubscriptionInfo(subId)); |
| 476 | PendingIntent contentIntent = |
| 477 | PendingIntent.getActivity(mContext, subId /* requestCode */, intent, 0); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 478 | |
| 479 | List<UserInfo> users = mUserManager.getUsers(true); |
| 480 | for (int i = 0; i < users.size(); i++) { |
Yorke Lee | 3faa594 | 2014-11-05 16:50:04 -0800 | [diff] [blame] | 481 | final UserInfo user = users.get(i); |
| 482 | if (user.isManagedProfile()) { |
| 483 | continue; |
| 484 | } |
| 485 | UserHandle userHandle = user.getUserHandle(); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 486 | builder.setContentIntent(userHandle.isOwner() ? contentIntent : null); |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 487 | mNotificationManager.notifyAsUser( |
| 488 | Integer.toString(subId) /* tag */, |
| 489 | CALL_FORWARD_NOTIFICATION, |
| 490 | builder.build(), |
| 491 | userHandle); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 492 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 493 | } else { |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 494 | mNotificationManager.cancelAsUser( |
Andrew Lee | 2fcb6c3 | 2014-12-04 14:52:35 -0800 | [diff] [blame] | 495 | Integer.toString(subId) /* tag */, |
| 496 | CALL_FORWARD_NOTIFICATION, |
| 497 | UserHandle.ALL); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 498 | } |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * Shows the "data disconnected due to roaming" notification, which |
| 503 | * appears when you lose data connectivity because you're roaming and |
| 504 | * you have the "data roaming" feature turned off. |
| 505 | */ |
| 506 | /* package */ void showDataDisconnectedRoaming() { |
| 507 | if (DBG) log("showDataDisconnectedRoaming()..."); |
| 508 | |
| 509 | // "Mobile network settings" screen / dialog |
| 510 | Intent intent = new Intent(mContext, com.android.phone.MobileNetworkSettings.class); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 511 | PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 512 | |
| 513 | final CharSequence contentText = mContext.getText(R.string.roaming_reenable_message); |
| 514 | |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 515 | final Notification.Builder builder = new Notification.Builder(mContext) |
| 516 | .setSmallIcon(android.R.drawable.stat_sys_warning) |
| 517 | .setContentTitle(mContext.getText(R.string.roaming)) |
| 518 | .setColor(mContext.getResources().getColor(R.color.dialer_theme_color)) |
| 519 | .setContentText(contentText); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 520 | |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 521 | List<UserInfo> users = mUserManager.getUsers(true); |
| 522 | for (int i = 0; i < users.size(); i++) { |
Yorke Lee | 3faa594 | 2014-11-05 16:50:04 -0800 | [diff] [blame] | 523 | final UserInfo user = users.get(i); |
| 524 | if (user.isManagedProfile()) { |
| 525 | continue; |
| 526 | } |
| 527 | UserHandle userHandle = user.getUserHandle(); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 528 | builder.setContentIntent(userHandle.isOwner() ? contentIntent : null); |
| 529 | final Notification notif = |
| 530 | new Notification.BigTextStyle(builder).bigText(contentText).build(); |
| 531 | mNotificationManager.notifyAsUser( |
| 532 | null /* tag */, DATA_DISCONNECTED_ROAMING_NOTIFICATION, notif, userHandle); |
| 533 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | /** |
| 537 | * Turns off the "data disconnected due to roaming" notification. |
| 538 | */ |
| 539 | /* package */ void hideDataDisconnectedRoaming() { |
| 540 | if (DBG) log("hideDataDisconnectedRoaming()..."); |
| 541 | mNotificationManager.cancel(DATA_DISCONNECTED_ROAMING_NOTIFICATION); |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * Display the network selection "no service" notification |
| 546 | * @param operator is the numeric operator number |
| 547 | */ |
| 548 | private void showNetworkSelection(String operator) { |
| 549 | if (DBG) log("showNetworkSelection(" + operator + ")..."); |
| 550 | |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 551 | Notification.Builder builder = new Notification.Builder(mContext) |
| 552 | .setSmallIcon(android.R.drawable.stat_sys_warning) |
| 553 | .setContentTitle(mContext.getString(R.string.notification_network_selection_title)) |
| 554 | .setContentText( |
| 555 | mContext.getString(R.string.notification_network_selection_text, operator)) |
| 556 | .setShowWhen(false) |
| 557 | .setOngoing(true); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 558 | |
| 559 | // create the target network operators settings intent |
| 560 | Intent intent = new Intent(Intent.ACTION_MAIN); |
| 561 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | |
| 562 | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); |
| 563 | // Use NetworkSetting to handle the selection intent |
| 564 | intent.setComponent(new ComponentName("com.android.phone", |
| 565 | "com.android.phone.NetworkSetting")); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 566 | PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 567 | |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 568 | List<UserInfo> users = mUserManager.getUsers(true); |
| 569 | for (int i = 0; i < users.size(); i++) { |
Yorke Lee | 3faa594 | 2014-11-05 16:50:04 -0800 | [diff] [blame] | 570 | final UserInfo user = users.get(i); |
| 571 | if (user.isManagedProfile()) { |
| 572 | continue; |
| 573 | } |
| 574 | UserHandle userHandle = user.getUserHandle(); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 575 | builder.setContentIntent(userHandle.isOwner() ? contentIntent : null); |
| 576 | mNotificationManager.notifyAsUser( |
| 577 | null /* tag */, |
| 578 | SELECTED_OPERATOR_FAIL_NOTIFICATION, |
| 579 | builder.build(), |
| 580 | userHandle); |
| 581 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | /** |
| 585 | * Turn off the network selection "no service" notification |
| 586 | */ |
| 587 | private void cancelNetworkSelection() { |
| 588 | if (DBG) log("cancelNetworkSelection()..."); |
Andrew Lee | 99d0ac2 | 2014-10-10 13:18:04 -0700 | [diff] [blame] | 589 | mNotificationManager.cancelAsUser( |
| 590 | null /* tag */, SELECTED_OPERATOR_FAIL_NOTIFICATION, UserHandle.ALL); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 591 | } |
| 592 | |
| 593 | /** |
| 594 | * Update notification about no service of user selected operator |
| 595 | * |
| 596 | * @param serviceState Phone service state |
| 597 | */ |
| 598 | void updateNetworkSelection(int serviceState) { |
| 599 | if (TelephonyCapabilities.supportsNetworkSelection(mPhone)) { |
Amit Mahajan | a60be87 | 2015-01-15 16:05:08 -0800 | [diff] [blame] | 600 | int subId = mPhone.getSubId(); |
| 601 | if (SubscriptionManager.isValidSubscriptionId(subId)) { |
| 602 | // get the shared preference of network_selection. |
| 603 | // empty is auto mode, otherwise it is the operator alpha name |
| 604 | // in case there is no operator name, check the operator numeric |
| 605 | SharedPreferences sp = |
| 606 | PreferenceManager.getDefaultSharedPreferences(mContext); |
| 607 | String networkSelection = |
| 608 | sp.getString(PhoneBase.NETWORK_SELECTION_NAME_KEY + subId, ""); |
| 609 | if (TextUtils.isEmpty(networkSelection)) { |
| 610 | networkSelection = |
| 611 | sp.getString(PhoneBase.NETWORK_SELECTION_KEY + subId, ""); |
| 612 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 613 | |
Amit Mahajan | a60be87 | 2015-01-15 16:05:08 -0800 | [diff] [blame] | 614 | if (DBG) log("updateNetworkSelection()..." + "state = " + |
| 615 | serviceState + " new network " + networkSelection); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 616 | |
Amit Mahajan | a60be87 | 2015-01-15 16:05:08 -0800 | [diff] [blame] | 617 | if (serviceState == ServiceState.STATE_OUT_OF_SERVICE |
| 618 | && !TextUtils.isEmpty(networkSelection)) { |
| 619 | if (!mSelectedUnavailableNotify) { |
| 620 | showNetworkSelection(networkSelection); |
| 621 | mSelectedUnavailableNotify = true; |
| 622 | } |
| 623 | } else { |
| 624 | if (mSelectedUnavailableNotify) { |
| 625 | cancelNetworkSelection(); |
| 626 | mSelectedUnavailableNotify = false; |
| 627 | } |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 628 | } |
| 629 | } else { |
Amit Mahajan | a60be87 | 2015-01-15 16:05:08 -0800 | [diff] [blame] | 630 | if (DBG) log("updateNetworkSelection()..." + "state = " + |
| 631 | serviceState + " not updating network due to invalid subId " + subId); |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 632 | } |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | /* package */ void postTransientNotification(int notifyId, CharSequence msg) { |
| 637 | if (mToast != null) { |
| 638 | mToast.cancel(); |
| 639 | } |
| 640 | |
| 641 | mToast = Toast.makeText(mContext, msg, Toast.LENGTH_LONG); |
| 642 | mToast.show(); |
| 643 | } |
| 644 | |
| 645 | private void log(String msg) { |
| 646 | Log.d(LOG_TAG, msg); |
| 647 | } |
| 648 | } |