Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 740fb3bc authored by Nancy Chen's avatar Nancy Chen
Browse files

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
parent 29b7dd8d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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();
+2 −0
Original line number Diff line number Diff line
@@ -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);
+41 −0
Original line number Diff line number Diff line
@@ -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;
    }
}
+22 −1
Original line number Diff line number Diff line
@@ -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;
@@ -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);
}