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

Commit 130a2c16 authored by Grant Menke's avatar Grant Menke
Browse files

Add helper functions for emergency device configs.

Added helper functions to check two new demergency number database
related device configs. The first new device configs returns a boolean
representing whether modem/config sourced emergency numbers should be
ignored. The second new device config returns a boolean representing
whether emergency number routing defined in the android emergency number
database should be ignored.

Bug: 247636518
Test: manual
Change-Id: I1398f36070799a7b9c8c01ec084853cb26bf610b
parent 85a5b246
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.os.AsyncResult;
import android.os.Environment;
import android.os.Handler;
@@ -102,6 +103,8 @@ public class EmergencyNumberTracker extends Handler {
    private String mLastKnownEmergencyCountryIso = "";
    private int mCurrentDatabaseVersion = INVALID_DATABASE_VERSION;
    private boolean mIsHalVersionLessThan1Dot4 = false;
    private Resources mResources = null;

    /**
     * Indicates if the country iso is set by another subscription.
     * @hide
@@ -168,6 +171,7 @@ public class EmergencyNumberTracker extends Handler {
    public EmergencyNumberTracker(Phone phone, CommandsInterface ci) {
        mPhone = phone;
        mCi = ci;
        mResources = mPhone.getContext().getResources();

        if (mPhone != null) {
            mPhoneId = phone.getPhoneId();
@@ -1137,6 +1141,28 @@ public class EmergencyNumberTracker extends Handler {
        }
    }

    /**
     * @return {@code true} if emergency numbers sourced from modem/config should be ignored.
     * {@code false} if emergency numbers sourced from modem/config should not be ignored.
     */
    @VisibleForTesting
    public boolean shouldModemConfigEmergencyNumbersBeIgnored() {
        return mResources.getBoolean(com.android.internal.R.bool
                .ignore_modem_config_emergency_numbers);
    }

    /**
     * @return {@code true} if emergency number routing from the android emergency number
     * database should be ignored.
     * {@code false} if emergency number routing from the android emergency number database
     * should not be ignored.
     */
    @VisibleForTesting
    public boolean shouldEmergencyNumberRoutingFromDbBeIgnored() {
        return mResources.getBoolean(com.android.internal.R.bool
                .ignore_emergency_number_routing_from_db);
    }

    /**
     * Dump Emergency Number List info in the tracking
     *