Loading location/java/android/location/LocationResult.java +35 −47 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package android.location; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.location.flags.Flags; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; Loading Loading @@ -126,7 +125,6 @@ public final class LocationResult implements Parcelable { final int size = mLocations.size(); for (int i = 0; i < size; ++i) { Location location = mLocations.get(i); if (Flags.locationValidation()) { if (location.getLatitude() < -90.0 || location.getLatitude() > 90.0 || location.getLongitude() < -180.0 Loading Loading @@ -166,16 +164,6 @@ public final class LocationResult implements Parcelable { Log.w(TAG, "removed bad location speed: " + location.getSpeed()); location.removeSpeed(); } } else { if (!location.isComplete()) { throw new IllegalArgumentException( "incomplete location at index " + i + ": " + mLocations); } if (location.getElapsedRealtimeNanos() < prevElapsedRealtimeNs) { throw new IllegalArgumentException( "incorrectly ordered location at index " + i + ": " + mLocations); } } prevElapsedRealtimeNs = location.getElapsedRealtimeNanos(); } Loading location/java/android/location/flags/location.aconfig +0 −52 Original line number Diff line number Diff line Loading @@ -77,47 +77,6 @@ flag { is_exported: true } flag { name: "release_supl_connection_on_timeout" namespace: "location" description: "Flag for releasing SUPL connection on timeout" bug: "315024652" } flag { name: "location_validation" namespace: "location" description: "Flag for location validation" bug: "314328533" } flag { name: "replace_future_elapsed_realtime_jni" namespace: "location" description: "Flag for replacing future elapsedRealtime in JNI" bug: "314328533" } flag { name: "use_legacy_ntp_time" namespace: "location" description: "Flag for switching to legacy NtpNetworkTimeHelper" bug: "368034558" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "subscriptions_changed_listener_thread" namespace: "location" description: "Flag for running onSubscriptionsChangedListener on FgThread" bug: "332451908" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "gnss_configuration_from_resource" namespace: "location" Loading @@ -137,17 +96,6 @@ flag { is_exported: true } flag { name: "enable_ni_supl_message_injection_by_carrier_config" namespace: "location" description: "Flag for enabling NI SUPL message injection by carrier config" bug: "242105192" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "population_density_provider" namespace: "location" Loading services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java +9 −18 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED; import android.annotation.RequiresPermission; import android.content.Context; import android.location.flags.Flags; import android.net.ConnectivityManager; import android.net.LinkAddress; import android.net.LinkProperties; Loading Loading @@ -203,12 +202,8 @@ class GnssNetworkConnectivityHandler { SubscriptionManager subManager = mContext.getSystemService(SubscriptionManager.class); if (subManager != null) { if (Flags.subscriptionsChangedListenerThread()) { subManager.addOnSubscriptionsChangedListener(FgThread.getExecutor(), mOnSubscriptionsChangeListener); } else { subManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener); } } PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); Loading Loading @@ -652,13 +647,11 @@ class GnssNetworkConnectivityHandler { mSuplConnectivityCallback, mHandler, SUPL_NETWORK_REQUEST_TIMEOUT_MILLIS); if (Flags.releaseSuplConnectionOnTimeout()) { // Schedule to release the SUPL connection after timeout mHandler.removeCallbacksAndMessages(mSuplConnectionReleaseOnTimeoutToken); mHandler.postDelayed(() -> handleReleaseSuplConnection(GPS_RELEASE_AGPS_DATA_CONN), mSuplConnectionReleaseOnTimeoutToken, SUPL_CONNECTION_TIMEOUT_MILLIS); } } catch (RuntimeException e) { Log.e(TAG, "Failed to request network.", e); mSuplConnectivityCallback = null; Loading Loading @@ -689,10 +682,8 @@ class GnssNetworkConnectivityHandler { Log.d(TAG, message); } if (Flags.releaseSuplConnectionOnTimeout()) { // Remove pending task to avoid releasing an incorrect connection mHandler.removeCallbacksAndMessages(mSuplConnectionReleaseOnTimeoutToken); } if (mAGpsDataConnectionState == AGPS_DATA_CONNECTION_CLOSED) { return; } Loading services/core/java/com/android/server/location/gnss/NetworkTimeHelper.java +1 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import android.annotation.CurrentTimeMillisLong; import android.annotation.ElapsedRealtimeLong; import android.annotation.NonNull; import android.content.Context; import android.location.flags.Flags; import android.os.Looper; import java.io.PrintWriter; Loading Loading @@ -56,14 +55,8 @@ abstract class NetworkTimeHelper { static NetworkTimeHelper create( @NonNull Context context, @NonNull Looper looper, @NonNull InjectTimeCallback injectTimeCallback) { if (!Flags.useLegacyNtpTime()) { TimeDetectorNetworkTimeHelper.Environment environment = new TimeDetectorNetworkTimeHelper.EnvironmentImpl(looper); return new TimeDetectorNetworkTimeHelper(environment, injectTimeCallback); } else { return new NtpNetworkTimeHelper(context, looper, injectTimeCallback); } } /** * Sets the "on demand time injection" mode. Loading services/core/jni/gnss/Utils.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include <android/hardware/gnss/1.0/IGnss.h> #include <android/hardware/gnss/2.0/IGnss.h> #include <android_location_flags.h> #include <utils/SystemClock.h> /* * Save a pointer to JavaVm to attach/detach threads executing Loading @@ -28,8 +27,6 @@ */ JavaVM* android::ScopedJniThreadAttach::sJvm; namespace location_flags = android::location::flags; namespace android { namespace { Loading Loading @@ -197,8 +194,7 @@ jobject translateGnssLocation(JNIEnv* env, const android::hardware::gnss::GnssLo flags = static_cast<uint32_t>(location.elapsedRealtime.flags); if (flags & android::hardware::gnss::ElapsedRealtime::HAS_TIMESTAMP_NS) { if (location_flags::replace_future_elapsed_realtime_jni() && location.elapsedRealtime.timestampNs > android::elapsedRealtimeNano()) { if (location.elapsedRealtime.timestampNs > android::elapsedRealtimeNano()) { SET(ElapsedRealtimeNanos, android::elapsedRealtimeNano()); } else { SET(ElapsedRealtimeNanos, location.elapsedRealtime.timestampNs); Loading Loading
location/java/android/location/LocationResult.java +35 −47 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package android.location; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.location.flags.Flags; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; Loading Loading @@ -126,7 +125,6 @@ public final class LocationResult implements Parcelable { final int size = mLocations.size(); for (int i = 0; i < size; ++i) { Location location = mLocations.get(i); if (Flags.locationValidation()) { if (location.getLatitude() < -90.0 || location.getLatitude() > 90.0 || location.getLongitude() < -180.0 Loading Loading @@ -166,16 +164,6 @@ public final class LocationResult implements Parcelable { Log.w(TAG, "removed bad location speed: " + location.getSpeed()); location.removeSpeed(); } } else { if (!location.isComplete()) { throw new IllegalArgumentException( "incomplete location at index " + i + ": " + mLocations); } if (location.getElapsedRealtimeNanos() < prevElapsedRealtimeNs) { throw new IllegalArgumentException( "incorrectly ordered location at index " + i + ": " + mLocations); } } prevElapsedRealtimeNs = location.getElapsedRealtimeNanos(); } Loading
location/java/android/location/flags/location.aconfig +0 −52 Original line number Diff line number Diff line Loading @@ -77,47 +77,6 @@ flag { is_exported: true } flag { name: "release_supl_connection_on_timeout" namespace: "location" description: "Flag for releasing SUPL connection on timeout" bug: "315024652" } flag { name: "location_validation" namespace: "location" description: "Flag for location validation" bug: "314328533" } flag { name: "replace_future_elapsed_realtime_jni" namespace: "location" description: "Flag for replacing future elapsedRealtime in JNI" bug: "314328533" } flag { name: "use_legacy_ntp_time" namespace: "location" description: "Flag for switching to legacy NtpNetworkTimeHelper" bug: "368034558" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "subscriptions_changed_listener_thread" namespace: "location" description: "Flag for running onSubscriptionsChangedListener on FgThread" bug: "332451908" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "gnss_configuration_from_resource" namespace: "location" Loading @@ -137,17 +96,6 @@ flag { is_exported: true } flag { name: "enable_ni_supl_message_injection_by_carrier_config" namespace: "location" description: "Flag for enabling NI SUPL message injection by carrier config" bug: "242105192" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "population_density_provider" namespace: "location" Loading
services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java +9 −18 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED; import android.annotation.RequiresPermission; import android.content.Context; import android.location.flags.Flags; import android.net.ConnectivityManager; import android.net.LinkAddress; import android.net.LinkProperties; Loading Loading @@ -203,12 +202,8 @@ class GnssNetworkConnectivityHandler { SubscriptionManager subManager = mContext.getSystemService(SubscriptionManager.class); if (subManager != null) { if (Flags.subscriptionsChangedListenerThread()) { subManager.addOnSubscriptionsChangedListener(FgThread.getExecutor(), mOnSubscriptionsChangeListener); } else { subManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener); } } PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); Loading Loading @@ -652,13 +647,11 @@ class GnssNetworkConnectivityHandler { mSuplConnectivityCallback, mHandler, SUPL_NETWORK_REQUEST_TIMEOUT_MILLIS); if (Flags.releaseSuplConnectionOnTimeout()) { // Schedule to release the SUPL connection after timeout mHandler.removeCallbacksAndMessages(mSuplConnectionReleaseOnTimeoutToken); mHandler.postDelayed(() -> handleReleaseSuplConnection(GPS_RELEASE_AGPS_DATA_CONN), mSuplConnectionReleaseOnTimeoutToken, SUPL_CONNECTION_TIMEOUT_MILLIS); } } catch (RuntimeException e) { Log.e(TAG, "Failed to request network.", e); mSuplConnectivityCallback = null; Loading Loading @@ -689,10 +682,8 @@ class GnssNetworkConnectivityHandler { Log.d(TAG, message); } if (Flags.releaseSuplConnectionOnTimeout()) { // Remove pending task to avoid releasing an incorrect connection mHandler.removeCallbacksAndMessages(mSuplConnectionReleaseOnTimeoutToken); } if (mAGpsDataConnectionState == AGPS_DATA_CONNECTION_CLOSED) { return; } Loading
services/core/java/com/android/server/location/gnss/NetworkTimeHelper.java +1 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import android.annotation.CurrentTimeMillisLong; import android.annotation.ElapsedRealtimeLong; import android.annotation.NonNull; import android.content.Context; import android.location.flags.Flags; import android.os.Looper; import java.io.PrintWriter; Loading Loading @@ -56,14 +55,8 @@ abstract class NetworkTimeHelper { static NetworkTimeHelper create( @NonNull Context context, @NonNull Looper looper, @NonNull InjectTimeCallback injectTimeCallback) { if (!Flags.useLegacyNtpTime()) { TimeDetectorNetworkTimeHelper.Environment environment = new TimeDetectorNetworkTimeHelper.EnvironmentImpl(looper); return new TimeDetectorNetworkTimeHelper(environment, injectTimeCallback); } else { return new NtpNetworkTimeHelper(context, looper, injectTimeCallback); } } /** * Sets the "on demand time injection" mode. Loading
services/core/jni/gnss/Utils.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include <android/hardware/gnss/1.0/IGnss.h> #include <android/hardware/gnss/2.0/IGnss.h> #include <android_location_flags.h> #include <utils/SystemClock.h> /* * Save a pointer to JavaVm to attach/detach threads executing Loading @@ -28,8 +27,6 @@ */ JavaVM* android::ScopedJniThreadAttach::sJvm; namespace location_flags = android::location::flags; namespace android { namespace { Loading Loading @@ -197,8 +194,7 @@ jobject translateGnssLocation(JNIEnv* env, const android::hardware::gnss::GnssLo flags = static_cast<uint32_t>(location.elapsedRealtime.flags); if (flags & android::hardware::gnss::ElapsedRealtime::HAS_TIMESTAMP_NS) { if (location_flags::replace_future_elapsed_realtime_jni() && location.elapsedRealtime.timestampNs > android::elapsedRealtimeNano()) { if (location.elapsedRealtime.timestampNs > android::elapsedRealtimeNano()) { SET(ElapsedRealtimeNanos, android::elapsedRealtimeNano()); } else { SET(ElapsedRealtimeNanos, location.elapsedRealtime.timestampNs); Loading