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

Commit f8c6f348 authored by Mattias Nilsson's avatar Mattias Nilsson
Browse files

Move config_inflateSignalStrength to CC

Sim based customizations should not be resources because
of two reasons:
1. The MCC/MNC value in AssetManager for Dual sim devices is undefined
2. There is no support for MVNOs.

For dual sim devices there is only one value for MCC/MNC in
AssetManager and that value is updated from multiple places without
deciding if it should be the default voice sim card, the default
data sim card or whatnot.
  This means that when frameworks is trying to decide what resource
to use there is no guarantee that the resource that arrives is for
the particular subscription we are asking for.

MVNOs cannot be separated through only MCC/MNC but need more
parameters like service provider, imsi, GID1 etc. MVNO support
is available in CarrierConfig.

When we now have support for ADCP updates of customizations and
start using carrier id this is better placed in CarrierConfig,
we then get support for MVNOs at the same time.

Bug: 148483577
Test: Customize for sim card x and not for sim card y, insert both
sim cards in a dual sim device and see the difference.

Merged-In: I067d55b9ae5e1346dd3b3cd50a0097b05b100055
Change-Id: I067d55b9ae5e1346dd3b3cd50a0097b05b100055
parent 1720916a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
package com.android.settingslib.net;

import android.content.Context;
import android.telephony.SubscriptionManager;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;

/**
 * Utilities for dealing with signal strength.
@@ -28,7 +29,13 @@ public class SignalStrengthUtil {
     * bar for the subscription with the given id
     */
    public static boolean shouldInflateSignalStrength(Context context, int subscriptionId) {
        return SubscriptionManager.getResourcesForSubId(context, subscriptionId)
                .getBoolean(com.android.internal.R.bool.config_inflateSignalStrength);
        final CarrierConfigManager carrierConfigMgr =
                context.getSystemService(CarrierConfigManager.class);
        PersistableBundle bundle = null;
        if (carrierConfigMgr != null) {
            bundle = carrierConfigMgr.getConfigForSubId(subscriptionId);
        }
        return (bundle != null && bundle.getBoolean(
                CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false));
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -1157,7 +1157,6 @@ public class NetworkControllerImpl extends BroadcastReceiver
        boolean show4gForLte = false;
        boolean hideLtePlus = false;
        boolean hspaDataDistinguishable;
        boolean inflateSignalStrengths = false;
        boolean alwaysShowDataRatIcon = false;

        static Config readConfig(Context context) {
@@ -1169,8 +1168,6 @@ public class NetworkControllerImpl extends BroadcastReceiver
                    res.getBoolean(com.android.internal.R.bool.config_alwaysUseCdmaRssi);
            config.hspaDataDistinguishable =
                    res.getBoolean(R.bool.config_hspa_data_distinguishable);
            config.inflateSignalStrengths = res.getBoolean(
                    com.android.internal.R.bool.config_inflateSignalStrength);

            CarrierConfigManager configMgr = (CarrierConfigManager)
                    context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
+10 −0
Original line number Diff line number Diff line
@@ -1085,6 +1085,15 @@ public class CarrierConfigManager {
    public static final String KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL =
        "show_signal_strength_in_sim_status_bool";

    /**
     * Flag specifying if we should interpret all signal strength as one bar higher
     * This is a replacement for the resource config_inflateSignalStrength
     * The default value is false.
     * @hide
     */
    public static final String KEY_INFLATE_SIGNAL_STRENGTH_BOOL =
            "inflate_signal_strength_bool";

    /**
     * Flag specifying whether an additional (client initiated) intent needs to be sent on System
     * update
@@ -3915,6 +3924,7 @@ public class CarrierConfigManager {
        sDefaults.putStringArray(KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY, null);
        sDefaults.putBoolean(KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false);
        sDefaults.putBoolean(KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, true);
        sDefaults.putBoolean(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false);
        sDefaults.putBoolean(KEY_CI_ACTION_ON_SYS_UPDATE_BOOL, false);
        sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, "");
        sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, "");