diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 9f5eab5570260..03bb9f01dcf94 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2845,19 +2845,6 @@
true
-
-
- - SUPL_HOST=supl.google.com
- - SUPL_PORT=7275
- - SUPL_VER=0x20000
- - SUPL_MODE=1
- - SUPL_ES=1
- - LPP_PROFILE=0
- - USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1
- - A_GLONASS_POS_PROTOCOL_SELECT=0
- - GPS_LOCK=3
-
-
0
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 4ed0501175419..6a90701c18697 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1269,7 +1269,6 @@
-
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index 0f060fe09318e..540c1c5cbe876 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -192,7 +192,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
private static final int ADD_LISTENER = 8;
private static final int REMOVE_LISTENER = 9;
private static final int DOWNLOAD_XTRA_DATA_FINISHED = 11;
- private static final int SUBSCRIPTION_OR_SIM_CHANGED = 12;
+ private static final int SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED = 12;
private static final int INITIALIZE_HANDLER = 13;
private static final int REQUEST_SUPL_CONNECTION = 14;
private static final int RELEASE_SUPL_CONNECTION = 15;
@@ -415,9 +415,6 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
private final static String ALARM_WAKEUP = "com.android.internal.location.ALARM_WAKEUP";
private final static String ALARM_TIMEOUT = "com.android.internal.location.ALARM_TIMEOUT";
- // SIM/Carrier info.
- private final static String SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED";
-
// Persist property for LPP_PROFILE
private final static String LPP_PROFILE = "persist.sys.gps.lpp";
@@ -487,18 +484,20 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
case Intent.ACTION_SCREEN_ON:
updateLowPowerMode();
break;
- case SIM_STATE_CHANGED:
- subscriptionOrSimChanged(context);
+ case CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED:
+ subscriptionOrCarrierConfigChanged(context);
break;
}
}
};
+ // TODO(b/119326010): replace OnSubscriptionsChangedListener with
+ // ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED broadcast reseiver.
private final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
new OnSubscriptionsChangedListener() {
@Override
public void onSubscriptionsChanged() {
- sendMessage(SUBSCRIPTION_OR_SIM_CHANGED, 0, null);
+ sendMessage(SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED, 0, null);
}
};
@@ -510,7 +509,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
mHandler.post(() -> native_set_satellite_blacklist(constellations, svids));
}
- private void subscriptionOrSimChanged(Context context) {
+ private void subscriptionOrCarrierConfigChanged(Context context) {
if (DEBUG) Log.d(TAG, "received SIM related action: ");
TelephonyManager phone = (TelephonyManager)
mContext.getSystemService(Context.TELEPHONY_SERVICE);
@@ -525,12 +524,12 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
PersistableBundle b = configManager.getConfig();
if (b != null) {
isKeepLppProfile =
- b.getBoolean(CarrierConfigManager.KEY_PERSIST_LPP_MODE_BOOL);
+ b.getBoolean(CarrierConfigManager.Gps.KEY_PERSIST_LPP_MODE_BOOL);
}
}
if (isKeepLppProfile) {
// load current properties for the carrier
- loadPropertiesFromResource(context, mProperties);
+ loadPropertiesFromCarrierConfig(context, mProperties);
String lpp_profile = mProperties.getProperty("LPP_PROFILE");
// set the persist property LPP_PROFILE for the value
if (lpp_profile != null) {
@@ -575,7 +574,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
private void reloadGpsProperties(Context context, Properties properties) {
if (DEBUG) Log.d(TAG, "Reset GPS properties, previous size = " + properties.size());
- loadPropertiesFromResource(context, properties);
+ loadPropertiesFromCarrierConfig(context, properties);
String lpp_prof = SystemProperties.get(LPP_PROFILE);
if (!TextUtils.isEmpty(lpp_prof)) {
@@ -585,7 +584,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
/*
* Overlay carrier properties from a debug configuration file.
*/
- loadPropertiesFromFile(properties);
+ loadPropertiesFromGpsDebugConfig(properties);
// TODO: we should get rid of C2K specific setting.
setSuplHostPort(properties.getProperty("SUPL_HOST"),
properties.getProperty("SUPL_PORT"));
@@ -655,25 +654,34 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
}
}
- private void loadPropertiesFromResource(Context context,
- Properties properties) {
- String[] configValues = context.getResources().getStringArray(
- com.android.internal.R.array.config_gpsParameters);
- for (String item : configValues) {
- if (DEBUG) Log.d(TAG, "GpsParamsResource: " + item);
- // We need to support "KEY =", but not "=VALUE".
- int index = item.indexOf("=");
- if (index > 0 && index + 1 < item.length()) {
- String key = item.substring(0, index);
- String value = item.substring(index + 1);
- properties.setProperty(key.trim().toUpperCase(), value);
- } else {
- Log.w(TAG, "malformed contents: " + item);
+ private void loadPropertiesFromCarrierConfig(Context context, Properties properties) {
+ CarrierConfigManager configManager = (CarrierConfigManager)
+ mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
+ if (configManager == null) {
+ return;
+ }
+ PersistableBundle configs = configManager.getConfigForSubId(
+ SubscriptionManager.getDefaultDataSubscriptionId());
+ if (configs == null) {
+ if (DEBUG) Log.d(TAG, "SIM not ready, use default carrier config.");
+ configs = CarrierConfigManager.getDefaultConfig();
+ }
+ for (String configKey : configs.keySet()) {
+ if (configKey.startsWith(CarrierConfigManager.Gps.KEY_PREFIX)) {
+ String key = configKey
+ .substring(CarrierConfigManager.Gps.KEY_PREFIX.length())
+ .toUpperCase();
+ Object value = configs.get(configKey);
+ if (value instanceof String) {
+ // All GPS properties are of String type; convert so.
+ if (DEBUG) Log.d(TAG, "Gps config: " + key + " = " + value);
+ properties.setProperty(key, (String) value);
+ }
}
}
}
- private void loadPropertiesFromFile(Properties properties) {
+ private void loadPropertiesFromGpsDebugConfig(Properties properties) {
try {
File file = new File(DEBUG_PROPERTIES_FILE);
FileInputStream stream = null;
@@ -2018,8 +2026,8 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
case UPDATE_LOCATION:
handleUpdateLocation((Location) msg.obj);
break;
- case SUBSCRIPTION_OR_SIM_CHANGED:
- subscriptionOrSimChanged(mContext);
+ case SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED:
+ subscriptionOrCarrierConfigChanged(mContext);
break;
case INITIALIZE_HANDLER:
handleInitialize();
@@ -2086,7 +2094,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
intentFilter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED);
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
intentFilter.addAction(Intent.ACTION_SCREEN_ON);
- intentFilter.addAction(SIM_STATE_CHANGED);
+ intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
mNetworkConnectivityHandler.registerNetworkCallbacks();
@@ -2168,8 +2176,8 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
return "DOWNLOAD_XTRA_DATA_FINISHED";
case UPDATE_LOCATION:
return "UPDATE_LOCATION";
- case SUBSCRIPTION_OR_SIM_CHANGED:
- return "SUBSCRIPTION_OR_SIM_CHANGED";
+ case SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED:
+ return "SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED";
case INITIALIZE_HANDLER:
return "INITIALIZE_HANDLER";
case REPORT_LOCATION:
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index f87472d9ec387..92005b7d54bd3 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1792,17 +1792,6 @@ public class CarrierConfigManager {
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";
-
/**
* Carrier specified WiFi networks.
* @hide
@@ -2428,6 +2417,114 @@ public class CarrierConfigManager {
public static final String KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT =
"opportunistic_network_exit_threshold_rssnr_int";
+ /**
+ * GPS configs. See android.hardware.gnss@1.0 IGnssConfiguration.
+ * @hide
+ */
+ public static final class Gps {
+ /** Prefix of all Gps.KEY_* constants. */
+ public static final String KEY_PREFIX = "gps.";
+
+ /**
+ * 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. This is default.
+ */
+ public static final String KEY_PERSIST_LPP_MODE_BOOL = KEY_PREFIX + "persist_lpp_mode_bool";
+
+ /**
+ * SUPL server host for SET Initiated & non-ES Network-Initiated SUPL requests.
+ * Default to supl.google.com
+ */
+ public static final String KEY_SUPL_HOST_STRING = KEY_PREFIX + "supl_host";
+
+ /** SUPL server port. Default to 7275. */
+ public static final String KEY_SUPL_PORT_STRING = KEY_PREFIX + "supl_port";
+
+ /**
+ * The SUPL version requested by Carrier. This is a bit mask
+ * with bits 0:7 representing a service indicator field, bits 8:15
+ * representing the minor version and bits 16:23 representing the
+ * major version. Default to 0x20000.
+ */
+ public static final String KEY_SUPL_VER_STRING = KEY_PREFIX + "supl_ver";
+
+ /**
+ * SUPL_MODE configuration bit mask
+ * 1 - Mobile Station Based. This is default.
+ * 2 - Mobile Station Assisted.
+ */
+ public static final String KEY_SUPL_MODE_STRING = KEY_PREFIX + "supl_mode";
+
+ /**
+ * Whether to limit responses to SUPL ES mode requests only during user emergency sessions
+ * (e.g. E911), and SUPL non-ES requests to only outside of non user emergency sessions.
+ * 0 - no.
+ * 1 - yes. This is default.
+ */
+ // TODO(b/119567985): name this key properly
+ public static final String KEY_SUPL_ES_STRING = KEY_PREFIX + "supl_es";
+
+ /**
+ * LTE Positioning Profile settings bit mask.
+ * 0 - Radio Resource Location Protocol in user plane and control plane. This is default.
+ * 1 - Enable LTE Positioning Protocol in user plane.
+ * 2 - Enable LTE Positioning Protocol in control plane.
+ */
+ public static final String KEY_LPP_PROFILE_STRING = KEY_PREFIX + "lpp_profile";
+
+ /**
+ * Determine whether to use emergency PDN for emergency SUPL.
+ * 0 - no.
+ * 1 - yes. This is default.
+ */
+ public static final String KEY_USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_STRING =
+ KEY_PREFIX + "use_emergency_pdn_for_emergency_supl";
+
+ /**
+ * A_GLONASS_POS_PROTOCOL_SELECT bit mask.
+ * 0 - Don't use A-GLONASS. This is default.
+ * 1 - Use A-GLONASS in Radio Resource Control(RRC) control-plane.
+ * 2 - Use A-GLONASS in Radio Resource Location user-plane.
+ * 4 - Use A-GLONASS in LTE Positioning Protocol User plane.
+ */
+ public static final String KEY_A_GLONASS_POS_PROTOCOL_SELECT_STRING =
+ KEY_PREFIX + "a_glonass_pos_protocol_select";
+
+ /**
+ * GPS_LOCK configuration bit mask to specify GPS device behavior toward other services,
+ * when Location Settings are off.
+ * "0" - No lock.
+ * "1" - Lock Mobile Originated GPS functionalities.
+ * "2" - Lock Network initiated GPS functionalities.
+ * "3" - Lock both. This is default.
+ */
+ public static final String KEY_GPS_LOCK_STRING = KEY_PREFIX + "gps_lock";
+
+ /**
+ * SUPL NI emergency extension time in seconds. Default to "0".
+ */
+ public static final String KEY_ES_EXTENSION_SEC = KEY_PREFIX + "es_extension_sec";
+
+ private static PersistableBundle getDefaults() {
+ PersistableBundle defaults = new PersistableBundle();
+ defaults.putBoolean(KEY_PERSIST_LPP_MODE_BOOL, true);
+ defaults.putString(KEY_SUPL_HOST_STRING, "supl.google.com");
+ defaults.putString(KEY_SUPL_PORT_STRING, "7275");
+ defaults.putString(KEY_SUPL_VER_STRING, "0x20000");
+ defaults.putString(KEY_SUPL_MODE_STRING, "1");
+ defaults.putString(KEY_SUPL_ES_STRING, "1");
+ defaults.putString(KEY_LPP_PROFILE_STRING, "0");
+ defaults.putString(KEY_USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_STRING, "1");
+ defaults.putString(KEY_A_GLONASS_POS_PROTOCOL_SELECT_STRING, "0");
+ defaults.putString(KEY_GPS_LOCK_STRING, "3");
+ defaults.putString(KEY_ES_EXTENSION_SEC, "0");
+ return defaults;
+ }
+ }
+
/** The default value for every variable. */
private final static PersistableBundle sDefaults;
@@ -2720,7 +2817,6 @@ public class CarrierConfigManager {
sDefaults.putStringArray(KEY_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, true);
sDefaults.putStringArray(KEY_CARRIER_WIFI_STRING_ARRAY, null);
sDefaults.putInt(KEY_PREF_NETWORK_NOTIFICATION_DELAY_INT, -1);
sDefaults.putInt(KEY_EMERGENCY_NOTIFICATION_DELAY_INT, -1);
@@ -2797,6 +2893,7 @@ public class CarrierConfigManager {
sDefaults.putInt(KEY_OPPORTUNISTIC_NETWORK_ENTRY_THRESHOLD_RSSNR_INT, 45);
/* Default value is minimum RSSNR level needed for SIGNAL_STRENGTH_MODERATE */
sDefaults.putInt(KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT, 10);
+ sDefaults.putAll(Gps.getDefaults());
}
/**