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

Commit 2da6d071 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed SIM issues

1. Enable UICC application by default in new subscription.
2. Fixed slot/sub mapping table not updated when SIM inserted.
3. Fixed crash in getSubscriptionProperty by not throwing
   IllegalArgumentException when provided subId is invalid (for
   backward compatibility).
4. Filled in the missing field when SIM is loaded.
5. Added icon tint support.
6. Signal MultiSimSettingsController when subscriptions are all
   loaded.
7. Fixed a crash in getActiveSubscriptionInfo.

Bug: 239607619
Test: Manual test with single SIM + atest FrameworksTelephonyTests
Merged-In: I3a9c901443e1aa85edd289f3b0d41ab9b19dc2f1
Change-Id: I3a9c901443e1aa85edd289f3b0d41ab9b19dc2f1
parent 0cf4b000
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4664,6 +4664,8 @@ public class GsmCdmaPhone extends Phone {
                    IccUtils.stripTrailingFs(iccId));
        }

        logd("reapplyUiccAppsEnablementIfNeeded: retries=" + retries + ", subInfo=" + info);

        // If info is null, it could be a new subscription. By default we enable it.
        boolean expectedValue = info == null || info.areUiccApplicationsEnabled();

+1 −3
Original line number Diff line number Diff line
@@ -609,9 +609,7 @@ public class PhoneFactory {
        pw.decreaseIndent();
        pw.println("++++++++++++++++++++++++++++++++");

        if (isSubscriptionManagerServiceEnabled()) {
            SubscriptionManagerService.getInstance().dump(fd, pw, args);
        } else {
        if (!isSubscriptionManagerServiceEnabled()) {
            pw.println("SubscriptionController:");
            pw.increaseIndent();
            try {
+2 −1
Original line number Diff line number Diff line
@@ -4674,7 +4674,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    mRILDefaultWorkSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
                riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
                        + " " + enable);
            }

            try {
+5 −3
Original line number Diff line number Diff line
@@ -2768,9 +2768,11 @@ public class ServiceStateTracker extends Handler {
            mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);

            if (mPhone.isSubscriptionManagerServiceEnabled()) {
                mSubscriptionManagerService.setCarrierName(mPhone.getSubId(),
                        TextUtils.emptyIfNull(getCarrierName(data.shouldShowPlmn(), data.getPlmn(),
                if (SubscriptionManager.isValidSubscriptionId(subId)) {
                    mSubscriptionManagerService.setCarrierName(subId, TextUtils.emptyIfNull(
                            getCarrierName(data.shouldShowPlmn(), data.getPlmn(),
                                    data.shouldShowSpn(), data.getSpn())));
                }
            } else {
                if (!mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(),
                        data.shouldShowPlmn(), data.getPlmn(), data.shouldShowSpn(),
+39 −1
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -66,6 +67,8 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
 * The subscription database manager is the wrapper of {@link SimInfo}
@@ -618,7 +621,8 @@ public class SubscriptionDatabaseManager extends Handler {
    public Object getSubscriptionProperty(int subId, @NonNull String columnName) {
        SubscriptionInfoInternal subInfo = getSubscriptionInfoInternal(subId);
        if (subInfo == null) {
            throw new IllegalArgumentException("Invalid subId " + subId);
            throw new IllegalArgumentException("getSubscriptionProperty: Invalid subId " + subId
                    + ", columnName=" + columnName);
        }

        return getSubscriptionInfoFieldByColumnName(subInfo, columnName);
@@ -907,6 +911,10 @@ public class SubscriptionDatabaseManager extends Handler {
                            mAllSubscriptionInfoInternalCache.put(id, builder.build());
                            mCallback.invokeFromExecutor(()
                                    -> mCallback.onSubscriptionChanged(subId));
                            if (columnName.equals(SimInfo.COLUMN_UICC_APPLICATIONS_ENABLED)) {
                                mCallback.invokeFromExecutor(()
                                        -> mCallback.onUiccApplicationsEnabled(subId));
                            }
                        }
                    }
                }
@@ -1094,6 +1102,21 @@ public class SubscriptionDatabaseManager extends Handler {
                SubscriptionInfoInternal.Builder::setMnc);
    }

    /**
     * Set EHPLMNs associated with the subscription.
     *
     * @param subId Subscription id.
     * @param ehplmns EHPLMNs associated with the subscription.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setEhplmns(int subId, @NonNull String[] ehplmns) {
        Objects.requireNonNull(ehplmns);
        setEhplmns(subId, Arrays.stream(ehplmns)
                .filter(Predicate.not(TextUtils::isEmpty))
                .collect(Collectors.joining(",")));
    }

    /**
     * Set EHPLMNs associated with the subscription.
     *
@@ -1108,6 +1131,21 @@ public class SubscriptionDatabaseManager extends Handler {
                SubscriptionInfoInternal.Builder::setEhplmns);
    }

    /**
     * Set HPLMNs associated with the subscription.
     *
     * @param subId Subscription id.
     * @param hplmns HPLMNs associated with the subscription.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setHplmns(int subId, @NonNull String[] hplmns) {
        Objects.requireNonNull(hplmns);
        setHplmns(subId, Arrays.stream(hplmns)
                .filter(Predicate.not(TextUtils::isEmpty))
                .collect(Collectors.joining(",")));
    }

    /**
     * Set HPLMNs associated with the subscription.
     *
Loading