Merge "GPS: Keep LPP_PROFILE for verizon" into nyc-mr1-dev
This commit is contained in:
@@ -393,6 +393,15 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
// SIM/Carrier info.
|
// SIM/Carrier info.
|
||||||
private final static String SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED";
|
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";
|
||||||
|
|
||||||
|
// 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;
|
private final PowerManager mPowerManager;
|
||||||
private final AlarmManager mAlarmManager;
|
private final AlarmManager mAlarmManager;
|
||||||
private final PendingIntent mWakeupIntent;
|
private final PendingIntent mWakeupIntent;
|
||||||
@@ -507,14 +516,43 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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) {
|
private void subscriptionOrSimChanged(Context context) {
|
||||||
if (DEBUG) Log.d(TAG, "received SIM related action: ");
|
if (DEBUG) Log.d(TAG, "received SIM related action: ");
|
||||||
TelephonyManager phone = (TelephonyManager)
|
TelephonyManager phone = (TelephonyManager)
|
||||||
mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
String mccMnc = phone.getSimOperator();
|
String mccMnc = phone.getSimOperator();
|
||||||
|
String imsi = phone.getSubscriberId();
|
||||||
|
String groupId = phone.getGroupIdLevel1();
|
||||||
if (!TextUtils.isEmpty(mccMnc)) {
|
if (!TextUtils.isEmpty(mccMnc)) {
|
||||||
if (DEBUG) Log.d(TAG, "SIM MCC/MNC is available: " + mccMnc);
|
if (DEBUG) Log.d(TAG, "SIM MCC/MNC is available: " + mccMnc);
|
||||||
synchronized (mLock) {
|
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);
|
||||||
|
} else {
|
||||||
|
// reset the persist property for Non VZW
|
||||||
|
SystemProperties.set(LPP_PROFILE, "");
|
||||||
|
}
|
||||||
reloadGpsProperties(context, mProperties);
|
reloadGpsProperties(context, mProperties);
|
||||||
mNIHandler.setSuplEsEnabled(mSuplEsEnabled);
|
mNIHandler.setSuplEsEnabled(mSuplEsEnabled);
|
||||||
}
|
}
|
||||||
@@ -571,8 +609,10 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
private void reloadGpsProperties(Context context, Properties properties) {
|
private void reloadGpsProperties(Context context, Properties properties) {
|
||||||
if (DEBUG) Log.d(TAG, "Reset GPS properties, previous size = " + properties.size());
|
if (DEBUG) Log.d(TAG, "Reset GPS properties, previous size = " + properties.size());
|
||||||
loadPropertiesFromResource(context, properties);
|
loadPropertiesFromResource(context, properties);
|
||||||
|
|
||||||
boolean isPropertiesLoadedFromFile = false;
|
boolean isPropertiesLoadedFromFile = false;
|
||||||
final String gpsHardware = SystemProperties.get("ro.hardware.gps");
|
final String gpsHardware = SystemProperties.get("ro.hardware.gps");
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(gpsHardware)) {
|
if (!TextUtils.isEmpty(gpsHardware)) {
|
||||||
final String propFilename =
|
final String propFilename =
|
||||||
PROPERTIES_FILE_PREFIX + "." + gpsHardware + PROPERTIES_FILE_SUFFIX;
|
PROPERTIES_FILE_PREFIX + "." + gpsHardware + PROPERTIES_FILE_SUFFIX;
|
||||||
@@ -583,7 +623,11 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
loadPropertiesFromFile(DEFAULT_PROPERTIES_FILE, properties);
|
loadPropertiesFromFile(DEFAULT_PROPERTIES_FILE, properties);
|
||||||
}
|
}
|
||||||
if (DEBUG) Log.d(TAG, "GPS properties reloaded, size = " + properties.size());
|
if (DEBUG) Log.d(TAG, "GPS properties reloaded, size = " + properties.size());
|
||||||
|
String lpp_prof = SystemProperties.get(LPP_PROFILE);
|
||||||
|
if (!TextUtils.isEmpty(lpp_prof)) {
|
||||||
|
// override default value of this if lpp_prof is not empty
|
||||||
|
properties.setProperty("LPP_PROFILE", lpp_prof);
|
||||||
|
}
|
||||||
// TODO: we should get rid of C2K specific setting.
|
// TODO: we should get rid of C2K specific setting.
|
||||||
setSuplHostPort(properties.getProperty("SUPL_HOST"),
|
setSuplHostPort(properties.getProperty("SUPL_HOST"),
|
||||||
properties.getProperty("SUPL_PORT"));
|
properties.getProperty("SUPL_PORT"));
|
||||||
|
|||||||
Reference in New Issue
Block a user