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

Commit 3b053dc8 authored by Hunsuk Choi's avatar Hunsuk Choi Committed by Android (Google) Code Review
Browse files

Merge "Update APIs for domain selection service plug-in" into main

parents 6b695c51 100c8d13
Loading
Loading
Loading
Loading
+2 −26
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ public class DomainSelectionConnection {
                mDomainSelector = selector;
                if (checkState(STATUS_DISPOSED)) {
                    try {
                        selector.cancelSelection();
                        selector.finishSelection();
                    } catch (RemoteException e) {
                        // ignore exception
                    }
@@ -116,20 +116,6 @@ public class DomainSelectionConnection {
            }
        }

        @Override
        public @NonNull IWwanSelectorCallback onWwanSelected() {
            synchronized (mLock) {
                if (mWwanSelectorCallback == null) {
                    mWwanSelectorCallback = new WwanSelectorCallbackAdaptor();
                }
                if (checkState(STATUS_DISPOSED)) {
                    return mWwanSelectorCallback;
                }
                DomainSelectionConnection.this.onWwanSelected();
                return mWwanSelectorCallback;
            }
        }

        @Override
        public void onWwanSelectedAsync(@NonNull final ITransportSelectorResultCallback cb) {
            synchronized (mLock) {
@@ -517,17 +503,7 @@ public class DomainSelectionConnection {
     * to clean up all ongoing operations with the framework.
     */
    public void cancelSelection() {
        synchronized (mLock) {
            try {
                if (mDomainSelector != null) {
                    mDomainSelector.cancelSelection();
                }
            } catch (RemoteException e) {
                loge("cancelSelection exception=" + e);
            } finally {
                dispose();
            }
        }
        finishSelection();
    }

    /**
+10 −5
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import static com.android.internal.telephony.emergency.EmergencyConstants.MODE_E

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.Annotation.DisconnectCauses;
@@ -201,6 +203,7 @@ public class EmergencyCallDomainSelectionConnection extends DomainSelectionConne
     * @param exited {@code true} if the request caused the device to move out of airplane mode.
     * @param callId The call identifier.
     * @param number The dialed number.
     * @param isTest Indicates it's a test emergency number.
     * @param callFailCause The reason why the last CS attempt failed.
     * @param imsReasonInfo The reason why the last PS attempt failed.
     * @param emergencyRegResult The current registration result for emergency services.
@@ -208,16 +211,17 @@ public class EmergencyCallDomainSelectionConnection extends DomainSelectionConne
     */
    public static @NonNull DomainSelectionService.SelectionAttributes getSelectionAttributes(
            int slotId, int subId, boolean exited,
            @NonNull String callId, @NonNull String number, int callFailCause,
            @Nullable ImsReasonInfo imsReasonInfo,
            @NonNull String callId, @NonNull String number, boolean isTest,
            int callFailCause, @Nullable ImsReasonInfo imsReasonInfo,
            @Nullable EmergencyRegResult emergencyRegResult) {
        DomainSelectionService.SelectionAttributes.Builder builder =
                new DomainSelectionService.SelectionAttributes.Builder(
                        slotId, subId, SELECTOR_TYPE_CALLING)
                .setEmergency(true)
                .setTestEmergencyNumber(isTest)
                .setExitedFromAirplaneMode(exited)
                .setCallId(callId)
                .setNumber(number)
                .setAddress(Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null))
                .setCsDisconnectCause(callFailCause);

        if (imsReasonInfo != null) builder.setPsDisconnectCause(imsReasonInfo);
@@ -233,11 +237,12 @@ public class EmergencyCallDomainSelectionConnection extends DomainSelectionConne
        if (attr == null) return null;
        DomainSelectionService.SelectionAttributes.Builder builder =
                new DomainSelectionService.SelectionAttributes.Builder(
                        attr.getSlotId(), attr.getSubId(), SELECTOR_TYPE_CALLING)
                        attr.getSlotIndex(), attr.getSubscriptionId(), SELECTOR_TYPE_CALLING)
                .setCallId(attr.getCallId())
                .setNumber(attr.getNumber())
                .setAddress(attr.getAddress())
                .setVideoCall(attr.isVideoCall())
                .setEmergency(true)
                .setTestEmergencyNumber(attr.isTestEmergencyNumber())
                .setExitedFromAirplaneMode(attr.isExitedFromAirplaneMode())
                .setEmergencyRegResult(new EmergencyRegResult(AccessNetworkType.UNKNOWN,
                        NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN,
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import static android.telephony.DomainSelectionService.SELECTOR_TYPE_CALLING;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telephony.AccessNetworkConstants.RadioAccessNetworkType;
import android.telephony.Annotation.DisconnectCauses;
import android.telephony.DisconnectCause;
@@ -119,7 +121,7 @@ public class NormalCallDomainSelectionConnection extends DomainSelectionConnecti
                        slotId, subId, SELECTOR_TYPE_CALLING)
                        .setEmergency(false)
                        .setCallId(callId)
                        .setNumber(number)
                        .setAddress(Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null))
                        .setCsDisconnectCause(callFailCause)
                        .setVideoCall(isVideoCall);

+0 −11
Original line number Diff line number Diff line
@@ -53,17 +53,6 @@ public class SmsDomainSelectionConnection extends DomainSelectionConnection {
        if (mCallback != null) mCallback.onSelectionTerminated(cause);
    }

    @Override
    public void finishSelection() {
        CompletableFuture<Integer> future = getCompletableFuture();

        if (future != null && !future.isDone()) {
            cancelSelection();
        } else {
            super.finishSelection();
        }
    }

    /**
     * Requests a domain selection for SMS.
     *
+6 −2
Original line number Diff line number Diff line
@@ -33,9 +33,11 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import android.net.Uri;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.RemoteException;
import android.telecom.PhoneAccount;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.DomainSelectionService;
@@ -255,7 +257,7 @@ public class DomainSelectionConnectionTest extends TelephonyTest {

        mDsc.cancelSelection();

        verify(domainSelector).cancelSelection();
        verify(domainSelector).finishSelection();
    }

    @Test
@@ -594,7 +596,9 @@ public class DomainSelectionConnectionTest extends TelephonyTest {
                .setCsDisconnectCause(callFailCause);

        if (callId != null) builder.setCallId(callId);
        if (number != null) builder.setNumber(number);
        if (number != null) {
            builder.setAddress(Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null));
        }
        if (imsReasonInfo != null) builder.setPsDisconnectCause(imsReasonInfo);
        if (regResult != null) builder.setEmergencyRegResult(regResult);

Loading