From b5299b5a207f368bd53d008115bf2228472c7a31 Mon Sep 17 00:00:00 2001 From: Mattias Nilsson Date: Fri, 24 Jan 2020 17:49:49 +0100 Subject: [PATCH 1/2] Move config_inflateSignalStrength to CC Sim based customizations should not be resources because of two reasons: 1. The MCC/MNC value in AssetManager for Dual sim devices is undefined 2. There is no support for MVNOs. For dual sim devices there is only one value for MCC/MNC in AssetManager and that value is updated from multiple places without deciding if it should be the default voice sim card, the default data sim card or whatnot. This means that when frameworks is trying to decide what resource to use there is no guarantee that the resource that arrives is for the particular subscription we are asking for. MVNOs cannot be separated through only MCC/MNC but need more parameters like service provider, imsi, GID1 etc. MVNO support is available in CarrierConfig. When we now have support for ADCP updates of customizations and start using carrier id this is better placed in CarrierConfig, we then get support for MVNOs at the same time. Bug: 148483577 Test: Customize for sim card x and not for sim card y, insert both sim cards in a dual sim device and see the difference. Merged-In: I067d55b9ae5e1346dd3b3cd50a0097b05b100055 Change-Id: I067d55b9ae5e1346dd3b3cd50a0097b05b100055 --- .../android/settingslib/net/SignalStrengthUtil.java | 13 ++++++++++--- .../statusbar/policy/NetworkControllerImpl.java | 3 --- .../android/telephony/CarrierConfigManager.java | 10 ++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java b/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java index 246f2ceac87c9..e1174fa05ea50 100644 --- a/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java +++ b/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java @@ -17,7 +17,8 @@ package com.android.settingslib.net; import android.content.Context; -import android.telephony.SubscriptionManager; +import android.os.PersistableBundle; +import android.telephony.CarrierConfigManager; /** * Utilities for dealing with signal strength. @@ -28,7 +29,13 @@ public class SignalStrengthUtil { * bar for the subscription with the given id */ public static boolean shouldInflateSignalStrength(Context context, int subscriptionId) { - return SubscriptionManager.getResourcesForSubId(context, subscriptionId) - .getBoolean(com.android.internal.R.bool.config_inflateSignalStrength); + final CarrierConfigManager carrierConfigMgr = + context.getSystemService(CarrierConfigManager.class); + PersistableBundle bundle = null; + if (carrierConfigMgr != null) { + bundle = carrierConfigMgr.getConfigForSubId(subscriptionId); + } + return (bundle != null && bundle.getBoolean( + CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false)); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 4ac3a9b6b40aa..32c4aec399238 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -1191,7 +1191,6 @@ public class NetworkControllerImpl extends BroadcastReceiver boolean show4gForLte = false; boolean hideLtePlus = false; boolean hspaDataDistinguishable; - boolean inflateSignalStrengths = false; boolean alwaysShowDataRatIcon = false; static Config readConfig(Context context) { @@ -1203,8 +1202,6 @@ public class NetworkControllerImpl extends BroadcastReceiver res.getBoolean(com.android.internal.R.bool.config_alwaysUseCdmaRssi); config.hspaDataDistinguishable = res.getBoolean(R.bool.config_hspa_data_distinguishable); - config.inflateSignalStrengths = res.getBoolean( - com.android.internal.R.bool.config_inflateSignalStrength); CarrierConfigManager configMgr = (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 870b9a4dd667c..ab659440e348f 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1084,6 +1084,15 @@ public class CarrierConfigManager { public static final String KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL = "show_signal_strength_in_sim_status_bool"; + /** + * Flag specifying if we should interpret all signal strength as one bar higher + * This is a replacement for the resource config_inflateSignalStrength + * The default value is false. + * @hide + */ + public static final String KEY_INFLATE_SIGNAL_STRENGTH_BOOL = + "inflate_signal_strength_bool"; + /** * Flag specifying whether an additional (client initiated) intent needs to be sent on System * update @@ -3989,6 +3998,7 @@ public class CarrierConfigManager { sDefaults.putStringArray(KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY, null); sDefaults.putBoolean(KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false); sDefaults.putBoolean(KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, true); + sDefaults.putBoolean(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false); sDefaults.putBoolean(KEY_CI_ACTION_ON_SYS_UPDATE_BOOL, false); sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, ""); sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, ""); From 8f90a92c184ebcc427267304783feed78dae7f75 Mon Sep 17 00:00:00 2001 From: Mattias Nilsson Date: Fri, 24 Jan 2020 18:33:21 +0100 Subject: [PATCH 2/2] Remove config_inflateSignalStrength This resource has moved to CarrierConfig to support dual sim devices and MVNOs. Bug: 148483577 Test: Manual Merged-In: I494cb93a2c72ff3df2ef45ad737c5606132e32d1 Change-Id: I494cb93a2c72ff3df2ef45ad737c5606132e32d1 --- core/res/res/values-mcc310-mnc030/config.xml | 26 ------------------- core/res/res/values-mcc310-mnc070/config.xml | 26 ------------------- core/res/res/values-mcc310-mnc170/config.xml | 26 ------------------- core/res/res/values-mcc310-mnc280/config.xml | 26 ------------------- core/res/res/values-mcc310-mnc380/config.xml | 26 ------------------- core/res/res/values-mcc310-mnc410/config.xml | 4 --- core/res/res/values-mcc310-mnc560/config.xml | 26 ------------------- core/res/res/values-mcc310-mnc950/config.xml | 26 ------------------- core/res/res/values-mcc311-mnc180/config.xml | 26 ------------------- core/res/res/values-mcc311-mnc480/config.xml | 3 --- core/res/res/values/config.xml | 4 --- core/res/res/values/symbols.xml | 1 - .../telephony/CarrierConfigManager.java | 2 +- 13 files changed, 1 insertion(+), 221 deletions(-) delete mode 100644 core/res/res/values-mcc310-mnc030/config.xml delete mode 100644 core/res/res/values-mcc310-mnc070/config.xml delete mode 100644 core/res/res/values-mcc310-mnc170/config.xml delete mode 100644 core/res/res/values-mcc310-mnc280/config.xml delete mode 100644 core/res/res/values-mcc310-mnc380/config.xml delete mode 100644 core/res/res/values-mcc310-mnc560/config.xml delete mode 100644 core/res/res/values-mcc310-mnc950/config.xml delete mode 100644 core/res/res/values-mcc311-mnc180/config.xml diff --git a/core/res/res/values-mcc310-mnc030/config.xml b/core/res/res/values-mcc310-mnc030/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc310-mnc030/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc310-mnc070/config.xml b/core/res/res/values-mcc310-mnc070/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc310-mnc070/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc310-mnc170/config.xml b/core/res/res/values-mcc310-mnc170/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc310-mnc170/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc310-mnc280/config.xml b/core/res/res/values-mcc310-mnc280/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc310-mnc280/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc310-mnc380/config.xml b/core/res/res/values-mcc310-mnc380/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc310-mnc380/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc310-mnc410/config.xml b/core/res/res/values-mcc310-mnc410/config.xml index 53e4193c7f38d..d76b9be324a63 100644 --- a/core/res/res/values-mcc310-mnc410/config.xml +++ b/core/res/res/values-mcc310-mnc410/config.xml @@ -23,8 +23,4 @@ 1410 - - - true - diff --git a/core/res/res/values-mcc310-mnc560/config.xml b/core/res/res/values-mcc310-mnc560/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc310-mnc560/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc310-mnc950/config.xml b/core/res/res/values-mcc310-mnc950/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc310-mnc950/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc311-mnc180/config.xml b/core/res/res/values-mcc311-mnc180/config.xml deleted file mode 100644 index 26b9192e0cc3b..0000000000000 --- a/core/res/res/values-mcc311-mnc180/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - true - - diff --git a/core/res/res/values-mcc311-mnc480/config.xml b/core/res/res/values-mcc311-mnc480/config.xml index 336e30e45b006..db2f8d01f93a9 100755 --- a/core/res/res/values-mcc311-mnc480/config.xml +++ b/core/res/res/values-mcc311-mnc480/config.xml @@ -40,7 +40,4 @@ true - - true - diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index f05e2b2611f33..fd12bb057ae00 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -4218,10 +4218,6 @@ only. The component must be part of a system app. --> - - false - 2000000 diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 6901eb21d9fe6..686dd78b635cc 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3826,7 +3826,6 @@ - diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index ab659440e348f..56ac8fc2ca663 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1086,7 +1086,7 @@ public class CarrierConfigManager { /** * Flag specifying if we should interpret all signal strength as one bar higher - * This is a replacement for the resource config_inflateSignalStrength + * This is a replacement for the former resource config_inflateSignalStrength * The default value is false. * @hide */