Fix NPE when trying to clear MWI for invalid subId
VvmPhoneStateListener can be trigger with a when the PhoneAccountHanlde
no longer has a valid subId. why this can happen still needs
investigation.
This CL changed VvmPhoneStateListener to ignore invalid subIds, and
guard PhoneGlobals.clearMwiIndicator against null phone.
Bug: 30315483
Change-Id: I3d062991d8af63aaf0ebc76b3961a335dace3192
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);
+ }
}
}