summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2020-06-11 17:38:36 -0700
committerDavid Su <dysu@google.com>2020-06-11 17:48:53 -0700
commite0adae2b89091561ab918f3cc1ff60f21121e197 (patch)
treef9889ef80bacfbaa3f02f89f95ec7c4713e281e1
parentb7b3d2ca7394b367fd70f623de8e444d560730d3 (diff)
ConfigWifiDisableInEcbm: add null check and change default value
1. CarrierConfigManager#getConfig() is @Nullable, so perform a null check to avoid NPE. 2. Change the default value from true to false to be consistent with the declaration of KEY_CONFIG_WIFI_DISABLE_IN_ECBM in CarrierConfigManager. The initial commits (under the same topic no less) were contradictory regarding the default values. I5af370c143630bdd4b075f4730fd1de1bbe1fe7d states in the commit message and code that the default should be false, but If1724f825f1c8b47ec2f29ecd8abda45ef9bc393 has the default value set to true. Bug: 156962944 Test: compiles Change-Id: I87c4d9380d6ab1f8b74c58ec8a91de4003eec426
-rw-r--r--service/java/com/android/server/wifi/FrameworkFacade.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/FrameworkFacade.java b/service/java/com/android/server/wifi/FrameworkFacade.java
index a0b510f0f..875154e5b 100644
--- a/service/java/com/android/server/wifi/FrameworkFacade.java
+++ b/service/java/com/android/server/wifi/FrameworkFacade.java
@@ -32,6 +32,7 @@ import android.net.TrafficStats;
import android.net.Uri;
import android.net.ip.IpClientCallbacks;
import android.net.ip.IpClientUtil;
+import android.os.PersistableBundle;
import android.provider.Settings;
import android.telephony.CarrierConfigManager;
import android.util.Log;
@@ -173,12 +174,14 @@ public class FrameworkFacade {
public boolean getConfigWiFiDisableInECBM(Context context) {
CarrierConfigManager configManager = getCarrierConfigManager(context);
- if (configManager != null) {
- return configManager.getConfig().getBoolean(
- CarrierConfigManager.KEY_CONFIG_WIFI_DISABLE_IN_ECBM);
+ if (configManager == null) {
+ return false;
}
- /* Default to TRUE */
- return true;
+ PersistableBundle bundle = configManager.getConfig();
+ if (bundle == null) {
+ return false;
+ }
+ return bundle.getBoolean(CarrierConfigManager.KEY_CONFIG_WIFI_DISABLE_IN_ECBM);
}
public long getTxPackets(String iface) {