Cleanup. Changing voicemail_transcription_enabled to voicemail_transcription_available
Follow the convention that features allowed by server configuration flags use the
word 'available' and when a feature is allowed by the user via settings then use the
word 'enabled'
Bug: 37340510
Test: manual and updated unit tests
PiperOrigin-RevId: 178831467
Change-Id: I5691fd7db45a70908d32cdac2b049fe76e6a0680
diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java
index 2787320..a714b6d 100644
--- a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java
+++ b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java
@@ -187,7 +187,7 @@
return true;
}
- if (isVoicemailTranscriptionEnabled() && !isLegacyVoicemailUser()) {
+ if (isVoicemailTranscriptionAvailable() && !isLegacyVoicemailUser()) {
LogUtil.i(
"VoicemailTosMessageCreator.shouldShowTos", "showing TOS for Google transcription users");
return true;
@@ -203,7 +203,7 @@
return false;
}
- if (isVoicemailTranscriptionEnabled()) {
+ if (isVoicemailTranscriptionAvailable()) {
LogUtil.i(
"VoicemailTosMessageCreator.shouldShowPromo",
"showing promo for Google transcription users");
@@ -227,9 +227,10 @@
}
}
- private boolean isVoicemailTranscriptionEnabled() {
+ private boolean isVoicemailTranscriptionAvailable() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
- && ConfigProviderBindings.get(context).getBoolean("voicemail_transcription_enabled", false);
+ && ConfigProviderBindings.get(context)
+ .getBoolean("voicemail_transcription_available", false);
}
private void showDeclineTosDialog(final PhoneAccountHandle handle) {
@@ -407,7 +408,7 @@
}
private CharSequence getNewUserDialerTos() {
- if (!isVoicemailTranscriptionEnabled()) {
+ if (!isVoicemailTranscriptionAvailable()) {
return "";
}
@@ -416,7 +417,7 @@
}
private CharSequence getExistingUserDialerTos() {
- if (!isVoicemailTranscriptionEnabled()) {
+ if (!isVoicemailTranscriptionAvailable()) {
return "";
}
diff --git a/java/com/android/voicemail/impl/VoicemailClientImpl.java b/java/com/android/voicemail/impl/VoicemailClientImpl.java
index 60fc806..75d6dfc 100644
--- a/java/com/android/voicemail/impl/VoicemailClientImpl.java
+++ b/java/com/android/voicemail/impl/VoicemailClientImpl.java
@@ -130,7 +130,7 @@
}
TranscriptionConfigProvider provider = new TranscriptionConfigProvider(context);
- if (!provider.isVoicemailTranscriptionEnabled()) {
+ if (!provider.isVoicemailTranscriptionAvailable()) {
LogUtil.i(
"VoicemailClientImpl.isVoicemailTranscriptionAvailable", "feature disabled by config");
return false;
diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java
index 3d1755b..54a1ae4 100644
--- a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java
+++ b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java
@@ -28,9 +28,10 @@
this.context = context;
}
- public boolean isVoicemailTranscriptionEnabled() {
+ public boolean isVoicemailTranscriptionAvailable() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
- && ConfigProviderBindings.get(context).getBoolean("voicemail_transcription_enabled", false);
+ && ConfigProviderBindings.get(context)
+ .getBoolean("voicemail_transcription_available", false);
}
public String getServerAddress() {
diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionService.java b/java/com/android/voicemail/impl/transcribe/TranscriptionService.java
index a19ab62..0f53003 100644
--- a/java/com/android/voicemail/impl/transcribe/TranscriptionService.java
+++ b/java/com/android/voicemail/impl/transcribe/TranscriptionService.java
@@ -142,8 +142,8 @@
public boolean onStartJob(JobParameters params) {
Assert.isMainThread();
LogUtil.enterBlock("TranscriptionService.onStartJob");
- if (!getConfigProvider().isVoicemailTranscriptionEnabled()) {
- LogUtil.i("TranscriptionService.onStartJob", "transcription not enabled, exiting.");
+ if (!getConfigProvider().isVoicemailTranscriptionAvailable()) {
+ LogUtil.i("TranscriptionService.onStartJob", "transcription not available, exiting.");
return false;
} else if (TextUtils.isEmpty(getConfigProvider().getServerAddress())) {
LogUtil.i("TranscriptionService.onStartJob", "transcription server not configured, exiting.");