aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanabu, shimoda <manabu.x.shimoda@sonymobile.com>2017-10-06 15:39:36 +0900
committertakeshi tanigawa <takeshi.tanigawa@sony.com>2017-11-09 21:23:16 +0900
commit2335b7020d66b25ee22bc414faf2847582fb8290 (patch)
treeeedfde136f5964a7992a0298c3eadc5d1bceb0e6
parent3c7f2f40c8b084b1288c36a5979af7337c973052 (diff)
downloadims-2335b7020d66b25ee22bc414faf2847582fb8290.tar.gz
Replace the default value of Enhanced 4G LTE mode with to carrier config
Replace the default value of Enhanced 4G LTE mode with carrier confg to control it by carrier configuration. Test: manual - Checked that the Enhanced 4G LTE mode can be controlled by carrier config. Bug: 67725875 Change-Id: Ib4b19692670e7343e52f1840e7d768dbd3abf8f8
-rw-r--r--src/java/com/android/ims/ImsManager.java45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index 0e611e4c..1a53ff48 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -279,20 +279,27 @@ public class ImsManager {
}
/**
- * Returns the user configuration of Enhanced 4G LTE Mode setting for slot.
+ * Returns the user configuration of Enhanced 4G LTE Mode setting for slot. If the option is
+ * not editable ({@link CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL} is false),
+ * this method will return default value specified by
+ * {@link CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}.
*/
public boolean isEnhanced4gLteModeSettingEnabledByUser() {
- // If user can't edit Enhanced 4G LTE Mode, it assumes Enhanced 4G LTE Mode is always true.
- // If user changes SIM from editable mode to uneditable mode, need to return true.
+ // If user can't edit Enhanced 4G LTE Mode, it assumes Enhanced 4G LTE Mode is default
+ // value.
+ // If user changes SIM from editable mode to uneditable mode, need to return default value.
+ int defaultValue = getBooleanCarrierConfig(
+ CarrierConfigManager.KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL) ?
+ ImsConfig.FeatureValueConstants.ON : ImsConfig.FeatureValueConstants.OFF;
if (!getBooleanCarrierConfig(
CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL)) {
- return true;
+ return (defaultValue == ImsConfig.FeatureValueConstants.ON);
}
int enabled = android.provider.Settings.Global.getInt(
mContext.getContentResolver(),
android.provider.Settings.Global.ENHANCED_4G_MODE_ENABLED,
- ImsConfig.FeatureValueConstants.ON);
- return (enabled == 1);
+ defaultValue);
+ return (enabled == ImsConfig.FeatureValueConstants.ON);
}
/**
@@ -311,15 +318,21 @@ public class ImsManager {
}
/**
- * Change persistent Enhanced 4G LTE Mode setting. If the the option is not editable
+ * Change persistent Enhanced 4G LTE Mode setting. If the option is not editable
* ({@link CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL} is false), this method will
- * always set the setting to true.
+ * set the setting to the default value specified by
+ * {@link CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}.
*
*/
public void setEnhanced4gLteModeSetting(boolean enabled) {
- // If false, we must always keep advanced 4G mode set to true (1).
- int value = getBooleanCarrierConfig(
- CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL) ? (enabled ? 1: 0) : 1;
+ int value = enabled ? ImsConfig.FeatureValueConstants.ON :
+ ImsConfig.FeatureValueConstants.OFF;
+ // If editable=false, we must keep default advanced 4G mode.
+ if (!getBooleanCarrierConfig(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL)) {
+ value = getBooleanCarrierConfig(
+ CarrierConfigManager.KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL) ?
+ ImsConfig.FeatureValueConstants.ON : ImsConfig.FeatureValueConstants.OFF;
+ }
try {
int prevSetting = android.provider.Settings.Global.getInt(mContext.getContentResolver(),
@@ -336,7 +349,7 @@ public class ImsManager {
android.provider.Settings.Global.ENHANCED_4G_MODE_ENABLED, value);
if (isNonTtyOrTtyOnVolteEnabled()) {
try {
- setAdvanced4GMode(enabled);
+ setAdvanced4GMode(value == ImsConfig.FeatureValueConstants.ON);
} catch (ImsException ie) {
// do nothing
}
@@ -2388,10 +2401,10 @@ public class ImsManager {
* @hide
*/
public void factoryReset() {
- // Set VoLTE to default
- android.provider.Settings.Global.putInt(mContext.getContentResolver(),
- android.provider.Settings.Global.ENHANCED_4G_MODE_ENABLED,
- ImsConfig.FeatureValueConstants.ON);
+ // Delete VoLTE row to retrieve the default value.
+ mContext.getContentResolver().delete(
+ Settings.Global.getUriFor(Settings.Global.ENHANCED_4G_MODE_ENABLED),
+ null, null);
// Set VoWiFi to default
android.provider.Settings.Global.putInt(mContext.getContentResolver(),