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

Commit a82f952f authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "Add test API to override carrier config"

parents ac87c0a8 e5b1fda8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5086,6 +5086,7 @@ package android.telephony {

  public class CarrierConfigManager {
    method public static android.os.PersistableBundle getDefaultConfig();
    method public void overrideConfig(int, android.os.PersistableBundle);
    method public void updateConfigForPhoneId(int, java.lang.String);
    field public static final java.lang.String KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING = "config_plans_package_override_string";
  }
+4 −0
Original line number Diff line number Diff line
@@ -962,6 +962,10 @@ package android.telecom {

package android.telephony {

  public class CarrierConfigManager {
    method public void overrideConfig(int, android.os.PersistableBundle);
  }

  public class MbmsDownloadSession implements java.lang.AutoCloseable {
    field public static final java.lang.String MBMS_DOWNLOAD_SERVICE_OVERRIDE_METADATA = "mbms-download-service-override";
  }
+39 −3
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

package android.telephony;

import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.PersistableBundle;
@@ -1222,8 +1224,8 @@ public class CarrierConfigManager {
    public static final String KEY_SHOW_PRECISE_FAILED_CAUSE_BOOL =
            "show_precise_failed_cause_bool";

    // These variables are used by the MMS service and exposed through another API, {@link
    // SmsManager}. The variable names and string values are copied from there.
    // These variables are used by the MMS service and exposed through another API,
    // SmsManager. The variable names and string values are copied from there.
    public static final String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled";
    public static final String KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL = "allowAttachAudio";
    public static final String KEY_MMS_APPEND_TRANSACTION_ID_BOOL = "enabledTransID";
@@ -2611,6 +2613,40 @@ public class CarrierConfigManager {
        return null;
    }

    /**
     * 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 overriden values after this method returns. The overrides are effective for the lifetime
     * of the phone process.
     *
     * May throw an {@link IllegalArgumentException} if {@code overrideValues} contains invalid
     * values for the specified config keys.
     *
     * @param subscriptionId The subscription ID for which the override should be done.
     * @param overrideValues Key-value pairs of the values that are to be overriden. If null,
     *                       all previous overrides will be disabled and the config reset back to
     *                       its initial state.
     * @hide
     */
    @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
    @SystemApi
    @TestApi
    public void overrideConfig(int subscriptionId, @Nullable PersistableBundle overrideValues) {
        try {
            ICarrierConfigLoader loader = getICarrierConfigLoader();
            if (loader == null) {
                Rlog.w(TAG, "Error setting config for subId " + subscriptionId
                        + " ICarrierConfigLoader is null");
                return;
            }
            loader.overrideConfig(subscriptionId, overrideValues);
        } catch (RemoteException ex) {
            Rlog.e(TAG, "Error setting config for subId " + subscriptionId + ": "
                    + ex.toString());
        }
    }

    /**
     * Gets the configuration values for the default subscription. After using this method to get
     * the configuration bundle, {@link #isConfigForIdentifiedCarrier(PersistableBundle)} should be
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ interface ICarrierConfigLoader {

    PersistableBundle getConfigForSubId(int subId, String callingPackage);

    void overrideConfig(int subId, in PersistableBundle overrides);

    void notifyConfigChangedForSubId(int subId);

    void updateConfigForPhoneId(int phoneId, String simState);