summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Torbjorn Eklund <torbjorn.eklund@sony.com> 2019-02-13 16:42:16 +0100
committer Jack Yu <jackyu@google.com> 2019-12-10 06:51:38 +0000
commit074e97d45eb82db9267d0908447a2abc33380982 (patch)
tree5b5dca08a5d64fb88f5874fb5f0bde351649ebde
parentba206b8f353c124a160348742a5403045ce41ed0 (diff)
CarrierConfigManager: Adds API for persistent override of values
Adds an API in CarrierConfigManager for persistent override of carrier config values. Bug: 144544956 Test: Manual Merged-In: I50618921d1ec522d5cd0bd71a5f8e0b1877f1ce1 Change-Id: I50618921d1ec522d5cd0bd71a5f8e0b1877f1ce1
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java30
-rw-r--r--telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl2
2 files changed, 30 insertions, 2 deletions
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index c0e03a738fb1..8c6e643e7b2b 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -3745,6 +3745,34 @@ public class CarrierConfigManager {
@SystemApi
@TestApi
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 {
ICarrierConfigLoader loader = getICarrierConfigLoader();
if (loader == null) {
@@ -3752,7 +3780,7 @@ public class CarrierConfigManager {
+ " ICarrierConfigLoader is null");
return;
}
- loader.overrideConfig(subscriptionId, overrideValues);
+ loader.overrideConfig(subscriptionId, overrideValues, persistent);
} catch (RemoteException ex) {
Rlog.e(TAG, "Error setting config for subId " + subscriptionId + ": "
+ ex.toString());
diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
index 8e50a8f9d7d5..4e79660df479 100644
--- a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
+++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
@@ -26,7 +26,7 @@ interface ICarrierConfigLoader {
@UnsupportedAppUsage
PersistableBundle getConfigForSubId(int subId, String callingPackage);
- void overrideConfig(int subId, in PersistableBundle overrides);
+ void overrideConfig(int subId, in PersistableBundle overrides, boolean persistent);
void notifyConfigChangedForSubId(int subId);