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

Commit 8762a002 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5342135 from 30706c16 to qt-release

Change-Id: I970ca1cbcc31f23a2af0c55f0748af2846381950
parents e63b1ace 30706c16
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.system.Os;
import android.system.OsConstants;
import android.system.StructStatVfs;
import android.telephony.Rlog;
import android.text.TextUtils;

import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
import com.android.internal.telephony.cdma.EriManager;
@@ -72,18 +73,25 @@ public class TelephonyComponentFactory {
        private static final String TAG_INJECTION = "injection";
        private static final String TAG_COMPONENTS = "components";
        private static final String TAG_COMPONENT = "component";
        private static final String SYSTEM = "/system/";

        private final Set<String> mComponentNames = new HashSet<>();
        private TelephonyComponentFactory mInjectedInstance;
        private String mPackageName;
        private String mJarPath;

        private boolean isInjected() {
            return mPackageName != null && mJarPath != null;
        /**
         * @return if jar path is correctly configured to inject.
         * 1) PackageName and JarPath mustn't be empty.
         * 2) JarPath is restricted under /system only
         */
        private boolean isConfigValid() {
            return !TextUtils.isEmpty(mPackageName) && !TextUtils.isEmpty(mJarPath)
                    && mJarPath.startsWith(SYSTEM);
        }

        private void makeInjectedInstance() {
            if (isInjected()) {
            if (isConfigValid()) {
                try {
                    StructStatVfs vfs = Os.statvfs(mJarPath);
                    if ((vfs.f_flag & OsConstants.ST_RDONLY) != 0) {
@@ -222,7 +230,7 @@ public class TelephonyComponentFactory {
            mInjectedComponents = new InjectedComponents();
            mInjectedComponents.parseXml(parser);
            mInjectedComponents.makeInjectedInstance();
            Rlog.d(TAG, "Total components injected: " + (mInjectedComponents.isInjected()
            Rlog.d(TAG, "Total components injected: " + (mInjectedComponents.isConfigValid()
                    ? mInjectedComponents.mComponentNames.size() : 0));
        }
    }
+19 −7
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.internal.telephony.uicc;

import static android.telephony.TelephonyManager.UNINITIALIZED_CARD_ID;
import static android.telephony.TelephonyManager.UNSUPPORTED_CARD_ID;

import android.app.BroadcastOptions;
import android.content.Context;
import android.content.Intent;
@@ -129,6 +132,8 @@ public class UiccController extends Handler {
    // The array index is the card ID (int).
    // This mapping exists to expose card-based functionality without exposing the EID, which is
    // considered sensetive information.
    // mCardStrings is populated using values from the IccSlotStatus and IccCardStatus. For
    // HAL < 1.2, these do not contain the EID or the ICCID, so mCardStrings will be empty
    private ArrayList<String> mCardStrings;

    // This is the card ID of the default eUICC. It starts as UNINITIALIZED_CARD_ID.
@@ -214,7 +219,7 @@ public class UiccController extends Handler {

        mLauncher = new UiccStateChangedLauncher(c, this);
        mCardStrings = loadCardStrings();
        mDefaultEuiccCardId = TelephonyManager.UNINITIALIZED_CARD_ID;
        mDefaultEuiccCardId = UNINITIALIZED_CARD_ID;
    }

    private int getSlotIdFromPhoneId(int phoneId) {
@@ -556,7 +561,8 @@ public class UiccController extends Handler {

        if (eidIsNotSupported(status)) {
            // we will never get EID from the HAL, so set mDefaultEuiccCardId to UNSUPPORTED_CARD_ID
            mDefaultEuiccCardId = TelephonyManager.UNSUPPORTED_CARD_ID;
            if (DBG) log("eid is not supported");
            mDefaultEuiccCardId = UNSUPPORTED_CARD_ID;
        }
        mPhoneIdToSlotId[index] = slotId;

@@ -590,7 +596,7 @@ public class UiccController extends Handler {
        // EID may be unpopulated if RadioConfig<1.2
        // If so, just register for EID loaded and skip this stuff
        if (isEuicc && cardString == null
                && mDefaultEuiccCardId != TelephonyManager.UNSUPPORTED_CARD_ID) {
                && mDefaultEuiccCardId != UNSUPPORTED_CARD_ID) {
            ((EuiccCard) card).registerForEidReady(this, EVENT_EID_READY, index);
        }

@@ -634,18 +640,24 @@ public class UiccController extends Handler {
     * to match to a card ID.
     *
     * @return the matching cardId, or UNINITIALIZED_CARD_ID if the card string does not map to a
     * currently loaded cardId
     * currently loaded cardId, or UNSUPPORTED_CARD_ID if the device does not support card IDs
     */
    public int convertToPublicCardId(String cardString) {
        if (mDefaultEuiccCardId == UNSUPPORTED_CARD_ID) {
            // even if cardString is not an EID, if EID is not supported (e.g. HAL < 1.2) we can't
            // guarentee a working card ID implementation, so return UNSUPPORTED_CARD_ID
            return UNSUPPORTED_CARD_ID;
        }
        if (TextUtils.isEmpty(cardString)) {
            return TelephonyManager.UNINITIALIZED_CARD_ID;
            return UNINITIALIZED_CARD_ID;
        }

        if (cardString.length() < EID_LENGTH) {
            cardString = IccUtils.stripTrailingFs(cardString);
        }
        int id = mCardStrings.indexOf(cardString);
        if (id == -1) {
            return TelephonyManager.UNINITIALIZED_CARD_ID;
            return UNINITIALIZED_CARD_ID;
        } else {
            return id;
        }
@@ -920,7 +932,7 @@ public class UiccController extends Handler {
        // set mCardStrings and the defaultEuiccCardId using the now available EID
        String eid = ((EuiccCard) card).getEid();
        addCardId(eid);
        if (mDefaultEuiccCardId == TelephonyManager.UNINITIALIZED_CARD_ID) {
        if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID) {
            // TODO(b/122738148) the default eUICC should not be removable
            mDefaultEuiccCardId = convertToPublicCardId(eid);
            log("onEidReady: eid=" + eid + " slot=" + slotId + " mDefaultEuiccCardId="
+2 −2
Original line number Diff line number Diff line
@@ -1844,7 +1844,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                sst.mSS.getNetworkRegistrationState(NetworkRegistrationState.DOMAIN_PS,
                        TransportType.WWAN);
        assertEquals(lteVopsSupportInfo,
                sSnetworkRegistrationState.getDataSpecificStates().lteVopsSupportInfo);
                sSnetworkRegistrationState.getDataSpecificStates().getLteVopsSupportInfo());

        lteVopsSupportInfo =
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
@@ -1862,6 +1862,6 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        sSnetworkRegistrationState =
                sst.mSS.getNetworkRegistrationState(2, 1);
        assertEquals(lteVopsSupportInfo,
                sSnetworkRegistrationState.getDataSpecificStates().lteVopsSupportInfo);
                sSnetworkRegistrationState.getDataSpecificStates().getLteVopsSupportInfo());
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -109,8 +109,9 @@ public class UiccControllerTest extends TelephonyTest {
                mIccCardStatus.mImsSubscriptionAppIndex =
                        mIccCardStatus.mGsmUmtsSubscriptionAppIndex = -1;
        mSimulatedCommands.setIccCardStatus(mIccCardStatus);
        // slotIndex should be invalid when testing with older versions (before 1.2) of hal
        mIccCardStatus.physicalSlotIndex = UiccController.INVALID_SLOT_ID;
        // for testing we pretend slotIndex is set. In reality it would be invalid on older versions
        // (before 1.2) of hal
        mIccCardStatus.physicalSlotIndex = 0;
        mUiccControllerHandlerThread = new UiccControllerHandlerThread(TAG);
        mUiccControllerHandlerThread.start();
        waitUntilReady();
@@ -235,6 +236,7 @@ public class UiccControllerTest extends TelephonyTest {
        ics.atr = "abcdef0123456789abcdef";
        ics.iccid = "123451234567890";
        ics.eid = "A1B2C3D4";
        ics.physicalSlotIndex = 0;
        AsyncResult ar = new AsyncResult(null, ics, null);
        Message msg = Message.obtain(mUiccControllerUT, EVENT_GET_ICC_STATUS_DONE, ar);
        mUiccControllerUT.handleMessage(msg);
@@ -325,6 +327,7 @@ public class UiccControllerTest extends TelephonyTest {
        ics.setUniversalPinState(3 /* disabled */);
        ics.atr = "abcdef0123456789abcdef";
        ics.iccid = "123451234567890";
        ics.physicalSlotIndex = 0;
        AsyncResult ar = new AsyncResult(null, ics, null);
        Message msg = Message.obtain(mUiccControllerUT, EVENT_GET_ICC_STATUS_DONE, ar);
        mUiccControllerUT.handleMessage(msg);