Merge "Add getVisualVoicemailSettings()" into oc-dev
diff --git a/api/system-current.txt b/api/system-current.txt
index 450df40..6c5931e 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -43719,6 +43719,7 @@
method public java.lang.String getSubscriberId();
method public java.util.List<android.telephony.TelephonyHistogram> 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 @@
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 1ef9e49..3aeaa29 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -878,6 +878,30 @@
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
*/
public static final String USSD_RESPONSE = "USSD_RESPONSE";
@@ -2747,6 +2771,33 @@
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.
+ *
+ * <p>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 dd08f67..da333ae 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -498,6 +498,8 @@
*/
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