diff options
| -rw-r--r-- | api/system-current.txt | 2 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 50 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 6 |
3 files changed, 58 insertions, 0 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 4f512a08816d..9d045b3a5829 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -40540,6 +40540,7 @@ package android.telephony { method public boolean isSmsCapable(); method public boolean isTtyModeSupported(); method public boolean isVideoCallingEnabled(); + method public boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle); method public boolean isVoiceCapable(); method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle); method public boolean isWorldPhone(); @@ -40553,6 +40554,7 @@ package android.telephony { method public boolean setPreferredNetworkTypeToGlobal(); method public boolean setRadio(boolean); method public boolean setRadioPower(boolean); + method public void setVisualVoicemailEnabled(android.telecom.PhoneAccountHandle, boolean); method public boolean setVoiceMailNumber(java.lang.String, java.lang.String); method public void silenceRinger(); method public boolean supplyPin(java.lang.String); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ea4ea14a43c5..759ea1d2b8ac 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -2484,6 +2484,56 @@ public class TelephonyManager { } /** + * Enables or disables the visual voicemail client for a phone account. + * + * <p>Requires that the calling app is the default dialer, or has carrier privileges, or + * has permission {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}. + * @see #hasCarrierPrivileges + * + * @param phoneAccountHandle the phone account to change the client state + * @param enabled the new state of the client + * @hide + */ + @SystemApi + public void setVisualVoicemailEnabled(PhoneAccountHandle phoneAccountHandle, boolean enabled){ + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.setVisualVoicemailEnabled(mContext.getOpPackageName(), phoneAccountHandle, + enabled); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + // This could happen before phone restarts due to crashing + } + } + + /** + * Returns whether the visual voicemail client is enabled. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * + * @param phoneAccountHandle the phone account to check for. + * @return {@code true} when the visual voicemail client is enabled for this client + * @hide + */ + @SystemApi + public boolean isVisualVoicemailEnabled(PhoneAccountHandle phoneAccountHandle){ + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.isVisualVoicemailEnabled( + mContext.getOpPackageName(), phoneAccountHandle); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + // This could happen before phone restarts due to crashing + } + return false; + } + + /** * Enables the visual voicemail SMS filter for a phone account. When the filter is * enabled, Incoming SMS messages matching the OMTP VVM SMS interface will be redirected to the * visual voicemail client with diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 7e7071ee173a..a8eaf3627013 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -454,6 +454,12 @@ interface ITelephony { */ int getVoiceMessageCountForSubscriber(int subId); + oneway void setVisualVoicemailEnabled(String callingPackage, + in PhoneAccountHandle accountHandle, boolean enabled); + + boolean isVisualVoicemailEnabled(String callingPackage, + in PhoneAccountHandle accountHandle); + // Not oneway, caller needs to make sure the vaule is set before receiving a SMS void enableVisualVoicemailSmsFilter(String callingPackage, int subId, in VisualVoicemailSmsFilterSettings settings); |