From 68cf8dc4e305d7d27bbff93dc24a02bca1b13f8c Mon Sep 17 00:00:00 2001 From: uabdullah Date: Tue, 27 Mar 2018 16:50:56 -0700 Subject: Turn on transcription when existing dialer user accepts ToS and transcription is available. Also updated the isVoicemailAvailable helper method, since just checking if the flag and OS is not enough (we have other things such as is VVM enabled, is VM activated), if we don't do this, it doesnt make sense to turn on transcription e.g Why what would happen if transcription is turned on but vvm is disabled Bug: 74033229 Test: Added a todo, will be added later (there are a few more similar CL's that I am sending for other ToS conditions) to ensure the logic is correct for all ToS conditions first and I can add a test right at the end for all conditions. PiperOrigin-RevId: 190696695 Change-Id: I9cb063a97e11943abeb1f823dc661efe88dfa3f1 --- .../voicemail/listui/error/VoicemailTosMessageCreator.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'java/com/android/dialer/voicemail') diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java index ba9e35012..382118fca 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java @@ -22,7 +22,6 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; -import android.os.Build; import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.telecom.PhoneAccountHandle; @@ -144,6 +143,12 @@ public class VoicemailTosMessageCreator { @Override public void onClick(View v) { LogUtil.i("VoicemailTosMessageCreator.getPromoMessage", "acknowledge clicked"); + if (isVoicemailTranscriptionAvailable()) { + VoicemailComponent.get(context) + .getVoicemailClient() + .setVoicemailTranscriptionEnabled( + context, status.getPhoneAccountHandle(), true); + } // Feature acknowledgement also means accepting TOS recordTosAcceptance(); recordFeatureAcknowledgement(); @@ -222,9 +227,9 @@ public class VoicemailTosMessageCreator { } private boolean isVoicemailTranscriptionAvailable() { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O - && ConfigProviderBindings.get(context) - .getBoolean("voicemail_transcription_available", false); + return VoicemailComponent.get(context) + .getVoicemailClient() + .isVoicemailTranscriptionAvailable(context, status.getPhoneAccountHandle()); } private void showDeclineTosDialog(final PhoneAccountHandle handle) { -- cgit v1.2.3