From 5c1a63c2235c36ce0b520fa88a9d21ffe255756e Mon Sep 17 00:00:00 2001 From: Shishir Agrawal Date: Sun, 9 Nov 2014 16:16:06 -0800 Subject: Add new API to set voicemail number. The API is protected by system or carrier privilege. Bug: 17393589 Change-Id: I33f4a00b30e0f5d72e5d53553a187d974872eab6 --- .../java/android/telephony/TelephonyManager.java | 35 ++++++++++++++++++++++ .../com/android/internal/telephony/ITelephony.aidl | 5 ++++ 2 files changed, 40 insertions(+) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b06d44c..f2d859f 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1973,6 +1973,41 @@ public class TelephonyManager { } /** + * Sets the voice mail number. + *

+ * Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * + * @param alphaTag The alpha tag to display. + * @param number The voicemail number. + */ + public boolean setVoiceMailNumber(String alphaTag, String number) { + return setVoiceMailNumber(getDefaultSubscription(), alphaTag, number); + } + + /** + * Sets the voicemail number for the given subscriber. + *

+ * Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * + * @param subId The subscriber id. + * @param alphaTag The alpha tag to display. + * @param number The voicemail number. + */ + /** {@hide} */ + public boolean setVoiceMailNumber(int subId, String alphaTag, String number) { + try { + return getITelephony().setVoiceMailNumber(subId, alphaTag, number); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return false; + } + + /** * Returns the voice mail count. Return 0 if unavailable. *

* Requires Permission: diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index c50261d..cbfa9f6 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -417,6 +417,11 @@ interface ITelephony { boolean needsOtaServiceProvisioning(); /** + * Sets the voicemail number for a particular subscriber. + */ + boolean setVoiceMailNumber(int subId, String alphaTag, String number); + + /** * Returns the unread count of voicemails */ int getVoiceMessageCount(); -- cgit v1.1