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

Commit 80753bc2 authored by Junda Liu's avatar Junda Liu
Browse files

Don't show SIM lock Setting if carrier config hides it.

Bug: b/19623656
Change-Id: Ic7420fe3579815a8c2c884a78b13112affb00787
parent 9f2b5a74
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.content.res.Resources;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.ListPreference;
@@ -43,6 +44,7 @@ import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.security.KeyStore;
import android.service.trust.TrustAgentService;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -263,7 +265,11 @@ public class SecuritySettings extends SettingsPreferenceFragment

        // Do not display SIM lock for devices without an Icc card
        TelephonyManager tm = TelephonyManager.getDefault();
        if (!mIsPrimary || !isSimIccReady()) {
        CarrierConfigManager cfgMgr = (CarrierConfigManager)
                getActivity().getSystemService(Context.CARRIER_CONFIG_SERVICE);
        PersistableBundle b = cfgMgr.getConfig();
        if (!mIsPrimary || !isSimIccReady() ||
                b.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
            root.removePreference(root.findPreference(KEY_SIM_LOCK));
        } else {
            // Disable SIM lock if there is no ready SIM card.