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

Commit 49243b14 authored by Nancy Chen's avatar Nancy Chen
Browse files

Use the phone account when checking if a number is a voicemail number.

Currently when checking if a number is a voicemail number, we are checking
it against the voicemail number of the default phone account, which
results in a non-default voicemail number incorrectly being identified
as a regular phone number.

Bug: 17925501
Change-Id: Id73ff399467e2446a58c58e6211d1ec1d1f20b30
parent a40e32c8
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;
import android.telecom.AudioState;
import android.telecom.InCallService.VideoCall;
import android.telecom.PhoneCapabilities;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;


@@ -83,11 +84,12 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
            // OUTGOING.  We may want to do that once we start showing "Voice mail" label on
            // the dialpad too.)
            if (ui != null) {
                if (oldState == InCallState.OUTGOING && mCall != null
                        && PhoneNumberUtils.isVoiceMailNumber(mCall.getNumber())) {
                if (oldState == InCallState.OUTGOING && mCall != null) {
                    if (CallerInfoUtils.isVoiceMailNumber(ui.getContext(), mCall)) {
                        ui.displayDialpad(true /* show */, true /* animate */);
                    }
                }
            }
        } else if (newState == InCallState.INCOMING) {
            if (ui != null) {
                ui.displayDialpad(false /* show */, true /* animate */);
+1 −2
Original line number Diff line number Diff line
@@ -365,8 +365,7 @@ public class CallerInfoAsyncQuery {
        // check to see if these are recognized numbers, and use shortcuts if we can.
        if (PhoneNumberUtils.isLocalEmergencyNumber(context, info.phoneNumber)) {
            cw.event = EVENT_EMERGENCY_NUMBER;
        } else if (info.isVoiceMailNumber()
                || PhoneNumberUtils.isVoiceMailNumber(info.phoneNumber)) {
        } else if (info.isVoiceMailNumber()) {
            cw.event = EVENT_VOICEMAIL_NUMBER;
        } else {
            cw.event = EVENT_NEW_QUERY;
+11 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import android.content.Loader.OnLoadCompleteListener;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;

@@ -74,14 +75,22 @@ public class CallerInfoUtils {
        // Because the InCallUI is immediately launched before the call is connected, occasionally
        // a voicemail call will be passed to InCallUI as a "voicemail:" URI without a number.
        // This call should still be handled as a voicemail call.
        if (call.getHandle() != null &&
                PhoneAccount.SCHEME_VOICEMAIL.equals(call.getHandle().getScheme())) {
        if ((call.getHandle() != null &&
                PhoneAccount.SCHEME_VOICEMAIL.equals(call.getHandle().getScheme())) ||
                isVoiceMailNumber(context, call)) {
            info.markAsVoiceMail(context);
        }

        return info;
    }

    public static boolean isVoiceMailNumber(Context context, Call call) {
         TelecomManager telecomManager =
                 (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
         return telecomManager.isVoiceMailNumber(
                 call.getTelecommCall().getDetails().getAccountHandle(), call.getNumber());
    }

    /**
     * Handles certain "corner cases" for CNAP. When we receive weird phone numbers
     * from the network to indicate different number presentations, convert them to