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
diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java
index ba9e350..382118f 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.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 @@
@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 @@
}
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) {