CarrierConfig: add persist_lpp_mode_bool
Removing carrier specific function from
GnssLocationProvider.java
This property is used for persisting the current
lpp_mode of carrier even after sim is removed
Instead, we will use the property of carrier config
Bug: 32250938
Change-Id: Ibc69883723392cb0fbfcd8dbf3e866860db9dd5d
Signed-off-by: Ecco Park <eccopark@google.com>
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index ae98077..9ae496f 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -58,6 +58,7 @@
import android.os.BatteryStats;
import android.os.Binder;
import android.os.Bundle;
+import android.os.PersistableBundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -75,6 +76,7 @@
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
+import android.telephony.CarrierConfigManager;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.Log;
@@ -396,10 +398,6 @@
// Persist property for LPP_PROFILE
private final static String LPP_PROFILE = "persist.sys.gps.lpp";
- // VZW PLMN info
- private static final String[] VzwMccMncList = {"311480", "310004", "20404"};
- // corresponding GID1 value, empty string means ignore gid1 match.
- private static final String[] VzwGid1List = {"", "", "BAE0000000000000"};
private final PowerManager mPowerManager;
@@ -520,42 +518,30 @@
}
};
- private final boolean isVerizon(String mccMnc, String imsi, String groupId) {
- if (DEBUG) Log.d(TAG, "simOperator: " + mccMnc);
- if (!TextUtils.isEmpty(mccMnc) || !TextUtils.isEmpty(imsi)) {
- for (int i = 0; i < VzwMccMncList.length; i++) {
- if ((!TextUtils.isEmpty(mccMnc) && mccMnc.equals(VzwMccMncList[i])) ||
- (!TextUtils.isEmpty(imsi) && imsi.startsWith(VzwMccMncList[i]))) {
- // check gid too if needed
- if (TextUtils.isEmpty(VzwGid1List[i]) || VzwGid1List[i].equals(groupId)) {
- if (DEBUG) Log.d(TAG, "Verizon UICC");
- return true;
- }
- }
- }
- }
- return false;
- }
-
private void subscriptionOrSimChanged(Context context) {
if (DEBUG) Log.d(TAG, "received SIM related action: ");
TelephonyManager phone = (TelephonyManager)
mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ CarrierConfigManager configManager = (CarrierConfigManager)
+ mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
String mccMnc = phone.getSimOperator();
- String imsi = phone.getSubscriberId();
- String groupId = phone.getGroupIdLevel1();
+ boolean isKeepLppProfile = false;
if (!TextUtils.isEmpty(mccMnc)) {
if (DEBUG) Log.d(TAG, "SIM MCC/MNC is available: " + mccMnc);
synchronized (mLock) {
- if (isVerizon(mccMnc, imsi, groupId)) {
- // load current properties for carrier VZW
- loadPropertiesFromResource(context, mProperties);
- String lpp_profile = mProperties.getProperty("LPP_PROFILE");
- // set the persist property LPP_PROFILE for VZW
- SystemProperties.set(LPP_PROFILE, lpp_profile);
+ if (configManager != null) {
+ PersistableBundle b = configManager.getConfig();
+ isKeepLppProfile = b.getBoolean(CarrierConfigManager.KEY_PERSIST_LPP_MODE_BOOL);
+ }
+ if (isKeepLppProfile) {
+ // load current properties for the carrier
+ loadPropertiesFromResource(context, mProperties);
+ String lpp_profile = mProperties.getProperty("LPP_PROFILE");
+ // set the persist property LPP_PROFILE for the value
+ SystemProperties.set(LPP_PROFILE, lpp_profile);
} else {
- // reset the persist property for Non VZW
- SystemProperties.set(LPP_PROFILE, "");
+ // reset the persist property
+ SystemProperties.set(LPP_PROFILE, "");
}
reloadGpsProperties(context, mProperties);
mNIHandler.setSuplEsEnabled(mSuplEsEnabled);
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 04d680e..7506b10 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1072,6 +1072,18 @@
public static final String KEY_EDITABLE_WFC_ROAMING_MODE_BOOL =
"editable_wfc_roaming_mode_bool";
+ /**
+ * Determine whether current lpp_mode used for E-911 needs to be kept persistently.
+ * {@code false} - not keeping the lpp_mode means using default configuration of gps.conf
+ * when sim is not presented.
+ * {@code true} - current lpp_profile of carrier will be kepted persistently
+ * even after sim is removed.
+ *
+ * @hide
+ */
+ public static final String KEY_PERSIST_LPP_MODE_BOOL = "persist_lpp_mode_bool";
+
+
/** The default value for every variable. */
private final static PersistableBundle sDefaults;
@@ -1266,6 +1278,7 @@
sDefaults.putStringArray(FILTERED_CNAP_NAMES_STRING_ARRAY, null);
sDefaults.putBoolean(KEY_EDITABLE_WFC_ROAMING_MODE_BOOL, false);
sDefaults.putBoolean(KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL, false);
+ sDefaults.putBoolean(KEY_PERSIST_LPP_MODE_BOOL, false);
}
/**