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

Commit 4af3ae96 authored by Torbjorn Eklund's avatar Torbjorn Eklund Committed by Jack Yu
Browse files

CarrierConfigManager: Adds API for persistent override of values

Adds an API in CarrierConfigManager for persistent override of carrier
config values.

Bug: 144544956
Test: Manual
Change-Id: I50618921d1ec522d5cd0bd71a5f8e0b1877f1ce1
parent ec10f333
Loading
Loading
Loading
Loading
+29 −1
Original line number Original line Diff line number Diff line
@@ -3876,6 +3876,34 @@ public class CarrierConfigManager {
    @SystemApi
    @SystemApi
    @TestApi
    @TestApi
    public void overrideConfig(int subscriptionId, @Nullable PersistableBundle overrideValues) {
    public void overrideConfig(int subscriptionId, @Nullable PersistableBundle overrideValues) {
        overrideConfig(subscriptionId, overrideValues, false);
    }

    /**
     * Overrides the carrier config of the provided subscription ID with the provided values.
     *
     * Any further queries to carrier config from any process will return the overridden values
     * after this method returns. The overrides are effective until the user passes in {@code null}
     * for {@code overrideValues}. This removes all previous overrides and sets the carrier config
     * back to production values.
     *
     * The overrides is stored persistently and will survive a reboot if {@code persistent} is true.
     *
     * May throw an {@link IllegalArgumentException} if {@code overrideValues} contains invalid
     * values for the specified config keys.
     *
     * NOTE: This API is meant for testing purposes only.
     *
     * @param subscriptionId The subscription ID for which the override should be done.
     * @param overrideValues Key-value pairs of the values that are to be overridden. If set to
     *                       {@code null}, this will remove all previous overrides and set the
     *                       carrier configuration back to production values.
     * @param persistent     Determines whether the override should be persistent.
     * @hide
     */
    @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
    public void overrideConfig(int subscriptionId, @Nullable PersistableBundle overrideValues,
            boolean persistent) {
        try {
        try {
            ICarrierConfigLoader loader = getICarrierConfigLoader();
            ICarrierConfigLoader loader = getICarrierConfigLoader();
            if (loader == null) {
            if (loader == null) {
@@ -3883,7 +3911,7 @@ public class CarrierConfigManager {
                        + " ICarrierConfigLoader is null");
                        + " ICarrierConfigLoader is null");
                return;
                return;
            }
            }
            loader.overrideConfig(subscriptionId, overrideValues);
            loader.overrideConfig(subscriptionId, overrideValues, persistent);
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            Rlog.e(TAG, "Error setting config for subId " + subscriptionId + ": "
            Rlog.e(TAG, "Error setting config for subId " + subscriptionId + ": "
                    + ex.toString());
                    + ex.toString());
+1 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,7 @@ interface ICarrierConfigLoader {
    PersistableBundle getConfigForSubIdWithFeature(int subId, String callingPackage,
    PersistableBundle getConfigForSubIdWithFeature(int subId, String callingPackage,
            String callingFeatureId);
            String callingFeatureId);


    void overrideConfig(int subId, in PersistableBundle overrides);
    void overrideConfig(int subId, in PersistableBundle overrides, boolean persistent);


    void notifyConfigChangedForSubId(int subId);
    void notifyConfigChangedForSubId(int subId);