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

Commit a916cd93 authored by Jordan Liu's avatar Jordan Liu Committed by android-build-merger
Browse files

Merge "Populate EID on card/slot ready" am: 7c1aac23

am: c5ac223e

Change-Id: I71ea2134b057c4740959e7b93029e842aca5bee6
parents ccaa4647 c5ac223e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ public class UiccCard {
            "com.android.internal.telephony.uicc.ICC_CARD_ADDED";

    // The lock object is created by UiccSlot that owns this UiccCard - this is to share the lock
    // between UiccSlot, UiccCard and UiccProfile for now.
    private final Object mLock;
    // between UiccSlot, UiccCard, EuiccCard, and UiccProfile for now.
    protected final Object mLock;
    private CardState mCardState;
    private String mIccid;
    protected String mCardId;
+2 −0
Original line number Diff line number Diff line
@@ -242,6 +242,7 @@ public class UiccProfile extends IccCard {
        }

        if (mUiccCard instanceof EuiccCard) {
            // for RadioConfig<1.1 eid is not known when the EuiccCard is constructed
            ((EuiccCard) mUiccCard).registerForEidReady(mHandler, EVENT_EID_READY, null);
        }

@@ -423,6 +424,7 @@ public class UiccProfile extends IccCard {
        }

        if (mUiccCard instanceof EuiccCard && ((EuiccCard) mUiccCard).getEid() == null) {
            // for RadioConfig<1.1 the EID is not known when the EuiccCard is constructed
            if (DBG) log("EID is not ready yet.");
            return;
        }
+6 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.Message;
import android.os.PowerManager;
import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.WindowManager;

import com.android.internal.R;
@@ -115,6 +116,11 @@ public class UiccSlot extends Handler {
                if (!mIsEuicc) {
                    mUiccCard = new UiccCard(mContext, mCi, ics, mPhoneId, mLock);
                } else {
                    // The EID should be reported with the card status, but in case it's not we want
                    // to catch that here
                    if (TextUtils.isEmpty(ics.eid)) {
                        loge("update: eid is missing. ics.eid=" + ics.eid);
                    }
                    mUiccCard = new EuiccCard(mContext, mCi, ics, phoneId, mLock);
                }
            } else {
+19 −2
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ public class EuiccCard extends UiccCard {
    }

    private final ApduSender mApduSender;
    private final Object mLock = new Object();
    private RegistrantList mEidReadyRegistrants;
    private EuiccSpecVersion mSpecVersion;
    private volatile String mEid;
@@ -122,7 +121,13 @@ public class EuiccCard extends UiccCard {
        // TODO: Set supportExtendedApdu based on ATR.
        mApduSender = new ApduSender(ci, ISD_R_AID, false /* supportExtendedApdu */);

        if (TextUtils.isEmpty(ics.eid)) {
            loge("no eid given in constructor for phone " + phoneId);
            loadEidAndNotifyRegistrants();
        } else {
            mEid = ics.eid;
            mCardId = ics.eid;
        }
    }

    /**
@@ -150,6 +155,8 @@ public class EuiccCard extends UiccCard {
        }
    }

    // For RadioConfig<1.1 we don't know the EID when constructing the EuiccCard, so callers may
    // need to register to be notified when we have the EID
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected void loadEidAndNotifyRegistrants() {
        Handler euiccMainThreadHandler = new Handler();
@@ -189,6 +196,16 @@ public class EuiccCard extends UiccCard {
                (byte[] response) -> mSpecVersion, callback, handler);
    }

    @Override
    public void update(Context c, CommandsInterface ci, IccCardStatus ics) {
        synchronized (mLock) {
            if (!TextUtils.isEmpty(ics.eid)) {
                mEid = ics.eid;
            }
            super.update(c, ci, ics);
        }
    }

    @Override
    protected void updateCardId() {
        if (TextUtils.isEmpty(mEid)) {