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

Commit c787c82a authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topics "rename_display_name_source", "sdbm"

* changes:
  Renamed name source to display name source
  Delete unused intents.
  Added SubscriptionDatabaseManager
parents 3c98586f b20a3e56
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ public class CarrierResolver extends Handler {
    /**
     * This is triggered from SubscriptionInfoUpdater after sim state change.
     * The sequence of sim loading would be
     *  1. ACTION_SUBINFO_CONTENT_CHANGE
     *  1. OnSubscriptionsChangedListener
     *  2. ACTION_SIM_STATE_CHANGED/ACTION_SIM_CARD_STATE_CHANGED
     *  /ACTION_SIM_APPLICATION_STATE_CHANGED
     *  3. ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
+3 −17
Original line number Diff line number Diff line
@@ -496,17 +496,6 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    /**
     * Broadcast when SubscriptionInfo has changed
     * FIXME: Hopefully removed if the API council accepts SubscriptionInfoListener
     */
     private void broadcastSimInfoContentChanged() {
        Intent intent = new Intent(TelephonyIntents.ACTION_SUBINFO_CONTENT_CHANGE);
        mContext.sendBroadcast(intent);
        intent = new Intent(TelephonyIntents.ACTION_SUBINFO_RECORD_UPDATED);
        mContext.sendBroadcast(intent);
     }

    /**
     * Notify the changed of subscription info.
     */
@@ -518,9 +507,6 @@ public class SubscriptionController extends ISub.Stub {
        if (DBG) logd("notifySubscriptionInfoChanged:");
        trm.notifySubscriptionInfoChanged();

        // FIXME: Remove if listener technique accepted.
        broadcastSimInfoContentChanged();

        MultiSimSettingController.getInstance().notifySubscriptionInfoChanged();
        TelephonyMetrics metrics = TelephonyMetrics.getInstance();
        List<SubscriptionInfo> subInfos;
@@ -553,7 +539,7 @@ public class SubscriptionController extends ISub.Stub {
                        SubscriptionManager.DISPLAY_NAME)))
                .setCarrierName(cursor.getString(cursor.getColumnIndexOrThrow(
                        SubscriptionManager.CARRIER_NAME)))
                .setNameSource(cursor.getInt(cursor.getColumnIndexOrThrow(
                .setDisplayNameSource(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SubscriptionManager.NAME_SOURCE)))
                .setIconTint(cursor.getInt(cursor.getColumnIndexOrThrow(
                        SubscriptionManager.HUE)))
@@ -1941,7 +1927,7 @@ public class SubscriptionController extends ISub.Stub {

        String spn;

        switch (subInfo.getNameSource()) {
        switch (subInfo.getDisplayNameSource()) {
            case SubscriptionManager.NAME_SOURCE_SIM_PNN:
                String pnn = phone.getPlmn();
                return !TextUtils.isEmpty(pnn);
@@ -2009,7 +1995,7 @@ public class SubscriptionController extends ISub.Stub {
            // if there is no sub in the db, return 0 since subId does not exist in db
            if (allSubInfo == null || allSubInfo.isEmpty()) return 0;
            for (SubscriptionInfo subInfo : allSubInfo) {
                int subInfoNameSource = subInfo.getNameSource();
                int subInfoNameSource = subInfo.getDisplayNameSource();
                boolean isHigherPriority = (getNameSourcePriority(subInfoNameSource)
                        > getNameSourcePriority(nameSource));
                boolean isEqualPriorityAndName = (getNameSourcePriority(subInfoNameSource)
+3 −2
Original line number Diff line number Diff line
@@ -612,7 +612,8 @@ public class SubscriptionInfoUpdater extends Handler {

        /**
         * The sim loading sequence will be
         *  1. ACTION_SUBINFO_CONTENT_CHANGE happens through updateSubscriptionInfoByIccId() above.
         *  1. OnSubscriptionsChangedListener is called through updateSubscriptionInfoByIccId()
         *  above.
         *  2. ACTION_SIM_STATE_CHANGED/ACTION_SIM_CARD_STATE_CHANGED
         *  /ACTION_SIM_APPLICATION_STATE_CHANGED
         *  3. ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED
@@ -1017,7 +1018,7 @@ public class SubscriptionInfoUpdater extends Handler {
                mSubscriptionController.insertEmptySubInfoRecord(
                        embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED);
            } else {
                nameSource = existingSubscriptions.get(index).getNameSource();
                nameSource = existingSubscriptions.get(index).getDisplayNameSource();
                prevCarrierId = existingSubscriptions.get(index).getCarrierId();
                existingSubscriptions.remove(index);
            }
+4 −3
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.SettingsObserver;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.data.DataConfigManager.DataConfigManagerCallback;
import com.android.internal.telephony.util.TelephonyUtils;
import com.android.telephony.Rlog;

import java.io.FileDescriptor;
@@ -618,7 +619,7 @@ public class DataSettingsManager extends Handler {
                .collect(Collectors.joining(","));
        if (SubscriptionController.getInstance().setEnabledMobileDataPolicies(
                mSubId, enabledMobileDataPolicies)) {
            logl(DataUtils.mobileDataPolicyToString(mobileDataPolicy) + " changed to "
            logl(TelephonyUtils.mobileDataPolicyToString(mobileDataPolicy) + " changed to "
                    + enable);
            updateDataEnabledAndNotify(TelephonyManager.DATA_ENABLED_REASON_OVERRIDE);
            notifyDataEnabledOverrideChanged(enable, mobileDataPolicy);
@@ -761,7 +762,7 @@ public class DataSettingsManager extends Handler {
                + ", mIsDataEnabled=" + mIsDataEnabled
                + ", mDataEnabledSettings=" + mDataEnabledSettings
                + ", mEnabledMobileDataPolicy=" + mEnabledMobileDataPolicy.stream()
                .map(DataUtils::mobileDataPolicyToString).collect(Collectors.joining(","))
                .map(TelephonyUtils::mobileDataPolicyToString).collect(Collectors.joining(","))
                + "]";
    }

@@ -818,7 +819,7 @@ public class DataSettingsManager extends Handler {
                        dataEnabledChangedReasonToString(entry.getKey()) + "=" + entry.getValue())
                .collect(Collectors.joining(", ")));
        pw.println("mEnabledMobileDataPolicy=" + mEnabledMobileDataPolicy.stream()
                .map(DataUtils::mobileDataPolicyToString).collect(Collectors.joining(",")));
                .map(TelephonyUtils::mobileDataPolicyToString).collect(Collectors.joining(",")));
        pw.println("Local logs:");
        pw.increaseIndent();
        mLocalLog.dump(fd, pw, args);
+0 −19
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.telephony.Annotation.NetCapability;
import android.telephony.Annotation.NetworkType;
import android.telephony.Annotation.ValidationStatus;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager.MobileDataPolicy;
import android.telephony.data.ApnSetting;
import android.telephony.data.ApnSetting.ApnType;
import android.telephony.data.DataCallResponse;
@@ -520,24 +519,6 @@ public class DataUtils {
        }
    }

    /**
     * Convert mobile data policy to string.
     *
     * @param mobileDataPolicy The mobile data policy.
     * @return The mobile data policy in string format.
     */
    public static @NonNull String mobileDataPolicyToString(@MobileDataPolicy int mobileDataPolicy) {
        switch (mobileDataPolicy) {
            case TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL:
                return "DATA_ON_NON_DEFAULT_DURING_VOICE_CALL";
            case TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED:
                return "MMS_ALWAYS_ALLOWED";
            default:
                loge("Unknown mobile data policy(" + mobileDataPolicy + ")");
                return "UNKNOWN(" + mobileDataPolicy + ")";
        }
    }

    private static void loge(String msg) {
        Rlog.e(TAG, msg);
    }
Loading