summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/VoicemailClient.java
diff options
context:
space:
mode:
authoruabdullah <uabdullah@google.com>2018-03-16 17:32:54 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-16 17:39:34 -0700
commita7530f84656f1060957b14a4c946fd02cf88f7cd (patch)
tree6131ce961e48b0c971abb8c9ef5977cbb0d588f0 /java/com/android/voicemail/VoicemailClient.java
parentfce3a793a925791b6ed22d8132db55cd6d7d3f15 (diff)
Refactor VM Settings and add support for voicemail transcription
This CL refactors the existing voicemail settings fragment and adds UI support for voicemail transcription. It mainly deals with the following: - ensuring that when the VVM toggle is turned off, transcription and donations are gone. - when transcription is off, donation preference is gone. - donation is only available when transcription is available and enabled - as part of the refactor, fixes existing logging bugs - breaks preferences and its associated methods into helper methods when possible - groups relevant preferences together when possible Bug: 74033229 Test: Unit tests PiperOrigin-RevId: 189418217 Change-Id: I3442cb5752a235cfca643ba55df3fb75171e3fe4
Diffstat (limited to 'java/com/android/voicemail/VoicemailClient.java')
-rw-r--r--java/com/android/voicemail/VoicemailClient.java42
1 files changed, 22 insertions, 20 deletions
diff --git a/java/com/android/voicemail/VoicemailClient.java b/java/com/android/voicemail/VoicemailClient.java
index 1ce7ef75a..5b382f1dc 100644
--- a/java/com/android/voicemail/VoicemailClient.java
+++ b/java/com/android/voicemail/VoicemailClient.java
@@ -30,35 +30,25 @@ import java.util.List;
public interface VoicemailClient {
/**
- * Whether the voicemail module is enabled (OS has support and not disabled by flags, etc.). This
- * does not mean the carrier has support or user has enabled the feature.
- */
- boolean isVoicemailModuleEnabled();
-
- /**
* Broadcast to tell the client to upload local database changes to the server. Since the dialer
* UI and the client are in the same package, the {@link
* android.content.Intent#ACTION_PROVIDER_CHANGED} will always be a self-change even if the UI is
* external to the client.
*/
String ACTION_UPLOAD = "com.android.voicemail.VoicemailClient.ACTION_UPLOAD";
-
/** Common key for passing {@link PhoneAccountHandle} in bundles. */
String PARAM_PHONE_ACCOUNT_HANDLE = "phone_account_handle";
-
/**
* Broadcast from the client to inform the app to show a legacy voicemail notification. This
* broadcast is same as {@link TelephonyManager#ACTION_SHOW_VOICEMAIL_NOTIFICATION}.
*/
String ACTION_SHOW_LEGACY_VOICEMAIL =
"com.android.voicemail.VoicemailClient.ACTION_SHOW_LEGACY_VOICEMAIL";
-
/**
* Boolean extra send with {@link #ACTION_SHOW_LEGACY_VOICEMAIL}, indicating that the notification
* is sent by legacy mode and should not be suppressed even when VVM is activated
*/
String EXTRA_IS_LEGACY_MODE = "is_legacy_mode";
-
/**
* Secret code to launch the voicemail config activity intended for OEMs and Carriers. {@code
* *#*#VVMCONFIG#*#*}
@@ -66,6 +56,12 @@ public interface VoicemailClient {
String VOICEMAIL_SECRET_CODE = "886266344";
/**
+ * Whether the voicemail module is enabled (OS has support and not disabled by flags, etc.). This
+ * does not mean the carrier has support or user has enabled the feature.
+ */
+ boolean isVoicemailModuleEnabled();
+
+ /**
* Whether visual voicemail is supported by the carrier for the {@code phoneAccountHandle}. This
* is purely based on the MCCMNC, and a single account might still be disabled by the carrier.
*/
@@ -123,17 +119,23 @@ public interface VoicemailClient {
/**
* @return if the voicemail transcription feature is available on the current device. This depends
- * on whether the server side flag is turned on for the feature, and if the OS meets the
- * requirement for this feature.
+ * on whether the server side flag is turned on for the feature, visual voicemail is activated
+ * and enabled and if the OS meets the requirement for this feature.
*/
- boolean isVoicemailTranscriptionAvailable(Context context);
+ boolean isVoicemailTranscriptionAvailable(Context context, PhoneAccountHandle account);
+
+ /** @return if the voicemail transcription setting has been enabled by the user. */
+ boolean isVoicemailTranscriptionEnabled(Context context, PhoneAccountHandle account);
/** @return if the voicemail donation feature is available. */
- boolean isVoicemailDonationAvailable(Context context);
+ boolean isVoicemailDonationAvailable(Context context, PhoneAccountHandle account);
/** @return if the voicemail donation setting has been enabled by the user. */
boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account);
+ void setVoicemailTranscriptionEnabled(
+ Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled);
+
void setVoicemailDonationEnabled(
Context context, PhoneAccountHandle phoneAccountHandle, boolean enabled);
@@ -162,12 +164,6 @@ public interface VoicemailClient {
@MainThread
void onShutdown(@NonNull Context context);
- /** Listener for changes in {@link #isActivated(Context, PhoneAccountHandle)} */
- interface ActivationStateListener {
- @MainThread
- void onActivationStateChanged(PhoneAccountHandle phoneAccountHandle, boolean isActivated);
- }
-
@MainThread
void addActivationStateListener(ActivationStateListener listener);
@@ -187,4 +183,10 @@ public interface VoicemailClient {
*/
@Nullable
String getCarrierConfigString(Context context, PhoneAccountHandle phoneAccountHandle, String key);
+
+ /** Listener for changes in {@link #isActivated(Context, PhoneAccountHandle)} */
+ interface ActivationStateListener {
+ @MainThread
+ void onActivationStateChanged(PhoneAccountHandle phoneAccountHandle, boolean isActivated);
+ }
}