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

Commit 2a3e05da authored by Nancy Chen's avatar Nancy Chen Committed by Natiq Ahmed
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 d90b41e0
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -28186,9 +28186,7 @@ package android.telecom {
  public class TelecomManager {
    method public void cancelMissedCallsNotification();
    method public android.net.Uri getAdnUriForPhoneAccount(android.telecom.PhoneAccountHandle);
    method public boolean handleMmi(java.lang.String);
    method public boolean handleMmi(android.telecom.PhoneAccountHandle, java.lang.String);
    method public boolean isInCall();
    method public void showInCallScreen(boolean);
    field public static final java.lang.String ACTION_SHOW_CALL_SETTINGS = "android.telecom.action.SHOW_CALL_SETTINGS";
+20 −3
Original line number Diff line number Diff line
@@ -725,6 +725,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).
@@ -982,10 +1002,8 @@ public class TelecomManager {
     * @param accountHandle The handle for the account the MMI code should apply to.
     * @param dialString The digits to dial.
     * @return True if the digits were processed as an MMI code, false otherwise.
     *
     * @hide
     */
    @SystemApi
    public boolean handleMmi(PhoneAccountHandle accountHandle, String dialString) {
        ITelecomService service = getTelecomService();
        if (service != null) {
@@ -1005,7 +1023,6 @@ public class TelecomManager {
     * for the the content retrieve.
     * @hide
     */
    @SystemApi
    public Uri getAdnUriForPhoneAccount(PhoneAccountHandle accountHandle) {
        ITelecomService service = getTelecomService();
        if (service != null && accountHandle != null) {
+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
     */