diff options
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/test-current.txt | 4 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CarrierConfigManager.java | 42 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl | 2 |
4 files changed, 46 insertions, 3 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 89ac7210de46..0c15b9bb6660 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5067,6 +5067,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"; } diff --git a/api/test-current.txt b/api/test-current.txt index a7bb467e6141..890482eb0655 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -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"; } diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 6eaecc6760bc..c84e4a9b0593 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -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; @@ -1208,8 +1210,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"; @@ -1257,7 +1259,7 @@ public class CarrierConfigManager { * network as part of the Setup Wizard flow. * @hide */ - public static final String KEY_CARRIER_SETUP_APP_STRING = "carrier_setup_app_string"; + public static final String KEY_CARRIER_SETUP_APP_STRING = "carrier_setup_app_string"; /** * Defines carrier-specific actions which act upon @@ -2519,6 +2521,40 @@ public class CarrierConfigManager { } /** + * 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 * called to confirm whether any carrier specific configuration has been applied. diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl index d9471ae2c60d..5cd67d977ad5 100644 --- a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl +++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl @@ -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); |