diff options
-rw-r--r-- | java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java index f5ea95d35..a2b82c0fc 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java @@ -125,6 +125,17 @@ public class VoicemailTosMessageCreator { } private boolean shouldShowTos() { + if (!isValidVoicemailType(status.type)) { + LogUtil.i("VoicemailTosMessageCreator.shouldShowTos", "unsupported type: " + status.type); + return false; + } + + if (status.getPhoneAccountHandle() == null + || status.getPhoneAccountHandle().getComponentName() == null) { + LogUtil.i("VoicemailTosMessageCreator.shouldShowTos", "invalid phone account"); + return false; + } + if (isVvm3()) { LogUtil.i("VoicemailTosMessageCreator.shouldShowTos", "showing TOS for verizon"); return true; @@ -139,6 +150,20 @@ public class VoicemailTosMessageCreator { return false; } + private static boolean isValidVoicemailType(String type) { + if (type == null) { + return false; + } + switch (type) { + case TelephonyManager.VVM_TYPE_OMTP: + case TelephonyManager.VVM_TYPE_CVVM: + case VisualVoicemailTypeExtensions.VVM_TYPE_VVM3: + return true; + default: + return false; + } + } + private boolean isVoicemailTranscriptionEnabled() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && ConfigProviderBindings.get(context).getBoolean("voicemail_transcription_enabled", false); |