Reset voicemail status to disabled for not supported phone accounts
In some cases a phone account might have already written to the status
table, but the feature is later removed through changes in
CarrierConfig. Previously the VVM client will just stop handling the
account and the status will be stuck in the table. Sometimes it would
leave a error that which will be shown to the user forever.
After this CL, if the phone account has no VVM support, the status
table entry will be reset to the disabled state, which will make the
UI ignore the account.
Bug: 30314643
Change-Id: I0b67decd62d021de90d7d0ff0f5209e7f3e624ee
diff --git a/src/com/android/phone/VoicemailStatus.java b/src/com/android/phone/VoicemailStatus.java
index 2d8bcc3..c5cd52c 100644
--- a/src/com/android/phone/VoicemailStatus.java
+++ b/src/com/android/phone/VoicemailStatus.java
@@ -120,6 +120,18 @@
return new Editor(context, PhoneAccountHandleConverter.fromSubId(subId));
}
+ /**
+ * Reset the status to the "disabled" state, which the UI should not show anything for this
+ * subId.
+ */
+ public static void disable(Context context, int subId) {
+ edit(context, subId)
+ .setConfigurationState(Status.CONFIGURATION_STATE_NOT_CONFIGURED)
+ .setDataChannelState(Status.DATA_CHANNEL_STATE_NO_CONNECTION)
+ .setNotificationChannelState(Status.NOTIFICATION_CHANNEL_STATE_NO_CONNECTION)
+ .apply();
+ }
+
public static DeferredEditor deferredEdit(Context context, int subId) {
return new DeferredEditor(context, PhoneAccountHandleConverter.fromSubId(subId));
}