Allow settingIgnored for DBH request if inEmergency

Bug: 150232136

Test: on device
Change-Id: Ia987418a591d716b787d406d725338a8563a55dd
This commit is contained in:
Yu-Han Yang
2020-02-26 12:46:01 -08:00
parent b896072638
commit 97e162d605
2 changed files with 15 additions and 7 deletions

View File

@@ -79,7 +79,7 @@ class GnssConfiguration {
// Represents an HAL interface version. Instances of this class are created in the JNI layer // Represents an HAL interface version. Instances of this class are created in the JNI layer
// and returned through native methods. // and returned through native methods.
private static class HalInterfaceVersion { static class HalInterfaceVersion {
final int mMajor; final int mMajor;
final int mMinor; final int mMinor;
@@ -205,6 +205,10 @@ class GnssConfiguration {
native_set_satellite_blacklist(constellations, svids); native_set_satellite_blacklist(constellations, svids);
} }
HalInterfaceVersion getHalInterfaceVersion() {
return native_get_gnss_configuration_version();
}
interface SetCarrierProperty { interface SetCarrierProperty {
boolean set(int value); boolean set(int value);
} }
@@ -231,8 +235,7 @@ class GnssConfiguration {
logConfigurations(); logConfigurations();
final HalInterfaceVersion gnssConfigurationIfaceVersion = final HalInterfaceVersion gnssConfigurationIfaceVersion = getHalInterfaceVersion();
native_get_gnss_configuration_version();
if (gnssConfigurationIfaceVersion != null) { if (gnssConfigurationIfaceVersion != null) {
// Set to a range checked value. // Set to a range checked value.
if (isConfigEsExtensionSecSupported(gnssConfigurationIfaceVersion) if (isConfigEsExtensionSecSupported(gnssConfigurationIfaceVersion)

View File

@@ -772,10 +772,15 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
locationRequest.setProvider(provider); locationRequest.setProvider(provider);
// Ignore location settings if in emergency mode. // Ignore location settings if in emergency mode. This is only allowed for
if (isUserEmergency && mNIHandler.getInEmergency()) { // isUserEmergency request (introduced in HAL v2.0), or DBH request in HAL v1.1.
locationRequest.setLocationSettingsIgnored(true); if (mNIHandler.getInEmergency()) {
durationMillis *= EMERGENCY_LOCATION_UPDATE_DURATION_MULTIPLIER; GnssConfiguration.HalInterfaceVersion halVersion =
mGnssConfiguration.getHalInterfaceVersion();
if (isUserEmergency || (halVersion.mMajor < 2 && !independentFromGnss)) {
locationRequest.setLocationSettingsIgnored(true);
durationMillis *= EMERGENCY_LOCATION_UPDATE_DURATION_MULTIPLIER;
}
} }
Log.i(TAG, Log.i(TAG,