Loading services/core/java/com/android/server/location/GnssLocationProvider.java +21 −8 Original line number Original line Diff line number Diff line Loading @@ -222,6 +222,8 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private static final long LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS = 1000; private static final long LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS = 1000; // Default update duration in milliseconds for REQUEST_LOCATION. // Default update duration in milliseconds for REQUEST_LOCATION. private static final long LOCATION_UPDATE_DURATION_MILLIS = 10 * 1000; private static final long LOCATION_UPDATE_DURATION_MILLIS = 10 * 1000; // Update duration extension multiplier for emergency REQUEST_LOCATION. private static final int EMERGENCY_LOCATION_UPDATE_DURATION_MULTIPLIER = 3; /** simpler wrapper for ProviderRequest + Worksource */ /** simpler wrapper for ProviderRequest + Worksource */ private static class GpsRequest { private static class GpsRequest { Loading Loading @@ -724,30 +726,35 @@ public class GnssLocationProvider extends AbstractLocationProvider implements Context.LOCATION_SERVICE); Context.LOCATION_SERVICE); String provider; String provider; LocationChangeListener locationListener; LocationChangeListener locationListener; LocationRequest locationRequest = new LocationRequest() .setInterval(LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS) .setFastestInterval(LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS); if (independentFromGnss) { if (independentFromGnss) { // For fast GNSS TTFF // For fast GNSS TTFF provider = LocationManager.NETWORK_PROVIDER; provider = LocationManager.NETWORK_PROVIDER; locationListener = mNetworkLocationListener; locationListener = mNetworkLocationListener; locationRequest.setQuality(LocationRequest.POWER_LOW); } else { } else { // For Device-Based Hybrid (E911) // For Device-Based Hybrid (E911) provider = LocationManager.FUSED_PROVIDER; provider = LocationManager.FUSED_PROVIDER; locationListener = mFusedLocationListener; locationListener = mFusedLocationListener; locationRequest.setQuality(LocationRequest.ACCURACY_FINE); } } Log.i(TAG, locationRequest.setProvider(provider); String.format( "GNSS HAL Requesting location updates from %s provider for %d millis.", provider, durationMillis)); LocationRequest locationRequest = LocationRequest.createFromDeprecatedProvider(provider, LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS, /* minDistance= */ 0, /* singleShot= */ false); // Ignore location settings if in emergency mode. // Ignore location settings if in emergency mode. if (isUserEmergency && mNIHandler.getInEmergency()) { if (isUserEmergency && mNIHandler.getInEmergency()) { locationRequest.setLocationSettingsIgnored(true); locationRequest.setLocationSettingsIgnored(true); durationMillis *= EMERGENCY_LOCATION_UPDATE_DURATION_MULTIPLIER; } } Log.i(TAG, String.format( "GNSS HAL Requesting location updates from %s provider for %d millis.", provider, durationMillis)); try { try { locationManager.requestLocationUpdates(locationRequest, locationManager.requestLocationUpdates(locationRequest, locationListener, mHandler.getLooper()); locationListener, mHandler.getLooper()); Loading @@ -765,6 +772,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements } } private void injectBestLocation(Location location) { private void injectBestLocation(Location location) { if (DEBUG) { Log.d(TAG, "injectBestLocation: " + location); } int gnssLocationFlags = LOCATION_HAS_LAT_LONG | int gnssLocationFlags = LOCATION_HAS_LAT_LONG | (location.hasAltitude() ? LOCATION_HAS_ALTITUDE : 0) | (location.hasAltitude() ? LOCATION_HAS_ALTITUDE : 0) | (location.hasSpeed() ? LOCATION_HAS_SPEED : 0) | (location.hasSpeed() ? LOCATION_HAS_SPEED : 0) | Loading Loading @@ -869,6 +879,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private void handleUpdateLocation(Location location) { private void handleUpdateLocation(Location location) { if (location.hasAccuracy()) { if (location.hasAccuracy()) { if (DEBUG) { Log.d(TAG, "injectLocation: " + location); } native_inject_location(location.getLatitude(), location.getLongitude(), native_inject_location(location.getLatitude(), location.getLongitude(), location.getAccuracy()); location.getAccuracy()); } } Loading Loading
services/core/java/com/android/server/location/GnssLocationProvider.java +21 −8 Original line number Original line Diff line number Diff line Loading @@ -222,6 +222,8 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private static final long LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS = 1000; private static final long LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS = 1000; // Default update duration in milliseconds for REQUEST_LOCATION. // Default update duration in milliseconds for REQUEST_LOCATION. private static final long LOCATION_UPDATE_DURATION_MILLIS = 10 * 1000; private static final long LOCATION_UPDATE_DURATION_MILLIS = 10 * 1000; // Update duration extension multiplier for emergency REQUEST_LOCATION. private static final int EMERGENCY_LOCATION_UPDATE_DURATION_MULTIPLIER = 3; /** simpler wrapper for ProviderRequest + Worksource */ /** simpler wrapper for ProviderRequest + Worksource */ private static class GpsRequest { private static class GpsRequest { Loading Loading @@ -724,30 +726,35 @@ public class GnssLocationProvider extends AbstractLocationProvider implements Context.LOCATION_SERVICE); Context.LOCATION_SERVICE); String provider; String provider; LocationChangeListener locationListener; LocationChangeListener locationListener; LocationRequest locationRequest = new LocationRequest() .setInterval(LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS) .setFastestInterval(LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS); if (independentFromGnss) { if (independentFromGnss) { // For fast GNSS TTFF // For fast GNSS TTFF provider = LocationManager.NETWORK_PROVIDER; provider = LocationManager.NETWORK_PROVIDER; locationListener = mNetworkLocationListener; locationListener = mNetworkLocationListener; locationRequest.setQuality(LocationRequest.POWER_LOW); } else { } else { // For Device-Based Hybrid (E911) // For Device-Based Hybrid (E911) provider = LocationManager.FUSED_PROVIDER; provider = LocationManager.FUSED_PROVIDER; locationListener = mFusedLocationListener; locationListener = mFusedLocationListener; locationRequest.setQuality(LocationRequest.ACCURACY_FINE); } } Log.i(TAG, locationRequest.setProvider(provider); String.format( "GNSS HAL Requesting location updates from %s provider for %d millis.", provider, durationMillis)); LocationRequest locationRequest = LocationRequest.createFromDeprecatedProvider(provider, LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS, /* minDistance= */ 0, /* singleShot= */ false); // Ignore location settings if in emergency mode. // Ignore location settings if in emergency mode. if (isUserEmergency && mNIHandler.getInEmergency()) { if (isUserEmergency && mNIHandler.getInEmergency()) { locationRequest.setLocationSettingsIgnored(true); locationRequest.setLocationSettingsIgnored(true); durationMillis *= EMERGENCY_LOCATION_UPDATE_DURATION_MULTIPLIER; } } Log.i(TAG, String.format( "GNSS HAL Requesting location updates from %s provider for %d millis.", provider, durationMillis)); try { try { locationManager.requestLocationUpdates(locationRequest, locationManager.requestLocationUpdates(locationRequest, locationListener, mHandler.getLooper()); locationListener, mHandler.getLooper()); Loading @@ -765,6 +772,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements } } private void injectBestLocation(Location location) { private void injectBestLocation(Location location) { if (DEBUG) { Log.d(TAG, "injectBestLocation: " + location); } int gnssLocationFlags = LOCATION_HAS_LAT_LONG | int gnssLocationFlags = LOCATION_HAS_LAT_LONG | (location.hasAltitude() ? LOCATION_HAS_ALTITUDE : 0) | (location.hasAltitude() ? LOCATION_HAS_ALTITUDE : 0) | (location.hasSpeed() ? LOCATION_HAS_SPEED : 0) | (location.hasSpeed() ? LOCATION_HAS_SPEED : 0) | Loading Loading @@ -869,6 +879,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements private void handleUpdateLocation(Location location) { private void handleUpdateLocation(Location location) { if (location.hasAccuracy()) { if (location.hasAccuracy()) { if (DEBUG) { Log.d(TAG, "injectLocation: " + location); } native_inject_location(location.getLatitude(), location.getLongitude(), native_inject_location(location.getLatitude(), location.getLongitude(), location.getAccuracy()); location.getAccuracy()); } } Loading