From 8ad07e271f1acb30746502fd69a9d6260832f877 Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Tue, 13 Dec 2022 14:49:06 +0000 Subject: Refactoring: Support alt. network time source Refactoring to support an alternative source of network time for passing to the GNSS component. The new implementation will be submitted in a follow-up. NtpTimeHelper has been replaced by NetworkTimeHelper in GnssLocationProvider. NetworkTimeHelper provides the stable interface between GnssLocationProvider and the original / alternative impl for what was NtpTimeHelper. NtpTimeHelper has been renamed NtpNetworkTimeHelper. These changes are not intended to change any behavior. There are some minor changes between the interaction between GnssLocationProvider and the NetworkTimeHelper class, but these are not expected to alter the runtime behavior. The NetworkTimeHelper.setPeriodicTimeInjectionMode() method touches a pre-existing bug: The method name reflected the effect of the method, which is the near-opposite of what the capability name would suggest. This appears to be due to an accidental logic inversion, not by intent. As can be seen in the changes for GnssLocationProvider: the enablePeriodicTimeInjection() method was called when mGnssNative.getCapabilities().hasOnDemandTime() was true. The existence of bug 73893222 supports the fact that there is a long-standing bug here. The intent with this commit is not to fix it or alter behavior, just to make it more obvious, as it is unclear if the current behavior is relied upon somewhere. Comments and field names have been improved to try to clarify the actual behavior. Bug: 73893222 Bug: 222295093 Test: atest services/robotests/src/com/android/server/location/gnss/NtpNetworkTimeHelperTest.java Change-Id: I0b1ba43a55ff531df343c022650e3f5721dda7f1 --- location/java/android/location/GnssCapabilities.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'location/java') diff --git a/location/java/android/location/GnssCapabilities.java b/location/java/android/location/GnssCapabilities.java index f9f9fa47df97..11b5833e35b3 100644 --- a/location/java/android/location/GnssCapabilities.java +++ b/location/java/android/location/GnssCapabilities.java @@ -240,7 +240,11 @@ public final class GnssCapabilities implements Parcelable { } /** - * Returns {@code true} if GNSS chipset supports on demand time, {@code false} otherwise. + * Returns {@code true} if GNSS chipset requests periodic time signal injection from the + * platform in addition to on-demand and occasional time updates, {@code false} otherwise. + * + *

Note: The naming of this capability and the behavior it controls differ substantially. + * This is the result of a historic implementation bug, b/73893222. */ public boolean hasOnDemandTime() { return (mTopFlags & TOP_HAL_CAPABILITY_ON_DEMAND_TIME) != 0; -- cgit v1.2.3-59-g8ed1b