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

Commit 46b42ef3 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android Git Automerger
Browse files

am 05f9e8d0: Merge "Minimize the number of calls to...

am 05f9e8d0: Merge "Minimize the number of calls to PhoneNumberUtils.isLocalEmergencyNumber." into mnc-dr-dev

* commit '05f9e8d0':
  Minimize the number of calls to PhoneNumberUtils.isLocalEmergencyNumber.
parents db6ead53 05f9e8d0
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -366,7 +366,6 @@ public class Call implements CreateConnectionResponse {
        mContactsAsyncHelper = contactsAsyncHelper;
        mCallerInfoAsyncQueryFactory = callerInfoAsyncQueryFactory;
        setHandle(handle);
        setHandle(handle, TelecomManager.PRESENTATION_ALLOWED);
        mGatewayInfo = gatewayInfo;
        setConnectionManagerPhoneAccount(connectionManagerPhoneAccountHandle);
        setTargetPhoneAccount(targetPhoneAccountHandle);
+6 −4
Original line number Diff line number Diff line
@@ -148,7 +148,8 @@ final class CallLogManager extends CallsManagerListenerBase {
        // TODO(vt): Once data usage is available, wire it up here.
        int callFeatures = getCallFeatures(call.getVideoStateHistory());
        logCall(call.getCallerInfo(), logNumber, call.getHandlePresentation(),
                callLogType, callFeatures, accountHandle, creationTime, age, null);
                callLogType, callFeatures, accountHandle, creationTime, age, null,
                call.isEmergencyCall());
    }

    /**
@@ -162,6 +163,7 @@ final class CallLogManager extends CallsManagerListenerBase {
     * @param start The start time of the call, in milliseconds.
     * @param duration The duration of the call, in milliseconds.
     * @param dataUsage The data usage for the call, null if not applicable.
     * @param isEmergency {@code true} if this is an emergency call, {@code false} otherwise.
     */
    private void logCall(
            CallerInfo callerInfo,
@@ -172,8 +174,8 @@ final class CallLogManager extends CallsManagerListenerBase {
            PhoneAccountHandle accountHandle,
            long start,
            long duration,
            Long dataUsage) {
        boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(mContext, number);
            Long dataUsage,
            boolean isEmergency) {

        // On some devices, to avoid accidental redialing of emergency numbers, we *never* log
        // emergency calls to the Call Log.  (This behavior is set on a per-product basis, based
@@ -182,7 +184,7 @@ final class CallLogManager extends CallsManagerListenerBase {
                mContext.getResources().getBoolean(R.bool.allow_emergency_numbers_in_call_log);

        // Don't log emergency numbers if the device doesn't allow it.
        final boolean isOkToLogThisCall = !isEmergencyNumber || okToLogEmergencyNumber;
        final boolean isOkToLogThisCall = !isEmergency || okToLogEmergencyNumber;

        sendAddCallBroadcast(callType, duration);

+4 −8
Original line number Diff line number Diff line
@@ -623,13 +623,11 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx

        call.setTargetPhoneAccount(phoneAccountHandle);

        boolean isEmergencyCall = TelephonyUtil.shouldProcessAsEmergency(mContext,
                call.getHandle());
        boolean isPotentialInCallMMICode = isPotentialInCallMMICode(handle);

        // Do not support any more live calls.  Our options are to move a call to hold, disconnect
        // a call, or cancel this call altogether.
        if (!isPotentialInCallMMICode && !makeRoomForOutgoingCall(call, isEmergencyCall)) {
        if (!isPotentialInCallMMICode && !makeRoomForOutgoingCall(call, call.isEmergencyCall())) {
            // just cancel at this point.
            Log.i(this, "No remaining room for outgoing call: %s", call);
            if (mCalls.contains(call)) {
@@ -641,7 +639,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        }

        boolean needsAccountSelection = phoneAccountHandle == null && accounts.size() > 1 &&
                !isEmergencyCall;
                !call.isEmergencyCall();

        if (needsAccountSelection) {
            // This is the state where the user is expected to select an account
@@ -706,14 +704,12 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        }
        call.setStartWithSpeakerphoneOn(speakerphoneOn || mDockManager.isDocked());

        boolean isEmergencyCall = TelephonyUtil.shouldProcessAsEmergency(mContext,
                call.getHandle());
        if (isEmergencyCall) {
        if (call.isEmergencyCall()) {
            // Emergency -- CreateConnectionProcessor will choose accounts automatically
            call.setTargetPhoneAccount(null);
        }

        if (call.getTargetPhoneAccount() != null || isEmergencyCall) {
        if (call.getTargetPhoneAccount() != null || call.isEmergencyCall()) {
            // If the account has been set, proceed to place the outgoing call.
            // Otherwise the connection will be initiated when the account is set by the user.
            call.startCreateConnection(mPhoneAccountRegistrar);
+1 −1
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ final class CreateConnectionProcessor {
    // If we are possibly attempting to call a local emergency number, ensure that the
    // plain PSTN connection services are listed, and nothing else.
    private void adjustAttemptsForEmergency()  {
        if (TelephonyUtil.shouldProcessAsEmergency(mContext, mCall.getHandle())) {
        if (mCall.isEmergencyCall()) {
            Log.i(this, "Emergency number detected");
            mAttemptRecords.clear();
            List<PhoneAccount> allAccounts = mPhoneAccountRegistrar.getAllPhoneAccounts();
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ final class CreateConnectionTimeout extends PhoneStateListener implements Runnab
    boolean isTimeoutNeededForCall(Collection<PhoneAccountHandle> accounts,
            PhoneAccountHandle currentAccount) {
        // Non-emergency calls timeout automatically at the radio layer. No need for a timeout here.
        if (!TelephonyUtil.shouldProcessAsEmergency(mContext, mCall.getHandle())) {
        if (!mCall.isEmergencyCall()) {
            return false;
        }