summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/voicemail
diff options
context:
space:
mode:
authormdooley <mdooley@google.com>2017-09-28 16:48:08 -0700
committerEric Erfanian <erfanian@google.com>2017-10-02 16:12:32 -0700
commitcb097482c41778c446f66690c10ce06f17463358 (patch)
tree082da9fb098a96aac9665310bc7aea9cc9301e14 /java/com/android/dialer/app/voicemail
parent6038c5d6d86087bed87a9475d5f7814195139b27 (diff)
Check for valid phone account before displaying voicemail TOS
Project Fi devices crash when declining voicemail TOS because of an invalid PhoneAccountHandle. This cl fixes the problem by not showing the TOS when the PhoneAccountHandle is not valid. Bug: 67001886,66969838 Test: manual and updated unit tests PiperOrigin-RevId: 170418189 Change-Id: I36dd0b10ab7468b0937a81f3f0427a4d64091955
Diffstat (limited to 'java/com/android/dialer/app/voicemail')
-rw-r--r--java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java25
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);