diff options
Diffstat (limited to 'java/com/android/voicemail')
4 files changed, 26 insertions, 2 deletions
diff --git a/java/com/android/voicemail/VoicemailClient.java b/java/com/android/voicemail/VoicemailClient.java index d033369b4..050286a41 100644 --- a/java/com/android/voicemail/VoicemailClient.java +++ b/java/com/android/voicemail/VoicemailClient.java @@ -128,6 +128,9 @@ public interface VoicemailClient { */ boolean isVoicemailTranscriptionAvailable(Context context); + /** @return if the voicemail donation feature is available. */ + boolean isVoicemailDonationAvailable(Context context); + /** @return if the voicemail donation setting has been enabled by the user. */ boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account); diff --git a/java/com/android/voicemail/impl/VoicemailClientImpl.java b/java/com/android/voicemail/impl/VoicemailClientImpl.java index 14fa1d80b..2add59ec7 100644 --- a/java/com/android/voicemail/impl/VoicemailClientImpl.java +++ b/java/com/android/voicemail/impl/VoicemailClientImpl.java @@ -136,6 +136,22 @@ public class VoicemailClientImpl implements VoicemailClient { } @Override + public boolean isVoicemailDonationAvailable(Context context) { + if (!isVoicemailTranscriptionAvailable(context)) { + LogUtil.i("VoicemailClientImpl.isVoicemailDonationAvailable", "transcription not available"); + return false; + } + + TranscriptionConfigProvider provider = new TranscriptionConfigProvider(context); + if (!provider.isVoicemailDonationAvailable()) { + LogUtil.i("VoicemailClientImpl.isVoicemailDonationAvailable", "feature disabled by config"); + return false; + } + + return true; + } + + @Override public boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account) { return isVoicemailTranscriptionAvailable(context) && VisualVoicemailSettingsUtil.isVoicemailDonationEnabled(context, account); diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java index 5da450312..f4996a097 100644 --- a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java +++ b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java @@ -75,9 +75,9 @@ public class TranscriptionConfigProvider { .getLong("voicemail_transcription_get_transcript_poll_interval_millis", 1000L); } - public boolean isVoicemailDonationEnabled() { + public boolean isVoicemailDonationAvailable() { return ConfigProviderBindings.get(context) - .getBoolean("voicemail_transcription_donation_enabled", false); + .getBoolean("voicemail_transcription_donation_available", false); } @Override diff --git a/java/com/android/voicemail/stub/StubVoicemailClient.java b/java/com/android/voicemail/stub/StubVoicemailClient.java index 0fe533e62..fe063245f 100644 --- a/java/com/android/voicemail/stub/StubVoicemailClient.java +++ b/java/com/android/voicemail/stub/StubVoicemailClient.java @@ -76,6 +76,11 @@ public final class StubVoicemailClient implements VoicemailClient { } @Override + public boolean isVoicemailDonationAvailable(Context context) { + return false; + } + + @Override public boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account) { return false; } |