diff --git a/api/system-current.txt b/api/system-current.txt index 450df40795e30..6c5931e8a739e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -43719,6 +43719,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(); @@ -43812,7 +43813,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 1ef9e494be68a..3aeaa29b9e286 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -877,6 +877,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 */ @@ -2747,6 +2771,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