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

Commit ce4e372a authored by Jayachandran Chinnakkannu's avatar Jayachandran Chinnakkannu Committed by Android (Google) Code Review
Browse files

Merge "Remove usage of IccCardConstants hidden API"

parents 77c00142 f5436a64
Loading
Loading
Loading
Loading
+19 −26
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.settingslib.WirelessUtils;
import com.android.systemui.Dependency;
@@ -106,7 +105,7 @@ public class CarrierTextController {
            updateCarrierText();
        }

        public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) {
        public void onSimStateChanged(int subId, int slotId, int simState) {
            if (slotId < 0 || slotId >= mSimSlotsNumber) {
                Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId
                        + " mTelephonyCapable: " + Boolean.toString(mTelephonyCapable));
@@ -191,7 +190,7 @@ public class CarrierTextController {
            CharSequence[] carrierNames, int[] subOrderBySlot, boolean noSims) {
        final CharSequence carrier = "";
        CharSequence carrierTextForSimIOError = getCarrierTextForSimState(
                IccCardConstants.State.CARD_IO_ERROR, carrier);
                TelephonyManager.SIM_STATE_CARD_IO_ERROR, carrier);
        // mSimErrorState has the state of each sim indexed by slotID.
        for (int index = 0; index < getTelephonyManager().getActiveModemCount(); index++) {
            if (!mSimErrorState[index]) {
@@ -288,7 +287,7 @@ public class CarrierTextController {
            carrierNames[i] = "";
            subsIds[i] = subId;
            subOrderBySlot[subs.get(i).getSimSlotIndex()] = i;
            IccCardConstants.State simState = mKeyguardUpdateMonitor.getSimState(subId);
            int simState = mKeyguardUpdateMonitor.getSimState(subId);
            CharSequence carrierName = subs.get(i).getCarrierName();
            CharSequence carrierTextForSimState = getCarrierTextForSimState(simState, carrierName);
            if (DEBUG) {
@@ -298,7 +297,7 @@ public class CarrierTextController {
                allSimsMissing = false;
                carrierNames[i] = carrierTextForSimState;
            }
            if (simState == IccCardConstants.State.READY) {
            if (simState == TelephonyManager.SIM_STATE_READY) {
                ServiceState ss = mKeyguardUpdateMonitor.mServiceStates.get(subId);
                if (ss != null && ss.getDataRegState() == ServiceState.STATE_IN_SERVICE) {
                    // hack for WFC (IWLAN) not turning off immediately once
@@ -406,8 +405,7 @@ public class CarrierTextController {
     *
     * @return Carrier text if not in missing state, null otherwise.
     */
    private CharSequence getCarrierTextForSimState(IccCardConstants.State simState,
            CharSequence text) {
    private CharSequence getCarrierTextForSimState(int simState, CharSequence text) {
        CharSequence carrierText = null;
        CarrierTextController.StatusMode status = getStatusForIccState(simState);
        switch (status) {
@@ -498,37 +496,32 @@ public class CarrierTextController {
    /**
     * Determine the current status of the lock screen given the SIM state and other stuff.
     */
    private CarrierTextController.StatusMode getStatusForIccState(IccCardConstants.State simState) {
        // Since reading the SIM may take a while, we assume it is present until told otherwise.
        if (simState == null) {
            return CarrierTextController.StatusMode.Normal;
        }

    private CarrierTextController.StatusMode getStatusForIccState(int simState) {
        final boolean missingAndNotProvisioned =
                !Dependency.get(KeyguardUpdateMonitor.class).isDeviceProvisioned()
                        && (simState == IccCardConstants.State.ABSENT
                        || simState == IccCardConstants.State.PERM_DISABLED);
                        && (simState == TelephonyManager.SIM_STATE_ABSENT
                        || simState == TelephonyManager.SIM_STATE_PERM_DISABLED);

        // Assume we're NETWORK_LOCKED if not provisioned
        simState = missingAndNotProvisioned ? IccCardConstants.State.NETWORK_LOCKED : simState;
        simState = missingAndNotProvisioned ? TelephonyManager.SIM_STATE_NETWORK_LOCKED : simState;
        switch (simState) {
            case ABSENT:
            case TelephonyManager.SIM_STATE_ABSENT:
                return CarrierTextController.StatusMode.SimMissing;
            case NETWORK_LOCKED:
            case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
                return CarrierTextController.StatusMode.SimMissingLocked;
            case NOT_READY:
            case TelephonyManager.SIM_STATE_NOT_READY:
                return CarrierTextController.StatusMode.SimNotReady;
            case PIN_REQUIRED:
            case TelephonyManager.SIM_STATE_PIN_REQUIRED:
                return CarrierTextController.StatusMode.SimLocked;
            case PUK_REQUIRED:
            case TelephonyManager.SIM_STATE_PUK_REQUIRED:
                return CarrierTextController.StatusMode.SimPukLocked;
            case READY:
            case TelephonyManager.SIM_STATE_READY:
                return CarrierTextController.StatusMode.Normal;
            case PERM_DISABLED:
            case TelephonyManager.SIM_STATE_PERM_DISABLED:
                return CarrierTextController.StatusMode.SimPermDisabled;
            case UNKNOWN:
            case TelephonyManager.SIM_STATE_UNKNOWN:
                return CarrierTextController.StatusMode.SimUnknown;
            case CARD_IO_ERROR:
            case TelephonyManager.SIM_STATE_CARD_IO_ERROR:
                return CarrierTextController.StatusMode.SimIoError;
        }
        return CarrierTextController.StatusMode.SimUnknown;
@@ -575,7 +568,7 @@ public class CarrierTextController {
        return list;
    }

    private CharSequence getCarrierHelpTextForSimState(IccCardConstants.State simState,
    private CharSequence getCarrierHelpTextForSimState(int simState,
            String plmn, String spn) {
        int carrierHelpTextId = 0;
        CarrierTextController.StatusMode status = getStatusForIccState(simState);
+1 −2
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.widget.Button;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.util.EmergencyAffordanceManager;
import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.Dependency;
@@ -59,7 +58,7 @@ public class EmergencyButton extends Button {
    KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {

        @Override
        public void onSimStateChanged(int subId, int slotId, State simState) {
        public void onSimStateChanged(int subId, int slotId, int simState) {
            updateEmergencyCallButton();
        }

+3 −3
Original line number Diff line number Diff line
@@ -20,8 +20,8 @@ import static com.android.systemui.DejankUtils.whitelistIpcs;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;

import com.android.internal.telephony.IccCardConstants;
import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.Dependency;

@@ -66,12 +66,12 @@ public class KeyguardSecurityModel {
        KeyguardUpdateMonitor monitor = Dependency.get(KeyguardUpdateMonitor.class);

        if (mIsPukScreenAvailable && SubscriptionManager.isValidSubscriptionId(
                monitor.getNextSubIdForState(IccCardConstants.State.PUK_REQUIRED))) {
                monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PUK_REQUIRED))) {
            return SecurityMode.SimPuk;
        }

        if (SubscriptionManager.isValidSubscriptionId(
                monitor.getNextSubIdForState(IccCardConstants.State.PIN_REQUIRED))) {
                monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PIN_REQUIRED))) {
            return SecurityMode.SimPin;
        }

+3 −5
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ import android.view.WindowManager;
import android.widget.ImageView;

import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.telephony.PhoneConstants;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -66,10 +64,10 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {

    KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
        @Override
        public void onSimStateChanged(int subId, int slotId, State simState) {
        public void onSimStateChanged(int subId, int slotId, int simState) {
            if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
            switch(simState) {
                case READY: {
                case TelephonyManager.SIM_STATE_READY: {
                    mRemainingAttempts = -1;
                    resetState();
                    break;
@@ -157,7 +155,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {

    private void handleSubInfoChangeIfNeeded() {
        KeyguardUpdateMonitor monitor = Dependency.get(KeyguardUpdateMonitor.class);
        int subId = monitor.getNextSubIdForState(IccCardConstants.State.PIN_REQUIRED);
        int subId = monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PIN_REQUIRED);
        if (subId != mSubId && SubscriptionManager.isValidSubscriptionId(subId)) {
            mSubId = subId;
            mShowDefaultMessage = true;
+3 −5
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@ import android.view.WindowManager;
import android.widget.ImageView;

import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.telephony.PhoneConstants;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -69,12 +67,12 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {

    KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
        @Override
        public void onSimStateChanged(int subId, int slotId, State simState) {
        public void onSimStateChanged(int subId, int slotId, int simState) {
            if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
            switch(simState) {
                // If the SIM is unlocked via a key sequence through the emergency dialer, it will
                // move into the READY state and the PUK lock keyguard should be removed.
                case READY: {
                case TelephonyManager.SIM_STATE_READY: {
                    mRemainingAttempts = -1;
                    mShowDefaultMessage = true;
                    // mCallback can be null if onSimStateChanged callback is called when keyguard
@@ -210,7 +208,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {

    private void handleSubInfoChangeIfNeeded() {
        KeyguardUpdateMonitor monitor = Dependency.get(KeyguardUpdateMonitor.class);
        int subId = monitor.getNextSubIdForState(IccCardConstants.State.PUK_REQUIRED);
        int subId = monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PUK_REQUIRED);
        if (subId != mSubId && SubscriptionManager.isValidSubscriptionId(subId)) {
            mSubId = subId;
            mShowDefaultMessage = true;
Loading