Merge "Fix NPE for tasks without a subId" into nyc-mr1-dev
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index ca25653..9ed38ae 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -171,8 +171,8 @@
* Shows notification for Emergency Callback Mode
*/
private void showNotification(long millisUntilFinished) {
- final boolean isInEcm = Boolean.parseBoolean(
- SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE));
+ Phone imsPhone = mPhone.getImsPhone();
+ boolean isInEcm = mPhone.isInEcm() || (imsPhone != null && imsPhone.isInEcm());
if (!isInEcm) {
Log.i(LOG_TAG, "Asked to show notification but not in ECM mode");
if (mTimer != null) {
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 4ff8d8e..2d87e78 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -45,7 +45,6 @@
import android.telephony.SubscriptionManager;
import android.util.Log;
import android.widget.Toast;
-
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallManager;
import com.android.internal.telephony.IccCardConstants;
@@ -850,6 +849,11 @@
public void clearMwiIndicator(int subId) {
// Setting voiceMessageCount to 0 will remove the current notification and clear the system
// cached value.
- getPhone(subId).setVoiceMessageCount(0);
+ Phone phone = getPhone(subId);
+ if (phone == null) {
+ Log.w(LOG_TAG, "clearMwiIndicator on null phone, subId:" + subId);
+ } else {
+ phone.setVoiceMessageCount(0);
+ }
}
}
diff --git a/src/com/android/phone/vvm/omtp/VvmPhoneStateListener.java b/src/com/android/phone/vvm/omtp/VvmPhoneStateListener.java
index f64d15b..94e616c 100644
--- a/src/com/android/phone/vvm/omtp/VvmPhoneStateListener.java
+++ b/src/com/android/phone/vvm/omtp/VvmPhoneStateListener.java
@@ -19,6 +19,7 @@
import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
+import android.telephony.SubscriptionManager;
import com.android.phone.PhoneGlobals;
import com.android.phone.PhoneUtils;
import com.android.phone.VoicemailStatus;
@@ -47,6 +48,13 @@
@Override
public void onServiceStateChanged(ServiceState serviceState) {
+ int subId = PhoneAccountHandleConverter.toSubId(mPhoneAccount);
+ if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+ VvmLog.e(TAG, "onServiceStateChanged on phoneAccount " + mPhoneAccount
+ + " with invalid subId, ignoring");
+ return;
+ }
+
int state = serviceState.getState();
if (state == mPreviousState || (state != ServiceState.STATE_IN_SERVICE
&& mPreviousState != ServiceState.STATE_IN_SERVICE)) {
@@ -56,7 +64,6 @@
return;
}
- int subId = PhoneAccountHandleConverter.toSubId(mPhoneAccount);
OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(mContext, subId);
if (state == ServiceState.STATE_IN_SERVICE) {