Add methods to the API to retrieve voicemail notification settings.

Since Dialer and other apps may want to retrieve the voicemail
notification settings set by Telephony, provide API methods to retrieve
these settings.

Bug:24164917
Change-Id: I9b074fa92db3acdbe85d173453731458909455b2
This commit is contained in:
Nancy Chen
2016-01-06 11:14:42 -08:00
parent 29b7dd8d69
commit 740fb3bcca
5 changed files with 69 additions and 1 deletions

View File

@@ -36036,6 +36036,7 @@ package android.telephony {
method public java.lang.String getSubscriberId();
method public java.lang.String getVoiceMailAlphaTag();
method public java.lang.String getVoiceMailNumber();
method public android.net.Uri getVoicemailRingtoneUri(android.telecom.PhoneAccountHandle);
method public boolean hasCarrierPrivileges();
method public boolean hasIccCard();
method public boolean iccCloseLogicalChannel(int);
@@ -36048,6 +36049,7 @@ package android.telephony {
method public boolean isSmsCapable();
method public boolean isTtyModeSupported();
method public boolean isVoiceCapable();
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method public void listen(android.telephony.PhoneStateListener, int);
method public java.lang.String sendEnvelopeWithStatus(java.lang.String);

View File

@@ -38343,6 +38343,7 @@ package android.telephony {
method public java.lang.String getSubscriberId();
method public java.lang.String getVoiceMailAlphaTag();
method public java.lang.String getVoiceMailNumber();
method public android.net.Uri getVoicemailRingtoneUri(android.telecom.PhoneAccountHandle);
method public boolean handlePinMmi(java.lang.String);
method public boolean handlePinMmiForSubscriber(int, java.lang.String);
method public boolean hasCarrierPrivileges();
@@ -38364,6 +38365,7 @@ package android.telephony {
method public boolean isTtyModeSupported();
method public boolean isVideoCallingEnabled();
method public boolean isVoiceCapable();
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method public void listen(android.telephony.PhoneStateListener, int);
method public boolean needsOtaServiceProvisioning();

View File

@@ -36039,6 +36039,7 @@ package android.telephony {
method public java.lang.String getSubscriberId();
method public java.lang.String getVoiceMailAlphaTag();
method public java.lang.String getVoiceMailNumber();
method public android.net.Uri getVoicemailRingtoneUri(android.telecom.PhoneAccountHandle);
method public boolean hasCarrierPrivileges();
method public boolean hasIccCard();
method public boolean iccCloseLogicalChannel(int);
@@ -36051,6 +36052,7 @@ package android.telephony {
method public boolean isSmsCapable();
method public boolean isTtyModeSupported();
method public boolean isVoiceCapable();
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method public void listen(android.telephony.PhoneStateListener, int);
method public java.lang.String sendEnvelopeWithStatus(java.lang.String);

View File

@@ -24,6 +24,7 @@ import android.app.ActivityThread;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.os.Bundle;
@@ -31,6 +32,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.util.Log;
import com.android.internal.telecom.ITelecomService;
@@ -4865,4 +4867,43 @@ public class TelephonyManager {
}
return null;
}
/**
* Returns the URI for the per-account voicemail ringtone set in Phone settings.
*
* @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
* voicemail ringtone.
* @return The URI for the ringtone to play when receiving a voicemail from a specific
* PhoneAccount.
*/
public Uri getVoicemailRingtoneUri(PhoneAccountHandle accountHandle) {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.getVoicemailRingtoneUri(accountHandle);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getVoicemailRingtoneUri", e);
}
return null;
}
/**
* Returns whether vibration is set for voicemail notification in Phone settings.
*
* @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
* voicemail vibration setting.
* @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise.
*/
public boolean isVoicemailVibrationEnabled(PhoneAccountHandle accountHandle) {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.isVoicemailVibrationEnabled(accountHandle);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isVoicemailVibrationEnabled", e);
}
return false;
}
}

View File

@@ -18,7 +18,9 @@ package com.android.internal.telephony;
import android.content.Intent;
import android.os.Bundle;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telephony.CellInfo;
import android.telephony.IccOpenLogicalChannelResponse;
import android.telephony.ModemActivityInfo;
@@ -966,7 +968,7 @@ interface ITelephony {
* Returns the Status of Wi-Fi Calling
*/
boolean isWifiCallingAvailable();
/**
* Returns the Status of Volte
*/
@@ -1014,4 +1016,23 @@ interface ITelephony {
* @return Service state on specified subscription.
*/
ServiceState getServiceStateForSubscriber(int subId, String callingPackage);
/**
* Returns the URI for the per-account voicemail ringtone set in Phone settings.
*
* @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
* voicemail ringtone.
* @return The URI for the ringtone to play when receiving a voicemail from a specific
* PhoneAccount.
*/
Uri getVoicemailRingtoneUri(in PhoneAccountHandle accountHandle);
/**
* Returns whether vibration is set for voicemail notification in Phone settings.
*
* @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
* voicemail vibration setting.
* @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise.
*/
boolean isVoicemailVibrationEnabled(in PhoneAccountHandle accountHandle);
}