From 1210f41f59a131b50e4d54f308e7d1acbe76cbea Mon Sep 17 00:00:00 2001 From: Ta-wei Yen Date: Mon, 17 Apr 2017 15:41:51 -0700 Subject: [PATCH] Add getVisualVoicemailSettings() The voicemail client in telephony is moved to the system dialer in O. Some user data such as the enabled status of VVM or the voicemail PIN scrambled by the client need to be migrated to the system dialer for it to function seamlessly. This CL adds getVisualVoicemailSettings() to let the system dialer retrieve a opaque bundle to migrate the user data. The system dialer and telephony service should agreed upon the structure and content of the bundle. Bug: 34093562 Test: N/A - pending dialer side changes to be implemented. Change-Id: Ib7da801ada95451e55e02eda520894aa41316f73 --- api/system-current.txt | 3 ++ .../android/telephony/TelephonyManager.java | 51 +++++++++++++++++++ .../internal/telephony/ITelephony.aidl | 2 + 3 files changed, 56 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index a10806b359814..99b5223c29738 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -43742,6 +43742,7 @@ package android.telephony { method public java.lang.String getSubscriberId(); method public java.util.List getTelephonyHistograms(); method public java.lang.String getVisualVoicemailPackageName(); + method public android.os.Bundle getVisualVoicemailSettings(); method public java.lang.String getVoiceMailAlphaTag(); method public java.lang.String getVoiceMailNumber(); method public int getVoiceNetworkType(); @@ -43833,7 +43834,9 @@ package android.telephony { field public static final java.lang.String EXTRA_STATE_IDLE; field public static final java.lang.String EXTRA_STATE_OFFHOOK; field public static final java.lang.String EXTRA_STATE_RINGING; + field public static final java.lang.String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL"; field public static final java.lang.String EXTRA_VOICEMAIL_NUMBER = "android.telephony.extra.VOICEMAIL_NUMBER"; + field public static final java.lang.String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING"; field public static final java.lang.String METADATA_HIDE_VOICEMAIL_SETTINGS_MENU = "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU"; field public static final int NETWORK_TYPE_1xRTT = 7; // 0x7 field public static final int NETWORK_TYPE_CDMA = 4; // 0x4 diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 397aa0020d133..f12beaab33239 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -876,6 +876,30 @@ public class TelephonyManager { */ public static final String VVM_TYPE_CVVM = "vvm_type_cvvm"; + /** + * Key in bundle returned by {@link #getVisualVoicemailPackageName()}, indicating whether visual + * voicemail was enabled or disabled by the user. If the user never explicitly changed this + * setting, this key will not exist. + * + * @see #getVisualVoicemailSettings() + * @hide + */ + @SystemApi + public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = + "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL"; + + /** + * Key in bundle returned by {@link #getVisualVoicemailPackageName()}, indicating the voicemail + * access PIN scrambled during the auto provisioning process. The user is expected to reset + * their PIN if this value is not {@code null}. + * + * @see #getVisualVoicemailSettings() + * @hide + */ + @SystemApi + public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = + "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING"; + /** * @hide */ @@ -2735,6 +2759,33 @@ public class TelephonyManager { return false; } + /** + * Returns an opaque bundle of settings formerly used by the visual voicemail client for the + * subscription ID pinned to the TelephonyManager, or {@code null} if the subscription ID is + * invalid. This method allows the system dialer to migrate settings out of the pre-O visual + * voicemail client in telephony. + * + *

Requires the caller to be the system dialer. + * + * @see #KEY_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL + * @see #KEY_VOICEMAIL_SCRAMBLED_PIN_STRING + * + * @hide + */ + @SystemApi + @Nullable + public Bundle getVisualVoicemailSettings(){ + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony + .getVisualVoicemailSettings(mContext.getOpPackageName(), mSubId); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; + } /** * Returns the package responsible of processing visual voicemail for the subscription ID pinned diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index dd08f67c9617a..da333aee61684 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -498,6 +498,8 @@ interface ITelephony { */ boolean isConcurrentVoiceAndDataAllowed(int subId); + Bundle getVisualVoicemailSettings(String callingPackage, int subId); + String getVisualVoicemailPackageName(String callingPackage, int subId); // Not oneway, caller needs to make sure the vaule is set before receiving a SMS