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

Commit 443e501c authored by Nancy Chen's avatar Nancy Chen
Browse files

Use Telecom API for checking if a number is voicemail (1/2)

Since we don't want to communicate directly with Telephony in dialer, call
PhoneNumberUtils.isVoiceMailNumber (a Telephony method) through the
Telecom API. Add a method in TelecomManager to do this.

Bug: 17925501

Change-Id: Iecea82a0e5f0b106eaf105e9026d606110acf122
parent c913c2de
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -655,6 +655,27 @@ public class TelecomManager {
        return null;
    }

    /**
     * Return whether a given phone number is the configured voicemail number for a
     * particular phone account.
     *
     * @param accountHandle The handle for the account to check the voicemail number against
     * @param number The number to look up.
     *
     * @hide
     */
    @SystemApi
    public boolean isVoiceMailNumber(PhoneAccountHandle accountHandle, String number) {
        try {
            if (isServiceConnected()) {
                return getTelecomService().isVoiceMailNumber(accountHandle, number);
            }
        } 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
@@ -114,6 +114,11 @@ interface ITelecomService {
     */
    void clearAccounts(String packageName);

    /**
     * @see TelecomServiceImpl#isVoiceMailNumber
     */
    boolean isVoiceMailNumber(in PhoneAccountHandle accountHandle, String number);

    /**
     * @see TelecomServiceImpl#getDefaultPhoneApp
     */