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

Commit e525faf6 authored by Michael W's avatar Michael W Committed by Bruno Martins
Browse files

Keyguard: Remove carrier text for disabled SIMs

* By setting the State to "NOT_READY", the behaviour of the carrier text
  on the lockscreen is the same as it would be with one SIM only

Change-Id: Iafe7ad820e59f4d960383309a7c4e1a87581cc51
parent 2db5a337
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ import com.android.systemui.recents.misc.SystemServicesProxy.TaskStackListener;

import com.google.android.collect.Lists;

import org.lineageos.internal.util.TelephonyExtUtils;
import org.lineageos.internal.util.TelephonyExtUtils.ProvisioningChangedListener;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
@@ -98,7 +101,8 @@ import java.util.Map.Entry;
 * the device, and {@link #getFailedUnlockAttempts()}, {@link #reportFailedAttempt()}
 * and {@link #clearFailedUnlockAttempts()}.  Maybe we should rename this 'KeyguardContext'...
 */
public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
public class KeyguardUpdateMonitor implements TrustManager.TrustListener,
        ProvisioningChangedListener {

    private static final String TAG = "KeyguardUpdateMonitor";
    private static final boolean DEBUG = KeyguardConstants.DEBUG;
@@ -182,6 +186,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    private final Context mContext;
    HashMap<Integer, SimData> mSimDatas = new HashMap<Integer, SimData>();
    HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>();
    HashMap<Integer, State> mProvisionStates = new HashMap<Integer, State>();

    private int mRingMode;
    private int mPhoneState;
@@ -332,6 +337,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        }
    };

    @Override
    public void onProvisioningChanged(int slotId, boolean isProvisioned) {
        mProvisionStates.put(slotId, isProvisioned ? State.UNKNOWN : State.NOT_READY);
        handleSimSubscriptionInfoChanged();
    }

    private OnSubscriptionsChangedListener mSubscriptionListener =
            new OnSubscriptionsChangedListener() {
        @Override
@@ -1383,6 +1394,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
                cb.onBootCompleted();
            }
        }

        TelephonyExtUtils.getInstance(mContext).addListener(this);
    }

    /**
@@ -1813,6 +1826,20 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
            Log.w(TAG, "Unknown sim state: " + simState);
            state = State.UNKNOWN;
        }

        // Try to get provision-status from telephony extensions and override the state if valid
        TelephonyExtUtils extTelephony = TelephonyExtUtils.getInstance(mContext);
        if (extTelephony.hasService()) {
            State extState = mProvisionStates.get(slotId);
            if (extState == null) {
                extState = extTelephony.isSlotProvisioned(slotId) ? State.UNKNOWN : State.NOT_READY;
                mProvisionStates.put(slotId, extState);
            }
            if (extState != null && extState != State.UNKNOWN) {
                state = extState;
            }
        }

        SimData data = mSimDatas.get(subId);
        final boolean changed;
        if (data == null) {