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

Commit 9527cb15 authored by Junyeong Bak's avatar Junyeong Bak
Browse files

Use TelephonyManager API for Telecom Settings



Change the deprecated API to TelephonyManager API

Test: Manual
Bug: 151064109

Signed-off-by: default avatarJunyeong Bak <junyeong.bak@samsung.com>
Change-Id: I3d060aa7b7164a0323bbb4d9661568a6f07d5b61
parent b0d2bed4
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.os.Bundle;
import android.provider.BlockedNumberContract;
import android.telephony.PhoneNumberFormattingTextWatcher;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@@ -276,7 +277,7 @@ public class BlockedNumbersActivity extends ListActivity
     * Add blocked number if it does not exist.
     */
    private void addBlockedNumber(String number) {
        if (PhoneNumberUtils.isEmergencyNumber(number)) {
        if (isEmergencyNumber(this, number)) {
            Toast.makeText(
                    this,
                    getString(R.string.blocked_numbers_block_emergency_number_message),
@@ -289,6 +290,16 @@ public class BlockedNumbersActivity extends ListActivity
        }
    }

    private boolean isEmergencyNumber(Context context, String number) {
        try {
            TelephonyManager tm = (TelephonyManager) context.getSystemService(
                    Context.TELEPHONY_SERVICE);
            return tm.isEmergencyNumber(number);
        } catch (IllegalStateException ise) {
            return false;
        }
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        // no-op