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

Commit 0d56f3c8 authored by yinxu's avatar yinxu
Browse files

Add new key KEY_CARRIER_CONFIG_OVERRIDE_BOOL

When user gets the carrier config bundle, the value of this new key in
the bundle will indicate whether this bundle contains the default config
or carrier specific config.

Bug: 70400384
Test: Basic telephony sanity
Change-Id: I3480665398ad2b7517b71e808c3e4242d113ea46
parent 1801711c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -39662,6 +39662,7 @@ package android.telephony {
  public class CarrierConfigManager {
    method public android.os.PersistableBundle getConfig();
    method public android.os.PersistableBundle getConfigForSubId(int);
    method public static boolean isConfigForIdentifiedCarrier(android.os.PersistableBundle);
    method public void notifyConfigChangedForSubId(int);
    field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
    field public static final int DATA_CYCLE_THRESHOLD_DISABLED = -2; // 0xfffffffe
+35 −0
Original line number Diff line number Diff line
@@ -1694,6 +1694,13 @@ public class CarrierConfigManager {
    public static final String KEY_SPN_DISPLAY_RULE_USE_ROAMING_FROM_SERVICE_STATE_BOOL =
            "spn_display_rule_use_roaming_from_service_state_bool";

    /**
     * Determines whether any carrier has been identified and its specific config has been applied,
     * default to false.
     * @hide
     */
    public static final String KEY_CARRIER_CONFIG_APPLIED_BOOL = "carrier_config_applied_bool";

    /** The default value for every variable. */
    private final static PersistableBundle sDefaults;

@@ -1975,6 +1982,7 @@ public class CarrierConfigManager {
        sDefaults.putBoolean(KEY_IDENTIFY_HIGH_DEFINITION_CALLS_IN_CALL_LOG_BOOL, false);
        sDefaults.putBoolean(KEY_SPN_DISPLAY_RULE_USE_ROAMING_FROM_SERVICE_STATE_BOOL, false);
        sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false);
        sDefaults.putBoolean(KEY_CARRIER_CONFIG_APPLIED_BOOL, false);
    }

    /**
@@ -2019,6 +2027,33 @@ public class CarrierConfigManager {
        return getConfigForSubId(SubscriptionManager.getDefaultSubscriptionId());
    }

    /**
     * Determines whether a configuration {@link PersistableBundle} obtained from
     * {@link #getConfig()} or {@link #getConfigForSubId(int)} corresponds to an identified carrier.
     * <p>
     * When an app receives the {@link CarrierConfigManager#ACTION_CARRIER_CONFIG_CHANGED}
     * broadcast which informs it that the carrier configuration has changed, it is possible
     * that another reload of the carrier configuration has begun since the intent was sent.
     * In this case, the carrier configuration the app fetches (e.g. via {@link #getConfig()})
     * may not represent the configuration for the current carrier. It should be noted that it
     * does not necessarily mean the configuration belongs to current carrier when this function
     * return true because it may belong to another previous identified carrier. Users should
     * always call {@link #getConfig()} or {@link #getConfigForSubId(int)} after receiving the
     * broadcast {@link #ACTION_CARRIER_CONFIG_CHANGED}.
     * </p>
     * <p>
     * After using {@link #getConfig()} or {@link #getConfigForSubId(int)} an app should always
     * use this method to confirm whether any carrier specific configuration has been applied.
     * </p>
     *
     * @param bundle the configuration bundle to be checked.
     * @return boolean true if any carrier specific configuration bundle has been applied, false
     * otherwise or the bundle is null.
     */
    public static boolean isConfigForIdentifiedCarrier(PersistableBundle bundle) {
        return bundle != null && bundle.getBoolean(KEY_CARRIER_CONFIG_APPLIED_BOOL);
    }

    /**
     * Calling this method triggers telephony services to fetch the current carrier configuration.
     * <p>