Add API to enable/disable the visual voicemail client

am: 20f2ebbf4d

Change-Id: I4051b810ab020208001f726e4911df1905ef81bf
This commit is contained in:
Ta-wei Yen
2016-08-11 17:23:30 +00:00
committed by android-build-merger
3 changed files with 58 additions and 0 deletions

View File

@@ -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);

View File

@@ -2483,6 +2483,56 @@ public class TelephonyManager {
return false;
}
/**
* 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

View File

@@ -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);