Support geo-tz detection on non-telephony devices
Begin explicit support for time zone detection on devices that do not have telephony. Previously, stock Android devices with automatic time zone detection were assumed to have a telephony stack, and telephony has historically been Android's "main" time zone detection algorithm. Location-based time zone detection has been considered an optional add-on that could be layered on top as an alterntive to telephony-based detection. The system time team has received requests to support automatic time zone detection on devices that do not have a telephony stack by (solely) offering the location-based tz detection algorithm. This commit contains the system-server changes needed to enable this config state, i.e. so automatic tz detection is supported on the device but only via the location-detection algorithm. The implications after this commit for user configuration via stock SettingsUI code: + (Unchanged) For devices without automatic tz detection, the SettingsUI presents no toggles associated with automatic time zone detection. The user can only manually select a time zone on these devices. + (Unchanged) For devices with only telephony-based tz detection, the SettingsUI shows one toggle: "Set [time zone] automatically". This is a global setting that affects all users. + (Unchanged) For devices with both telephony and location-based tz detection algorithms "supported", the SettingsUI presents two toggles: 1) "Set [time zone] automatically" (as above) 2) "Use location [to set time zone]", this is a user-scoped setting that selects between using the location and telephony-based detection algorithms (modulo "telephony fallback mode", which causes telephony signals to be used in some cases even when location-based detection is enabled). + (New) For devices with ONLY location-based tz detection configured / supported, the SettingsUI presents one toggle: "Set [time zone] automatically" (still a global setting, as above). For the new case that this commit unlocks, there is no value to presenting a user with "Use location" as well as "Set automatically", since the device would have no useful behavior if "Set automatically" were ON and "Use location" were OFF, i.e. lacking the other algorithm to use instead. Instead, these location-algorithm-only devices DO NOT offer a per-user choice of "Use location", and the behavior is hardcoded as if the current user had set the "Use location" toggle to ON. Note: No actual settings for "Use location" are stored in this new case as using location is not an explicit choice by the user. Another important point for devices without telephony is that they may also lack GNSS hardware needed to get location. In, for example, GMS devices, a device without a telephony radio and GNSS receiver is still able to use signals like WiFi APs for detecting location, but this ability is determined by GMS-specific user settings. Since these location detection APIs and their associated settings are not part of the standard Android SDK APIs, the platform cannot directly interrogate them. Consequently, even if the user selects "Set [time zone] automatically" on a device without telephony, this means there is no guarantee that an LTZP that uses proprietary location detection mechanisms will actually be able to obtain the current location. To address this, in other changes made recently, the LTZP can now choose to report status information via new LTZP System APIs. These APIs enable the LTZP to tell the platform when the LTZP cannot work properly, e.g. when location cannot be obtained because of the user's current settings (Status: "BLOCKED_BY_SETTINGS"). New status information has also been added in a separate commit to the TimeZoneCapabilitiesAndConfig class used by SettingsUI. Note: LTZPs will have to start reporting their status for SettingsUI to get the status information, but this offers a path for LTZPs to generically report when location-based time zone detection is degraded or broken due to restrictions in proprietary logic. Later commits will be needed to add widgets to hold text and status information to SettingsUI to improve the UX, e.g. to explain when the LTZP cannot work properly, or clarify any implications of enabling "Set automatically". Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/ Bug: 253015306 Change-Id: Ib60109a23d0a5a7499c5dd16a2994eed4485d9c9
Loading
Please register or sign in to comment