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

Commit bc80e877 authored by Hunsuk Choi's avatar Hunsuk Choi
Browse files

Add DomainSelectionController for the domain selection service

Bug: 243344927
Bug: 258302615
Test: atest EmergencyCallDomainSelectionConnectionTest
Change-Id: Iedae4cf261e30f9dd30ef2b462e99e0b0007b225
parent 1e794f1a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.os.Message;
import android.os.WorkSource;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.BarringInfo;
import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
import android.telephony.DomainSelectionService;
@@ -2641,6 +2642,15 @@ public interface CommandsInterface {
     */
    default void getBarringInfo(Message result) {};

    /**
     * Returns the last barring information received.
     *
     * @return the last barring information.
     */
    default @Nullable BarringInfo getLastBarringInfo() {
        return null;
    };

    /**
     * Allocates a pdu session id
     *
+24 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.Annotation.DataActivityType;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.BarringInfo;
@@ -228,6 +229,8 @@ public class GsmCdmaPhone extends Phone {
    private final RegistrantList mVolteSilentRedialRegistrants = new RegistrantList();
    private DialArgs mDialArgs = null;

    private final RegistrantList mEmergencyDomainSelectedRegistrants = new RegistrantList();

    private String mImei;
    private String mImeiSv;
    private String mVmNumber;
@@ -4531,6 +4534,27 @@ public class GsmCdmaPhone extends Phone {
        mVolteSilentRedialRegistrants.notifyRegistrants(ar);
    }

    /** {@inheritDoc} */
    @Override
    public void registerForEmergencyDomainSelected(
            @NonNull Handler h, int what, @Nullable Object obj) {
        mEmergencyDomainSelectedRegistrants.addUnique(h, what, obj);
    }

    /** {@inheritDoc} */
    @Override
    public void unregisterForEmergencyDomainSelected(@NonNull Handler h) {
        mEmergencyDomainSelectedRegistrants.remove(h);
    }

    /** {@inheritDoc} */
    @Override
    public void notifyEmergencyDomainSelected(@TransportType int transportType) {
        logd("notifyEmergencyDomainSelected transportType=" + transportType);
        mEmergencyDomainSelectedRegistrants.notifyRegistrants(
                new AsyncResult(null, transportType, null));
    }

    /**
     * Sets the SIM voice message waiting indicator records.
     * @param line GSM Subscriber Profile Number, one-based. Only '1' is supported
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ public class NetworkIndication extends IRadioNetworkIndication.Stub {
        BarringInfo cbi = new BarringInfo(RILUtils.convertHalCellIdentity(cellIdentity),
                RILUtils.convertHalBarringInfoList(barringInfos));

        mRil.mBarringInfoChangedRegistrants.notifyRegistrants(new AsyncResult(null, cbi, null));
        mRil.notifyBarringInfoChanged(cbi);
    }

    /**
+28 −0
Original line number Diff line number Diff line
@@ -5018,6 +5018,34 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        }
    }

    /**
     * Registers for the domain selected for emergency calls.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForEmergencyDomainSelected(
            @NonNull Handler h, int what, @Nullable Object obj) {
    }

    /**
     * Unregisters for the domain selected for emergency calls.
     *
     * @param h Handler to be removed from the registrant list.
     */
    public void unregisterForEmergencyDomainSelected(@NonNull Handler h) {
    }

    /**
     * Notifies the domain selected.
     *
     * @param transportType The preferred transport type.
     */
    public void notifyEmergencyDomainSelected(
            @AccessNetworkConstants.TransportType int transportType) {
    }

    /**
     * @return Telephony tester instance.
     */
+15 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.provider.Settings;
import android.sysprop.TelephonyProperties;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.BarringInfo;
import android.telephony.CarrierRestrictionRules;
import android.telephony.CellInfo;
import android.telephony.CellSignalStrengthCdma;
@@ -267,6 +268,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
    final RilHandler mRilHandler;
    private MockModem mMockModem;

    // The last barring information received
    private BarringInfo mLastBarringInfo = null;

    // Thread-safe HashMap to map from RIL_REQUEST_XXX constant to HalVersion.
    // This is for Radio HAL Fallback Compatibility feature. When a RIL request
    // is received, the HAL method from the mapping HalVersion here (if present),
@@ -6433,6 +6437,17 @@ public class RIL extends BaseCommands implements CommandsInterface {
                new CellSignalStrengthNr());
    }

    void notifyBarringInfoChanged(@NonNull BarringInfo barringInfo) {
        mLastBarringInfo = barringInfo;
        mBarringInfoChangedRegistrants.notifyRegistrants(new AsyncResult(null, barringInfo, null));
    }

    /** {@inheritDoc} */
    @Override
    public @Nullable BarringInfo getLastBarringInfo() {
        return mLastBarringInfo;
    }

    /**
     * Get the HAL version with a specific service.
     *
Loading