Add API to enable/disable the visual voicemail client
This CL gives the default dialer, apps with carrier privilege, and apps with MODIFY_PHONE_STATE the ability to enable/disable the visual voicemail client. This is a system API for NMR1. It will be revised in O. Bug: 30709089 Change-Id: Ic24af14a5e3433c13ba8d253ad8504c94bf71c8f
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user