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

Commit fb6e1bf2 authored by Ta-wei Yen's avatar Ta-wei Yen Committed by Android (Google) Code Review
Browse files

Merge "Add API to enable/disable the visual voicemail client" into nyc-mr1-dev

parents 7a66b70d 20f2ebbf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
+50 −0
Original line number Diff line number Diff line
@@ -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
+6 −0
Original line number Diff line number Diff line
@@ -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);