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

Commit 34931eaf authored by sqian's avatar sqian
Browse files

Introduce Emergency Number Tracker

- Introduce EmergencyNumberTracker that handles the radio indication
of emergency number updates and the update of ECC database based on
the country ISO
- Configure ecc-protos-lite library to be ready to use Eccdata
- Introduce RIL commands for the indication and PhoneStateListener
- Add dumpy system for EmergencyNumberTracker
- Deploy some implementation in TelephonyRegistry,
 TelephonyComponentFactory, and Phone classes, to be ready to further
 connect with the API implementation
- Implement EmergencyNumberTrackerTest

Test: Treehugger; atest EmergencyNumberTrackerTest
Bug: 112657134
Change-Id: I13d41044dc431e26ae0ca3b1cd7bba234a86364e
Merged-In: I13d41044dc431e26ae0ca3b1cd7bba234a86364e
(cherry picked from commit 4d489c6f)
parent f3c2a7d2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ java_library {
    ],
    static_libs: [
        "telephony-protos",
        "ecc-protos-lite",
        "android.hardware.radio-V1.0-java",
        "android.hardware.radio-V1.1-java",
        "android.hardware.radio-V1.2-java",
+12 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ public abstract class BaseCommands implements CommandsInterface {
    protected RegistrantList mNattKeepaliveStatusRegistrants = new RegistrantList();
    protected RegistrantList mPhysicalChannelConfigurationRegistrants = new RegistrantList();
    protected RegistrantList mLceInfoRegistrants = new RegistrantList();
    protected RegistrantList mEmergencyNumberListRegistrants = new RegistrantList();

    protected Registrant mGsmSmsRegistrant;
    protected Registrant mCdmaSmsRegistrant;
@@ -783,6 +784,17 @@ public abstract class BaseCommands implements CommandsInterface {
        mSubscriptionStatusRegistrants.remove(h);
    }

    @Override
    public void registerForEmergencyNumberList(Handler h, int what, Object obj) {
        Registrant r = new Registrant(h, what, obj);
        mEmergencyNumberListRegistrants.add(r);
    }

    @Override
    public void unregisterForEmergencyNumberList(Handler h) {
        mEmergencyNumberListRegistrants.remove(h);
    }

    //***** Protected Methods
    /**
     * Store new RadioState and send notification based on the changes
+16 −0
Original line number Diff line number Diff line
@@ -2220,6 +2220,22 @@ public interface CommandsInterface {
     */
    void unregisterForNattKeepaliveStatus(Handler h);

    /**
     * Register for unsolicited Emergency Number List Indications
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    void registerForEmergencyNumberList(Handler h, int what, Object obj);

    /**
     * Deregister for unsolicited Emergency Number List Indications
     *
     * @param h Handler for notification message.
     */
    void unregisterForEmergencyNumberList(Handler h);

    /**
     * Start sending NATT Keepalive packets on a specified data connection
     *
+14 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;

import java.util.List;

@@ -362,6 +363,19 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        }
    }

    @Override
    public void notifyEmergencyNumberList(Phone sender,
                                          List<EmergencyNumber> emergencyNumberList) {
        int subId = sender.getSubId();
        try {
            if (mRegistry != null) {
                mRegistry.notifyEmergencyNumberList(emergencyNumberList);
            }
        } catch (RemoteException ex) {
            // system process is dead
        }
    }

    /**
     * Convert the {@link Phone.DataActivityState} enum into the TelephonyManager.DATA_* constants
     * for the public API.
+9 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ import com.android.internal.telephony.cdma.CdmaMmiCode;
import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
import com.android.internal.telephony.cdma.EriManager;
import com.android.internal.telephony.dataconnection.TransportManager;
import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.gsm.GsmMmiCode;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.test.SimulatedRadioControl;
@@ -169,6 +170,7 @@ public class GsmCdmaPhone extends Phone {
    private IsimUiccRecords mIsimUiccRecords;
    public GsmCdmaCallTracker mCT;
    public ServiceStateTracker mSST;
    public EmergencyNumberTracker mEmergencyNumberTracker;
    private ArrayList <MmiCode> mPendingMMIs = new ArrayList<MmiCode>();
    private IccPhoneBookInterfaceManager mIccPhoneBookIntManager;
    // Used for identify the carrier of current subscription
@@ -228,6 +230,8 @@ public class GsmCdmaPhone extends Phone {
        mCarrierSignalAgent = mTelephonyComponentFactory.makeCarrierSignalAgent(this);
        mTransportManager = mTelephonyComponentFactory.makeTransportManager(this);
        mSST = mTelephonyComponentFactory.makeServiceStateTracker(this, this.mCi);
        mEmergencyNumberTracker = mTelephonyComponentFactory.makeEmergencyNumberTracker(
                this, this.mCi);
        // DcTracker uses SST so needs to be created after it is instantiated
        for (int transport : mTransportManager.getAvailableTransports()) {
            mDcTrackers.put(transport, mTelephonyComponentFactory.makeDcTracker(this,
@@ -475,6 +479,11 @@ public class GsmCdmaPhone extends Phone {
        return mSST;
    }

    @Override
    public EmergencyNumberTracker getEmergencyNumberTracker() {
        return mEmergencyNumberTracker;
    }

    @Override
    public CallTracker getCallTracker() {
        return mCT;
Loading