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

Commit 3263436c authored by sqian's avatar sqian
Browse files

Integrate Emergency Number everywhere

Patch Set 1-2:
1) trigger the update from LocaleTracker if country ISO is changed
2) cache emergency number list from database based on country ISO
3) merge emergency number from radio and database
4) merge two emergency numbers if they are the same one
5) load EccInfo from database
6) create another Handler message to update DB emergency number list

Patch set 5:
7) remove the passed parameters for notifier
8) getEmergencyNumberList returns null if radio indication not support
from the HAL
9) comment the steps of merge logic for radio and database number list

Patch set 6:
10) Merge Same Numbers In the Emergency Number List to prevent duplicate.
11) Refactor mergeRadioAndDatabaseList()

Patch set 7:
12) Refactor mergeRadioAndDatabaseList()
13) remove Phone in notifier

Patch set 9:
14) Add mnc into Emergency Number
15) Add Radio Indication

Bug: 112657134
Test: Treehugger; Manual

Change-Id: I54678f0dd65cfb785d7fced19c1e408e3184cb87
parent f2afe5c3
Loading
Loading
Loading
Loading
+2 −5
Original line number Original line Diff line number Diff line
@@ -31,7 +31,6 @@ import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;


import java.util.List;
import java.util.List;


@@ -364,12 +363,10 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    }
    }


    @Override
    @Override
    public void notifyEmergencyNumberList(Phone sender,
    public void notifyEmergencyNumberList() {
                                          List<EmergencyNumber> emergencyNumberList) {
        int subId = sender.getSubId();
        try {
        try {
            if (mRegistry != null) {
            if (mRegistry != null) {
                mRegistry.notifyEmergencyNumberList(emergencyNumberList);
                mRegistry.notifyEmergencyNumberList();
            }
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // system process is dead
            // system process is dead
+10 −0
Original line number Original line Diff line number Diff line
@@ -402,6 +402,16 @@ public class LocaleTracker extends Handler {
            mLocalLog.log(msg);
            mLocalLog.log(msg);
            mCurrentCountryIso = countryIso;
            mCurrentCountryIso = countryIso;


            // Inform EmergencyNumberTrack with the change of current Country ISO
            if (mPhone != null && mPhone.getEmergencyNumberTracker() != null) {
                mPhone.getEmergencyNumberTracker().updateEmergencyNumberDatabaseCountryChange(
                        getCurrentCountry());
                log("Notified EmergencyNumberTracker");
            } else {
                loge("Cannot notify EmergencyNumberTracker. Phone is null? "
                        + Boolean.toString(mPhone == null));
            }

            TelephonyManager.setTelephonyProperty(mPhone.getPhoneId(),
            TelephonyManager.setTelephonyProperty(mPhone.getPhoneId(),
                    TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, mCurrentCountryIso);
                    TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, mCurrentCountryIso);


+3 −3
Original line number Original line Diff line number Diff line
@@ -2250,9 +2250,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mNotifier.notifySrvccStateChanged(this, state);
        mNotifier.notifySrvccStateChanged(this, state);
    }
    }


    /** Notify the list of {@link EmergencyNumber} changes. */
    /** Notify the {@link EmergencyNumber} changes. */
    public void notifyEmergencyNumberList(List<EmergencyNumber> emergencyNumberList) {
    public void notifyEmergencyNumberList() {
        mNotifier.notifyEmergencyNumberList(this, emergencyNumberList);
        mNotifier.notifyEmergencyNumberList();
    }
    }


    /**
    /**
+1 −2
Original line number Original line Diff line number Diff line
@@ -21,7 +21,6 @@ import android.telephony.CellLocation;
import android.telephony.PhoneCapability;
import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PhysicalChannelConfig;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.telephony.emergency.EmergencyNumber;


import java.util.List;
import java.util.List;


@@ -81,5 +80,5 @@ public interface PhoneNotifier {
    void notifyRadioPowerStateChanged(@TelephonyManager.RadioPowerState int state);
    void notifyRadioPowerStateChanged(@TelephonyManager.RadioPowerState int state);


    /** Notify of change to EmergencyNumberList. */
    /** Notify of change to EmergencyNumberList. */
    void notifyEmergencyNumberList(Phone sender, List<EmergencyNumber> emergencyNumberList);
    void notifyEmergencyNumberList();
}
}
+23 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_RUIM_SM
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CELL_INFO_LIST;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CELL_INFO_LIST;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_DATA_CALL_LIST_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_DATA_CALL_LIST_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_EMERGENCY_NUMBER_LIST;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_HARDWARE_CONFIG_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_HARDWARE_CONFIG_CHANGED;
@@ -92,6 +93,7 @@ import android.telephony.PhysicalChannelConfig;
import android.telephony.SignalStrength;
import android.telephony.SignalStrength;
import android.telephony.SmsMessage;
import android.telephony.SmsMessage;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.telephony.emergency.EmergencyNumber;


import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
import com.android.internal.telephony.cdma.CdmaInformationRecords;
import com.android.internal.telephony.cdma.CdmaInformationRecords;
@@ -306,6 +308,27 @@ public class RadioIndication extends IRadioIndication.Stub {
                new AsyncResult(null, response, null));
                new AsyncResult(null, response, null));
    }
    }


    /**
     * Indicates current emergency number list.
     */
    public void currentEmergencyNumberList(int indicationType,
            ArrayList<android.hardware.radio.V1_4.EmergencyNumber> emergencyNumberList) {
        List<EmergencyNumber> response = new ArrayList<>(emergencyNumberList.size());

        for (android.hardware.radio.V1_4.EmergencyNumber emergencyNumberHal
                : emergencyNumberList) {
            EmergencyNumber emergencyNumber = new EmergencyNumber(emergencyNumberHal.number,
                    MccTable.countryCodeForMcc(emergencyNumberHal.mcc), emergencyNumberHal.mnc,
                    emergencyNumberHal.categories, emergencyNumberHal.sources);
            response.add(emergencyNumber);
        }

        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_EMERGENCY_NUMBER_LIST, response);

        mRil.mEmergencyNumberListRegistrants.notifyRegistrants(
                new AsyncResult(null, response, null));
    }

    public void dataCallListChanged(int indicationType, ArrayList<SetupDataCallResult> dcList) {
    public void dataCallListChanged(int indicationType, ArrayList<SetupDataCallResult> dcList) {
        mRil.processIndication(indicationType);
        mRil.processIndication(indicationType);


Loading