Merge "Change use of default sub to default data sub in GnssLocationProvider" into qt-dev
This commit is contained in:
@@ -317,8 +317,10 @@ class GnssConfiguration {
|
|||||||
if (configManager == null) {
|
if (configManager == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PersistableBundle configs = configManager.getConfigForSubId(
|
|
||||||
SubscriptionManager.getDefaultDataSubscriptionId());
|
int ddSubId = SubscriptionManager.getDefaultDataSubscriptionId();
|
||||||
|
PersistableBundle configs = SubscriptionManager.isValidSubscriptionId(ddSubId)
|
||||||
|
? configManager.getConfigForSubId(ddSubId) : null;
|
||||||
if (configs == null) {
|
if (configs == null) {
|
||||||
if (DEBUG) Log.d(TAG, "SIM not ready, use default carrier config.");
|
if (DEBUG) Log.d(TAG, "SIM not ready, use default carrier config.");
|
||||||
configs = CarrierConfigManager.getDefaultConfig();
|
configs = CarrierConfigManager.getDefaultConfig();
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ import android.os.WorkSource.WorkChain;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.CarrierConfigManager;
|
import android.telephony.CarrierConfigManager;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
|
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -75,6 +74,7 @@ import com.android.internal.location.GpsNetInitiatedHandler.GpsNiNotification;
|
|||||||
import com.android.internal.location.ProviderProperties;
|
import com.android.internal.location.ProviderProperties;
|
||||||
import com.android.internal.location.ProviderRequest;
|
import com.android.internal.location.ProviderRequest;
|
||||||
import com.android.internal.location.gnssmetrics.GnssMetrics;
|
import com.android.internal.location.gnssmetrics.GnssMetrics;
|
||||||
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
import com.android.server.location.GnssSatelliteBlacklistHelper.GnssSatelliteBlacklistCallback;
|
import com.android.server.location.GnssSatelliteBlacklistHelper.GnssSatelliteBlacklistCallback;
|
||||||
import com.android.server.location.NtpTimeHelper.InjectNtpTimeCallback;
|
import com.android.server.location.NtpTimeHelper.InjectNtpTimeCallback;
|
||||||
|
|
||||||
@@ -184,7 +184,6 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
private static final int DOWNLOAD_PSDS_DATA = 6;
|
private static final int DOWNLOAD_PSDS_DATA = 6;
|
||||||
private static final int UPDATE_LOCATION = 7; // Handle external location from network listener
|
private static final int UPDATE_LOCATION = 7; // Handle external location from network listener
|
||||||
private static final int DOWNLOAD_PSDS_DATA_FINISHED = 11;
|
private static final int DOWNLOAD_PSDS_DATA_FINISHED = 11;
|
||||||
private static final int SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED = 12;
|
|
||||||
private static final int INITIALIZE_HANDLER = 13;
|
private static final int INITIALIZE_HANDLER = 13;
|
||||||
private static final int REQUEST_LOCATION = 16;
|
private static final int REQUEST_LOCATION = 16;
|
||||||
private static final int REPORT_LOCATION = 17; // HAL reports location
|
private static final int REPORT_LOCATION = 17; // HAL reports location
|
||||||
@@ -484,22 +483,13 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
updateLowPowerMode();
|
updateLowPowerMode();
|
||||||
break;
|
break;
|
||||||
case CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED:
|
case CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED:
|
||||||
|
case TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED:
|
||||||
subscriptionOrCarrierConfigChanged(context);
|
subscriptionOrCarrierConfigChanged(context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: replace OnSubscriptionsChangedListener with ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED
|
|
||||||
// broadcast receiver.
|
|
||||||
private final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
|
|
||||||
new OnSubscriptionsChangedListener() {
|
|
||||||
@Override
|
|
||||||
public void onSubscriptionsChanged() {
|
|
||||||
sendMessage(SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED, 0, null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements {@link GnssSatelliteBlacklistCallback#onUpdateSatelliteBlacklist}.
|
* Implements {@link GnssSatelliteBlacklistCallback#onUpdateSatelliteBlacklist}.
|
||||||
*/
|
*/
|
||||||
@@ -515,12 +505,15 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
CarrierConfigManager configManager = (CarrierConfigManager)
|
CarrierConfigManager configManager = (CarrierConfigManager)
|
||||||
mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
|
mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
|
||||||
String mccMnc = phone.getSimOperator();
|
int ddSubId = SubscriptionManager.getDefaultDataSubscriptionId();
|
||||||
|
String mccMnc = SubscriptionManager.isValidSubscriptionId(ddSubId)
|
||||||
|
? phone.getSimOperator(ddSubId) : phone.getSimOperator();
|
||||||
boolean isKeepLppProfile = false;
|
boolean isKeepLppProfile = false;
|
||||||
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);
|
||||||
if (configManager != null) {
|
if (configManager != null) {
|
||||||
PersistableBundle b = configManager.getConfig();
|
PersistableBundle b = SubscriptionManager.isValidSubscriptionId(ddSubId)
|
||||||
|
? configManager.getConfigForSubId(ddSubId) : null;
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
isKeepLppProfile =
|
isKeepLppProfile =
|
||||||
b.getBoolean(CarrierConfigManager.Gps.KEY_PERSIST_LPP_MODE_BOOL);
|
b.getBoolean(CarrierConfigManager.Gps.KEY_PERSIST_LPP_MODE_BOOL);
|
||||||
@@ -539,7 +532,6 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
SystemProperties.set(GnssConfiguration.LPP_PROFILE, "");
|
SystemProperties.set(GnssConfiguration.LPP_PROFILE, "");
|
||||||
}
|
}
|
||||||
reloadGpsProperties();
|
reloadGpsProperties();
|
||||||
mNIHandler.setSuplEsEnabled(mSuplEsEnabled);
|
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) Log.d(TAG, "SIM MCC/MNC is still not available");
|
if (DEBUG) Log.d(TAG, "SIM MCC/MNC is still not available");
|
||||||
}
|
}
|
||||||
@@ -577,9 +569,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
mC2KServerPort = mGnssConfiguration.getC2KPort(TCP_MIN_PORT);
|
mC2KServerPort = mGnssConfiguration.getC2KPort(TCP_MIN_PORT);
|
||||||
mNIHandler.setEmergencyExtensionSeconds(mGnssConfiguration.getEsExtensionSec());
|
mNIHandler.setEmergencyExtensionSeconds(mGnssConfiguration.getEsExtensionSec());
|
||||||
mSuplEsEnabled = mGnssConfiguration.getSuplEs(0) == 1;
|
mSuplEsEnabled = mGnssConfiguration.getSuplEs(0) == 1;
|
||||||
|
mNIHandler.setSuplEsEnabled(mSuplEsEnabled);
|
||||||
if (mGnssVisibilityControl != null) {
|
if (mGnssVisibilityControl != null) {
|
||||||
mGnssVisibilityControl.updateProxyApps(mGnssConfiguration.getProxyApps());
|
mGnssVisibilityControl.onConfigurationUpdated(mGnssConfiguration);
|
||||||
mGnssVisibilityControl.setEsNotify(mGnssConfiguration.getEsNotify(0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1892,28 +1884,34 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
TelephonyManager phone = (TelephonyManager)
|
TelephonyManager phone = (TelephonyManager)
|
||||||
mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
int type = AGPS_SETID_TYPE_NONE;
|
int type = AGPS_SETID_TYPE_NONE;
|
||||||
String data = "";
|
String setId = null;
|
||||||
|
|
||||||
|
int ddSubId = SubscriptionManager.getDefaultDataSubscriptionId();
|
||||||
if ((flags & AGPS_RIL_REQUEST_SETID_IMSI) == AGPS_RIL_REQUEST_SETID_IMSI) {
|
if ((flags & AGPS_RIL_REQUEST_SETID_IMSI) == AGPS_RIL_REQUEST_SETID_IMSI) {
|
||||||
String data_temp = phone.getSubscriberId();
|
if (SubscriptionManager.isValidSubscriptionId(ddSubId)) {
|
||||||
if (data_temp == null) {
|
setId = phone.getSubscriberId(ddSubId);
|
||||||
// This means the framework does not have the SIM card ready.
|
}
|
||||||
} else {
|
if (setId == null) {
|
||||||
|
setId = phone.getSubscriberId();
|
||||||
|
}
|
||||||
|
if (setId != null) {
|
||||||
// This means the framework has the SIM card.
|
// This means the framework has the SIM card.
|
||||||
data = data_temp;
|
|
||||||
type = AGPS_SETID_TYPE_IMSI;
|
type = AGPS_SETID_TYPE_IMSI;
|
||||||
}
|
}
|
||||||
} else if ((flags & AGPS_RIL_REQUEST_SETID_MSISDN) == AGPS_RIL_REQUEST_SETID_MSISDN) {
|
} else if ((flags & AGPS_RIL_REQUEST_SETID_MSISDN) == AGPS_RIL_REQUEST_SETID_MSISDN) {
|
||||||
String data_temp = phone.getLine1Number();
|
if (SubscriptionManager.isValidSubscriptionId(ddSubId)) {
|
||||||
if (data_temp == null) {
|
setId = phone.getLine1Number(ddSubId);
|
||||||
// This means the framework does not have the SIM card ready.
|
}
|
||||||
} else {
|
if (setId == null) {
|
||||||
|
setId = phone.getLine1Number();
|
||||||
|
}
|
||||||
|
if (setId != null) {
|
||||||
// This means the framework has the SIM card.
|
// This means the framework has the SIM card.
|
||||||
data = data_temp;
|
|
||||||
type = AGPS_SETID_TYPE_MSISDN;
|
type = AGPS_SETID_TYPE_MSISDN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
native_agps_set_id(type, data);
|
|
||||||
|
native_agps_set_id(type, (setId == null) ? "" : setId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NativeEntryPoint
|
@NativeEntryPoint
|
||||||
@@ -2025,9 +2023,6 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
case UPDATE_LOCATION:
|
case UPDATE_LOCATION:
|
||||||
handleUpdateLocation((Location) msg.obj);
|
handleUpdateLocation((Location) msg.obj);
|
||||||
break;
|
break;
|
||||||
case SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED:
|
|
||||||
subscriptionOrCarrierConfigChanged(mContext);
|
|
||||||
break;
|
|
||||||
case INITIALIZE_HANDLER:
|
case INITIALIZE_HANDLER:
|
||||||
handleInitialize();
|
handleInitialize();
|
||||||
break;
|
break;
|
||||||
@@ -2066,17 +2061,6 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
// (this configuration might change in the future based on SIM changes)
|
// (this configuration might change in the future based on SIM changes)
|
||||||
reloadGpsProperties();
|
reloadGpsProperties();
|
||||||
|
|
||||||
// TODO: When this object "finishes" we should unregister by invoking
|
|
||||||
// SubscriptionManager.getInstance(mContext).unregister
|
|
||||||
// (mOnSubscriptionsChangedListener);
|
|
||||||
// This is not strictly necessary because it will be unregistered if the
|
|
||||||
// notification fails but it is good form.
|
|
||||||
|
|
||||||
// Register for SubscriptionInfo list changes which is guaranteed
|
|
||||||
// to invoke onSubscriptionsChanged the first time.
|
|
||||||
SubscriptionManager.from(mContext)
|
|
||||||
.addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
|
|
||||||
|
|
||||||
// listen for events
|
// listen for events
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
IntentFilter intentFilter = new IntentFilter();
|
||||||
intentFilter.addAction(ALARM_WAKEUP);
|
intentFilter.addAction(ALARM_WAKEUP);
|
||||||
@@ -2086,6 +2070,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
intentFilter.addAction(Intent.ACTION_SCREEN_ON);
|
intentFilter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
|
intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
|
||||||
|
intentFilter.addAction(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
|
||||||
mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
|
mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
|
||||||
|
|
||||||
mNetworkConnectivityHandler.registerNetworkCallbacks();
|
mNetworkConnectivityHandler.registerNetworkCallbacks();
|
||||||
@@ -2164,8 +2149,6 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
|||||||
return "DOWNLOAD_PSDS_DATA_FINISHED";
|
return "DOWNLOAD_PSDS_DATA_FINISHED";
|
||||||
case UPDATE_LOCATION:
|
case UPDATE_LOCATION:
|
||||||
return "UPDATE_LOCATION";
|
return "UPDATE_LOCATION";
|
||||||
case SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED:
|
|
||||||
return "SUBSCRIPTION_OR_CARRIER_CONFIG_CHANGED";
|
|
||||||
case INITIALIZE_HANDLER:
|
case INITIALIZE_HANDLER:
|
||||||
return "INITIALIZE_HANDLER";
|
return "INITIALIZE_HANDLER";
|
||||||
case REPORT_LOCATION:
|
case REPORT_LOCATION:
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class GnssVisibilityControl {
|
|||||||
private final GpsNetInitiatedHandler mNiHandler;
|
private final GpsNetInitiatedHandler mNiHandler;
|
||||||
|
|
||||||
private boolean mIsGpsEnabled;
|
private boolean mIsGpsEnabled;
|
||||||
private volatile boolean mEsNotify;
|
private boolean mEsNotify;
|
||||||
|
|
||||||
// Number of non-framework location access proxy apps is expected to be small (< 5).
|
// Number of non-framework location access proxy apps is expected to be small (< 5).
|
||||||
private static final int ARRAY_MAP_INITIAL_CAPACITY_PROXY_APP_TO_LOCATION_PERMISSIONS = 7;
|
private static final int ARRAY_MAP_INITIAL_CAPACITY_PROXY_APP_TO_LOCATION_PERMISSIONS = 7;
|
||||||
@@ -124,10 +124,6 @@ class GnssVisibilityControl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateProxyApps(List<String> nfwLocationAccessProxyApps) {
|
|
||||||
runOnHandler(() -> handleUpdateProxyApps(nfwLocationAccessProxyApps));
|
|
||||||
}
|
|
||||||
|
|
||||||
void reportNfwNotification(String proxyAppPackageName, byte protocolStack,
|
void reportNfwNotification(String proxyAppPackageName, byte protocolStack,
|
||||||
String otherProtocolStackName, byte requestor, String requestorId, byte responseType,
|
String otherProtocolStackName, byte requestor, String requestorId, byte responseType,
|
||||||
boolean inEmergencyMode, boolean isCachedLocation) {
|
boolean inEmergencyMode, boolean isCachedLocation) {
|
||||||
@@ -136,15 +132,25 @@ class GnssVisibilityControl {
|
|||||||
requestor, requestorId, responseType, inEmergencyMode, isCachedLocation)));
|
requestor, requestorId, responseType, inEmergencyMode, isCachedLocation)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEsNotify(int esNotifyConfig) {
|
void onConfigurationUpdated(GnssConfiguration configuration) {
|
||||||
if (esNotifyConfig != ES_NOTIFY_NONE && esNotifyConfig != ES_NOTIFY_ALL) {
|
// The configuration object must be accessed only in the caller thread and not in mHandler.
|
||||||
Log.e(TAG, "Config parameter " + GnssConfiguration.CONFIG_ES_NOTIFY_INT
|
List<String> nfwLocationAccessProxyApps = configuration.getProxyApps();
|
||||||
+ " is set to invalid value: " + esNotifyConfig
|
int esNotify = configuration.getEsNotify(ES_NOTIFY_NONE);
|
||||||
+ ". Using default value: " + ES_NOTIFY_NONE);
|
runOnHandler(() -> {
|
||||||
esNotifyConfig = ES_NOTIFY_NONE;
|
setEsNotify(esNotify);
|
||||||
|
handleUpdateProxyApps(nfwLocationAccessProxyApps);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mEsNotify = (esNotifyConfig == ES_NOTIFY_ALL);
|
private void setEsNotify(int esNotify) {
|
||||||
|
if (esNotify != ES_NOTIFY_NONE && esNotify != ES_NOTIFY_ALL) {
|
||||||
|
Log.e(TAG, "Config parameter " + GnssConfiguration.CONFIG_ES_NOTIFY_INT
|
||||||
|
+ " is set to invalid value: " + esNotify
|
||||||
|
+ ". Using default value: " + ES_NOTIFY_NONE);
|
||||||
|
esNotify = ES_NOTIFY_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
mEsNotify = (esNotify == ES_NOTIFY_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleInitialize() {
|
private void handleInitialize() {
|
||||||
|
|||||||
Reference in New Issue
Block a user