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

Commit 25bb1447 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Share lock object between UiccSlot, UiccCard and UiccProfile." into pi-dev

parents 1d923603 98a7a2b7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ public class TelephonyComponentFactory {
     * Create a new UiccProfile object.
     */
    public UiccProfile makeUiccProfile(Context context, CommandsInterface ci, IccCardStatus ics,
                                       int phoneId, UiccCard uiccCard) {
        return new UiccProfile(context, ci, ics, phoneId, uiccCard);
                                       int phoneId, UiccCard uiccCard, Object lock) {
        return new UiccProfile(context, ci, ics, phoneId, uiccCard, lock);
    }

    public EriManager makeEriManager(Phone phone, Context context, int eriFileSource) {
+6 −3
Original line number Diff line number Diff line
@@ -46,7 +46,9 @@ public class UiccCard {
    public static final String EXTRA_ICC_CARD_ADDED =
            "com.android.internal.telephony.uicc.ICC_CARD_ADDED";

    private final Object mLock = new Object();
    // 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;
    private CardState mCardState;
    private String mIccid;
    protected String mCardId;
@@ -55,10 +57,11 @@ public class UiccCard {
    private CommandsInterface mCi;
    private final int mPhoneId;

    public UiccCard(Context c, CommandsInterface ci, IccCardStatus ics, int phoneId) {
    public UiccCard(Context c, CommandsInterface ci, IccCardStatus ics, int phoneId, Object lock) {
        if (DBG) log("Creating");
        mCardState = ics.mCardState;
        mPhoneId = phoneId;
        mLock = lock;
        update(c, ci, ics);
    }

@@ -83,7 +86,7 @@ public class UiccCard {
            if (mCardState != CardState.CARDSTATE_ABSENT) {
                if (mUiccProfile == null) {
                    mUiccProfile = TelephonyComponentFactory.getInstance().makeUiccProfile(
                            mContext, mCi, ics, mPhoneId, this);
                            mContext, mCi, ics, mPhoneId, this, mLock);
                } else {
                    mUiccProfile.update(mContext, mCi, ics);
                }
+5 −2
Original line number Diff line number Diff line
@@ -89,7 +89,9 @@ public class UiccProfile extends IccCard {

    private static final String OPERATOR_BRAND_OVERRIDE_PREFIX = "operator_branding_";

    private final Object mLock = new Object();
    // The lock object is created by UiccSlot that owns the UiccCard that owns this UiccProfile.
    // This is to share the lock between UiccSlot, UiccCard and UiccProfile for now.
    private final Object mLock;
    private PinState mUniversalPinState;
    private int mGsmUmtsSubscriptionAppIndex;
    private int mCdmaSubscriptionAppIndex;
@@ -226,8 +228,9 @@ public class UiccProfile extends IccCard {
    };

    public UiccProfile(Context c, CommandsInterface ci, IccCardStatus ics, int phoneId,
            UiccCard uiccCard) {
            UiccCard uiccCard, Object lock) {
        if (DBG) log("Creating profile");
        mLock = lock;
        mUiccCard = uiccCard;
        mPhoneId = phoneId;
        // set current app type based on phone type - do this before calling update() as that
+2 −2
Original line number Diff line number Diff line
@@ -112,9 +112,9 @@ public class UiccSlot extends Handler {
                }

                if (!mIsEuicc) {
                    mUiccCard = new UiccCard(mContext, mCi, ics, mPhoneId);
                    mUiccCard = new UiccCard(mContext, mCi, ics, mPhoneId, mLock);
                } else {
                    mUiccCard = new EuiccCard(mContext, mCi, ics, phoneId);
                    mUiccCard = new EuiccCard(mContext, mCi, ics, phoneId, mLock);
                }
            } else {
                if (mUiccCard != null) {
+2 −2
Original line number Diff line number Diff line
@@ -116,8 +116,8 @@ public class EuiccCard extends UiccCard {
    private EuiccSpecVersion mSpecVersion;
    private volatile String mEid;

    public EuiccCard(Context c, CommandsInterface ci, IccCardStatus ics, int phoneId) {
        super(c, ci, ics, phoneId);
    public EuiccCard(Context c, CommandsInterface ci, IccCardStatus ics, int phoneId, Object lock) {
        super(c, ci, ics, phoneId, lock);
        // TODO: Set supportExtendedApdu based on ATR.
        mApduSender = new ApduSender(ci, ISD_R_AID, false /* supportExtendedApdu */);

Loading