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

Commit a416e07f authored by Shishir Agrawal's avatar Shishir Agrawal
Browse files

Migrate allow_emergency_numbers_in_call_log to CarrierConfig.

Needs to use the CarrierConfig variable rather than the overlay.

Bug: 26084877
Change-Id: I4b56bd875a1c89c377ee21a74295d1c39bbc6e1c
parent f21d66d3
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -20,10 +20,12 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.PersistableBundle;
import android.provider.CallLog.Calls;
import android.telecom.DisconnectCause;
import android.telecom.PhoneAccountHandle;
import android.telecom.VideoProfile;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;

// TODO: Needed for move to system service: import com.android.internal.R;
@@ -182,8 +184,14 @@ final class CallLogManager extends CallsManagerListenerBase {
        // On some devices, to avoid accidental redialing of emergency numbers, we *never* log
        // emergency calls to the Call Log.  (This behavior is set on a per-product basis, based
        // on carrier requirements.)
        final boolean okToLogEmergencyNumber =
                mContext.getResources().getBoolean(R.bool.allow_emergency_numbers_in_call_log);
        boolean okToLogEmergencyNumber = false;
        CarrierConfigManager configManager = (CarrierConfigManager) mContext.getSystemService(
                Context.CARRIER_CONFIG_SERVICE);
        PersistableBundle configBundle = configManager.getConfig();
        if (configBundle != null) {
            okToLogEmergencyNumber = configBundle.getBoolean(
                    CarrierConfigManager.KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL);
        }

        // Don't log emergency numbers if the device doesn't allow it.
        final boolean isOkToLogThisCall = !isEmergency || okToLogEmergencyNumber;