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

Commit 42943cab authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes I577dd4ec,I23db0581,I91993a8e,I05ad5e12 into main

* changes:
  Support group disabled bit correctly
  Initialized allowed network types
  Fixed crash during eSIM activation
  Fixed display name not persisted
parents b62ecd70 a2943446
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -2460,7 +2460,15 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        }
    }

    private String convertAllowedNetworkTypeMapIndexToDbName(int reason) {
    /**
     * Convert the allowed network types reason to string.
     *
     * @param reason The allowed network types reason.
     *
     * @return The converted string.
     */
    public static String convertAllowedNetworkTypeMapIndexToDbName(
            @TelephonyManager.AllowedNetworkTypesReason int reason) {
        switch (reason) {
            case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER:
                return ALLOWED_NETWORK_TYPES_TEXT_USER;
+32 −8
Original line number Diff line number Diff line
@@ -1221,8 +1221,8 @@ public class SubscriptionDatabaseManager extends Handler {
        try {
            SubscriptionInfoInternal subInfoCache = mAllSubscriptionInfoInternalCache.get(subId);
            if (subInfoCache == null) {
                throw new IllegalArgumentException("Subscription doesn't exist. subId=" + subId
                        + ", columnName=cardId");
                throw new IllegalArgumentException("setCardId: Subscription doesn't exist. subId="
                        + subId);
            }
            mAllSubscriptionInfoInternalCache.put(subId,
                    new SubscriptionInfoInternal.Builder(subInfoCache)
@@ -1763,6 +1763,36 @@ public class SubscriptionDatabaseManager extends Handler {
                SubscriptionInfoInternal.Builder::setSatelliteEnabled);
    }

    /**
     * Set whether group of the subscription is disabled. This is only useful if it's a grouped
     * opportunistic subscription. In this case, if all primary (non-opportunistic)
     * subscriptions in the group are deactivated (unplugged pSIM or deactivated eSIM profile),
     * we should disable this opportunistic subscription.
     *
     * @param subId Subscription id.
     * @param isGroupDisabled if group of the subscription is disabled.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setGroupDisabled(int subId, boolean isGroupDisabled) {
        // group disabled does not have a corresponding SimInfo column. So we only update the cache.

        // Grab the write lock so no other threads can read or write the cache.
        mReadWriteLock.writeLock().lock();
        try {
            SubscriptionInfoInternal subInfoCache = mAllSubscriptionInfoInternalCache.get(subId);
            if (subInfoCache == null) {
                throw new IllegalArgumentException("setGroupDisabled: Subscription doesn't exist. "
                        + "subId=" + subId);
            }
            mAllSubscriptionInfoInternalCache.put(subId,
                    new SubscriptionInfoInternal.Builder(subInfoCache)
                            .setGroupDisabled(isGroupDisabled).build());
        } finally {
            mReadWriteLock.writeLock().unlock();
        }
    }

    /**
     * Load the entire database into the cache.
     */
@@ -2004,12 +2034,6 @@ public class SubscriptionDatabaseManager extends Handler {
        }
    }

    /**
     * @return {@code true} if the database has been loaded into the cache.
     */
    public boolean isDatabaseLoaded() {
        return mDatabaseLoaded;
    }
    /**
     * Log debug messages.
     *
+120 −82

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -1126,6 +1126,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    @SmallTest
    public void testGetEmptyIccCard() {
        doReturn(null).when(mUiccController).getUiccProfileForPhone(anyInt());
        doReturn(null).when(mUiccController).getUiccSlotForPhone(anyInt());

        IccCard iccCard = mPhoneUT.getIccCard();

+6 −1
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ public abstract class TelephonyTest {
    protected ImsPhoneCallTracker mImsCT;
    protected UiccController mUiccController;
    protected UiccProfile mUiccProfile;
    protected UiccSlot mUiccSlot;
    protected CallManager mCallManager;
    protected PhoneNotifier mNotifier;
    protected TelephonyComponentFactory mTelephonyComponentFactory;
@@ -415,6 +416,7 @@ public abstract class TelephonyTest {
        mImsCT = Mockito.mock(ImsPhoneCallTracker.class);
        mUiccController = Mockito.mock(UiccController.class);
        mUiccProfile = Mockito.mock(UiccProfile.class);
        mUiccSlot = Mockito.mock(UiccSlot.class);
        mCallManager = Mockito.mock(CallManager.class);
        mNotifier = Mockito.mock(PhoneNotifier.class);
        mTelephonyComponentFactory = Mockito.mock(TelephonyComponentFactory.class);
@@ -521,6 +523,8 @@ public abstract class TelephonyTest {
        mPhone.mCi = mSimulatedCommands;
        mCT.mCi = mSimulatedCommands;
        doReturn(mUiccCard).when(mPhone).getUiccCard();
        doReturn(mUiccCard).when(mUiccSlot).getUiccCard();
        doReturn(mUiccCard).when(mUiccController).getUiccCardForPhone(anyInt());
        doReturn(mUiccPort).when(mPhone).getUiccPort();
        doReturn(mUiccProfile).when(mUiccPort).getUiccProfile();

@@ -662,7 +666,8 @@ public abstract class TelephonyTest {
                }
            }
        }).when(mUiccController).getIccRecords(anyInt(), anyInt());
        doReturn(new UiccSlot[] {}).when(mUiccController).getUiccSlots();
        doReturn(new UiccSlot[] {mUiccSlot}).when(mUiccController).getUiccSlots();
        doReturn(mUiccSlot).when(mUiccController).getUiccSlotForPhone(anyInt());
        doReturn(mPinStorage).when(mUiccController).getPinStorage();

        //UiccCardApplication
Loading