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

Commit 8c066f7c authored by Nancy Chen's avatar Nancy Chen
Browse files

Use TelecomManager to call TelephonyManager#getVoicemailNumber (1/2)

Since we don't want the phone app to call TelephonyManager methods
directly, create a method in TelecomManager to mimic the behavior. The
reason we don't return the voicemail number directly is because once
TelecomManager becomes public, we don't want any old app to be able to
get the SIM's voicemail number.

Bug: 18233678

Change-Id: I620af409788aea7b58169b72a563baeed8115080
parent 75f304f9
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -731,6 +731,26 @@ public class TelecomManager {
        return false;
    }

    /**
     * Return whether a given phone account has a voicemail number configured.
     *
     * @param accountHandle The handle for the account to check for a voicemail number.
     * @return {@code true} If the given phone account has a voicemail number.
     *
     * @hide
     */
    @SystemApi
    public boolean hasVoiceMailNumber(PhoneAccountHandle accountHandle) {
        try {
            if (isServiceConnected()) {
                return getTelecomService().hasVoiceMailNumber(accountHandle);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException calling isInCall().", e);
        }
        return false;
    }

    /**
     * Returns whether there is an ongoing phone call (can be in dialing, ringing, active or holding
     * states).
+5 −0
Original line number Diff line number Diff line
@@ -120,6 +120,11 @@ interface ITelecomService {
     */
    boolean isVoiceMailNumber(in PhoneAccountHandle accountHandle, String number);

    /**
     * @see TelecomServiceImpl#hasVoiceMailNumber
     */
    boolean hasVoiceMailNumber(in PhoneAccountHandle accountHandle);

    /**
     * @see TelecomServiceImpl#getDefaultPhoneApp
     */