Commit Graph

135 Commits

Author SHA1 Message Date
Neil Fuller
7ddbef73f0 Fix a crash due to absence of no-arg fragment init
Fix a crash due to absence of no-arg fragment constructor.

e.g. if the dialog were shown and the device were rotated, the dialog
could not be restored.

Bug: 272439218
Test: Manual with repro steps before and after
Change-Id: Idca052acff709af132fa72f7919aa71fe8060595
2023-03-10 15:16:05 +00:00
Neil Fuller
37996acd7c Further status logic tweaks
Change the SettingsUI logic slightly: All other things being equal, pick
the "worst" location dependency status to show. Some renaming and
annotations for clarity.

Also fixes the mocking behavior in the tests around resources, which
were accidentally using the real strings and therefore dependent on real
resource string values. Tests are made more explicit.

Bug: 266921482
Test: atest tests/robotests/src/com/android/settings/datetime/LocationProviderStatusPreferenceControllerTest.java
Change-Id: Ifd96c543dad692884be23bf94e3f1294eed291d5
2023-02-13 15:03:32 +00:00
Neil Fuller
fc4f2ce81d Tweak status display logic and tests
The existing logic and tests looks incorrect. Tests have been tidied up
to reflect real cases. For example, it's not really possible for the
provider to report being "blocked", but for it to report it is "certain"
at the same time.

Bug: 266921482
Test: atest tests/robotests/src/com/android/settings/datetime/LocationProviderStatusPreferenceControllerTest.java
Change-Id: I1a0faa44ed7dd09828ff758db9e40f5d5e010ab0
2023-02-13 15:03:15 +00:00
Neil Fuller
4550e939bb Merge "(Re)Introduce "enabled by admin" UI state" 2023-02-03 10:14:03 +00:00
Neil Fuller
8e727b4dba (Re)Introduce "enabled by admin" UI state
(Re)Introduce "enabled by admin" / "disabled by admin" SettingsUI state.

ag/18665634 changed behavior: When enterprise policy restricts the
user's ability to change the "auto time" and "auto time zone" toggle,
the toggle was hidden rather than "visible but disabled".

Bug 266693620 demonstrates testers are checking for the behavior.

This commit returns the old behavior for the "auto time" and "auto time
zone" SettingUI behavior, i.e. the user can see the toggle and its
setting value, but is told that it is under admin control and the
current setting value.

See the bug for more info / historic behavior analysis.

Bug: 266693620
Test: Manual testing with TestDPC
Test: atest to confirm existing tests do not fail
Change-Id: I0a605054312547fbd44fc34025ee36b075e05e01
2023-02-01 14:02:17 +00:00
Neil Fuller
85327e0ed8 Add "Use location" state to TimeZoneCapabilities
Add the user's "Use location" state to TimeZoneCapabilities. This
information is available anyway and saves the SettingsUI needing to call
LocationManager directly (with the small possibility it would get an
inconsistent answer).

Bug: 262407244
Test: atest tests/robotests/src/com/android/settings/datetime/
Change-Id: I49d4e41b27f9817b3189a7643c24237603e36396
2023-01-26 14:52:31 +00:00
David Gutierrez
9ebb2fce7a Automatic timezone support on non-telephony devices
Adding to the Settings UI in order to simplify timezone on non-telephony devices.

Test: on-device testing, additional unit tests
Change-Id: I58ece9542a7b80823092bd082d4bd8c224b29634
Bug: 253015306
2022-12-21 16:39:32 +00:00
Arc Wang
12d4b78473 Merge "Extend SearchView width" into tm-qpr-dev am: 049deec9b5 am: 4cfe8b8204
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20337665

Change-Id: I7a3bdcfa520fe402da940e426a89b3ffd2c2b1e5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-02 08:41:11 +00:00
Arc Wang
4cfe8b8204 Merge "Extend SearchView width" into tm-qpr-dev am: 049deec9b5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20337665

Change-Id: I2f7807561257dc18be802f0acc90cce56ca71b98
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-02 08:07:13 +00:00
Arc Wang
0243771025 Extend SearchView width
To align SearchView x button with right border.

Bug: 254403811
Test: manual,
      Settings > Apps > See all apps > tap the search icon >
      input something and observe.
Change-Id: I5146c9ffb3c5177926e75f673497408092f6c065
2022-11-01 10:26:17 +00:00
Neil Fuller
f3c4f68abf Track method renames
Track method renames:

getSuggestManualTimeZoneCapability() ->
getSetManualTimeZoneCapability()

getSuggestManualTimeCapability() ->
getSetManualTimeCapability()

Assuming that TimeManager.setManualTime() and
TimeManager.setManualTimeZone() become system APIs in the next release,
they can be used in SettingsUI in place of
TimeDetector.suggestManualTime() and
TimeZoneDetector.suggestManualTimeZone() (in a later commit).

Bug: 236612872
Test: build only
Change-Id: Ifffc022c109fa68ae705e32400db9bfc8a1632ca
2022-10-03 13:59:00 +01:00
Sunny Shao
151a088094 Fix the header can't be scrolling problem in landscape mode
- Settings header is restricted scrolling by this ag/15029686
- To void some pages can't show the contain part while heading unscrolling.
  We allow the header can be scrolling in the landscape mode.

Fixes: 207353353
Test: make RunSettingsRoboTests -j
Change-Id: Ice97c6244716d4768167feb78588807d13b06a94
2022-08-11 15:33:45 +08:00
Neil Fuller
d0a3929327 Change high/low bound logic for manual date/time
This commit moves knowledge of the upper / lower bounds for valid manual
date suggestions to (internal) API calls.

It adds a test to confirm the API calls are used to configure the date
dialog.

Further, it removes redundant filtering from the client that would
prevent suggestion calls being made if the settings UI considers them
invalid. Year bounds are already used to limit the UI entry, and the
system server will return false from the service call if the suggestion
is invalid, though the SettingsUI doesn't do anything (behaviorally)
with the false before or after this change.  After this change it is
logged.

The goal of this change is to allow users with devices that don't have
the Y2038 issue to enter dates > 2037. This could have been done with
a smaller change, but the use of the new internal class
TimeDetectorHelper means that the bounds logic is in one place. The
lower bound (on mobile devices) can now be changed relatively easily by
touching one class.

Bug: 228967927
Test: m RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.datetime"
Change-Id: Iaf1ca8220e0e96773aa71b595da9c1ba1e50d59d
2022-07-19 13:43:36 +01:00
Sunny Shao
d46dff8d4f Fix UI flicker problem and update wordings
- "Set time zone automatically" changes to "Set automatically".
- "Use location to set time zone" changes to "Use location"
- Add a new summary text with "Location may be used to set time zone".

Fixes: 233968737
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.datetime
Change-Id: Ia16c428e906cda4ebe052bad83c3f574075a7a64
2022-06-23 10:52:23 +08:00
Neil Fuller
579a19a793 Switch auto time setting to use APIs
Switch auto time setting to use TimeManager APIs instead of low-level
direct settings access.

This makes the AutoTimePreferenceController approach the same as
AutoTimeZonePreferenceController. Most of the logic about what to
display and whether toggles are enabled is moved to the service.

This change has the side effect of adding support in SettingsUI for
devices with no auto time detection mechanism configured at all, i.e.
the auto time toggle will stop being shown in SettingsUI. There are no
known devices that require this currently, but it is a theoretical
possibility if config.xml is configured in particular ways.

Bug: 172891783
Test: Manual testing with different settings for "time origin
priorities" (i.e. empty, non-empty)
Test: m ROBOTEST_FILTER=com.android.settings.datetime RunSettingsRoboTests -j40

Change-Id: I4112fb51adb0d06a1dbc39a44ea109d6df899153
2022-06-06 12:41:11 +01:00
Neil Fuller
6187efa066 Merge "Capitalize TZ display name strings" am: 6a44151bc1 am: 3bb5fc5da8 am: 32a00bf719 am: 4c44d26387
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2055886

Change-Id: Ica49004e2863bf98532a79214cb60b82544e8ddd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 05:06:18 +00:00
Neil Fuller
6a44151bc1 Merge "Capitalize TZ display name strings" 2022-05-03 19:22:03 +00:00
Victor Chang
fbad0f3ca9 Merge "Titlecasing time zone summary" am: 1d6e9cfdf2 am: 16aca1db9f am: e12caf5c9b am: 09a7871c30
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2077567

Change-Id: I7d8725c0010ec50450cc12e9216dc28cc6cd40d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-03 14:45:43 +00:00
Victor Chang
20e9b76818 Titlecasing time zone summary
Additional fix:
1. Fixed the SpannableUtil.getResourcesText to actually
preserve Spannable (TtsSpan in this use case)  during formatting.

Bug: 185453652
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.datetime.timezone
Change-Id: Iae5e1d4261ec0a34222ae1d042c7f3f027f2e512
2022-04-29 17:06:46 +01:00
Neil Fuller
3fe57a8ac3 Fix logic used for auto time zone settings
Fix the logic used that determines whether the automatic time
zone detection toggle is available in the Settings UI Date & Time
screen. Also, ensure that the TimeZonePreferenceController uses correct
logic for whether the user can manually enter a time zone.

This change migrates the controllers to use a existing high-level
TimeManager API rather than (incorrectly) duplicating in Settings UI the
logic for whether time zone detection is supported / enabled.

Without this change, WiFi-only devices _with_ location-based time zone
detection enabled would incorrectly hide the "auto time zone" toggle,
which would have the knock-on of making it look like the user is allowed
to enter a time zone manually when they aren't (because it is
enabled/disabled based on the presence of the toggle).

That toggle still needs to be present while there is a possible time
zone detection mechanism. All the (quite complex) logic around this is
already considered by the TimeManager API.

Possible side effects:

This change decouples the "does the toggle show true or false?"
(isEnabled()) from the "should the toggle be shown at all?"
(isAvailable()) logic by removing a call to isAvailable() inside of
isEnabled(). This is to avoid making multiple (probably more expensive
than what it was doing before) calls to the time_zone_detector service,
and avoid the extra complexity of caching / cache invalidation that
would be needed to mitigate it. Previously, as a result of the call to
isAvailable(), isEnabled() would always return false when mIsFromSUW is
true, but now it will return the underlying value of the device's
auto_time_zone setting. This means that if the UI is changed in future
to render a visible-but-can't-be-changed-by-the-user toggle for auto
time zone, it will display the current setting value, which is perfectly
reasonable.  It is assumed it will have no other side effects.

The AutoTimeZonePreferenceControllerTest.isFromSUW_notEnable test has
been changed to reflect the change in behavior. Various name changes
made to tests to reflect the new behavior.

Bug: 228247623
Bug: 186625820
Bug: 172891783
Test: treehugger
Test: Manual test on a device with telephony
Test: m ROBOTEST_FILTER=AutoTimeZonePreferenceControllerTest RunSettingsRoboTests -j40
Test: m ROBOTEST_FILTER=TimeZonePreferenceControllerTest RunSettingsRoboTests -j40
Change-Id: I4c7608e8645eee5994c8ecf85a14a27d3278ac04
(cherry picked from commit 7a8ac683d4)
2022-04-19 15:27:29 +00:00
Neil Fuller
e7fd120d8e Capitalize TZ display name strings
Capitalize Settings UI time zone display name strings for languanges
like Polish for standalone locations like summaries and lists. The
motivating example case is the string for "Coordinated Universal Time"
in Polish, which is not capitalized in CLDR, as they capitalize for the
middle of sentences by default. In English, Coordinated Universal Time
is already capitalized, but the Polish string is not.

With this commit all "display name"-like strings have been capitalized
(region names, exemplar locations, time zone names like
"Coordinated Universal Time" and "British Summer Time") for
completeness. For the Polish case, many are already capitalized, but
capitalizing the first letter is therefore a no-op. The
"GMT+xx:xx"-style strings have not been changed.

Bug: 190109975
Test: Visual inspection in English and Polish of UTC, United States,
Russia in the time zone picker and the date & time screen on mobile

Change-Id: I57d915ac1e30e22cc05e605fcb7d46b102fa8ce1
2022-04-05 15:51:05 +01:00
Jason Chiu
56dde819dc Merge "Define a constant Sliceable#NO_RES for no resource cases" into sc-v2-dev am: 1565bba600
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16177442

Change-Id: I6a3448e6e54666b45f6f67288593034a03d50d64
2021-11-03 06:54:55 +00:00
Jason Chiu
9fc0f18181 Define a constant Sliceable#NO_RES for no resource cases
Fix: 204733076
Test: build
Change-Id: Ifa3b9db0e915a3ec056ad68a9a1862811594d423
2021-11-03 12:23:49 +08:00
Jason Chiu
026b1b5df6 Merge changes from topic "slice-highlight" into sc-v2-dev am: 6821b6be32
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16151654

Change-Id: Ib03d41631d8bf961fa3ff3957eb5452411da7792
2021-11-02 02:28:16 +00:00
Jason Chiu
2989c50a23 Add highlight menu keys for all toggle pref controllers and custom slices
Bug: 204695404
Test: manual, robotest build pass, unit
Change-Id: Iad2e28ada8ddb766ffa7eff2c8dc581250cbd6f8
2021-11-01 15:00:18 +08:00
vichang
e6bf1a83d8 Merge "Replace @CorePlatformApi APIs usages in TimeZoneInfoPreferenceControllerTest" am: 3166166bdd
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1831314

Change-Id: I458bf767bbea8b5921f00afae884d309d270f7b0
2021-09-21 10:52:53 +00:00
vichang
3166166bdd Merge "Replace @CorePlatformApi APIs usages in TimeZoneInfoPreferenceControllerTest" 2021-09-21 10:42:27 +00:00
Victor Chang
fc4589448b Replace @CorePlatformApi APIs usages in TimeZoneInfoPreferenceControllerTest
The time zone transitions can be obtained via the public API
ZoneId.getRules() instead.

Bug: 119751170
Test: atest SettingsRoboTests
     com.android.settings.datetime.timezone.TimeZoneInfoPreferenceControllerTest passes
Change-Id: I2c7864580b2a36b725ee250253e97f6cc86d72a4
2021-09-20 15:57:42 +01:00
Neil Fuller
d2eca211d4 Merge "Swap ownership to mingaleev@" am: f6fe44dc91
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1824113

Change-Id: I9be5d173953df0a90ee1309feceed35f9240c18c
2021-09-13 11:17:50 +00:00
Neil Fuller
b46adff0f4 Swap ownership to mingaleev@
BUG=189810551

Change-Id: I6304545540947d6695117753309c80b27cf2669a
2021-09-10 12:20:39 +00:00
Tsung-Mao Fang
232b3ac12a Disable the scrollable ability on app bar area
As title, we do not allow user can scroll app bar while
the search menu is expanding.
So, we can ignore all drag events on app bar.

Test: Can not scroll on the app bar area
Fix: 181741353
Change-Id: I20c0b69059cdc4d13a15abd810a725d4591f6396
2021-06-17 19:29:25 +08:00
Tsung-Mao Fang
11c4b2c51e Remove the large space when searching region list
Collapse the tool bar when we're doing search for
a better user experience.
And we don't allow user can expand the tool bar at this moment
since it will see a large space at this moment.

Fix: 181741353
Test: Open the page and don't see a huge space now.
Change-Id: Iec5ebe9b22a2aad15dc8cf90113a64c358ee447e
2021-06-08 11:44:38 +00:00
Almaz Mingaleev
6be940f396 Do not show toggle for location tz detection in search.
It also makes setting in line with "Set time zone
automatically", which is rendered w/o toggle on search page.

Bug: 185906072
Test: manually verified that toggle is not shown
Test: m -j30 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceControllerTest"
Change-Id: Ie71572c4a9b9bd6adf3660556363331e2943fd5b
2021-04-23 10:29:58 +00:00
Almaz Mingaleev
18c9ff9bd2 Merge "Move MIN_USE_DATE_OF_TIMEZONE to TimeUtils." am: e3d4e39144 am: 90d5572fa5 am: f3a44236e3
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1658001

Change-Id: I3f3ce9f7dc0528e492473dcf1f8344f0518119e1
2021-04-07 19:28:22 +00:00
Almaz Mingaleev
3be24f4ab2 Move MIN_USE_DATE_OF_TIMEZONE to TimeUtils.
That timestamp is used in two places for the same purpose.

Bug: 155738410
Test: presubmit
Change-Id: Ia6836fd34c63aef6e335ef97922d34a60dbf3703
2021-04-06 14:10:05 +01:00
Almaz Mingaleev
dea929aa06 resolve merge conflicts of 7d9233302f to sc-dev
Change-Id: I7f6b7b035cc9c37a168e97ddeac5c8de9d5910de
2021-03-30 11:43:33 +00:00
Almaz Mingaleev
dd2a685756 Allow alternative time zone ID to be set device's zone.
If America/Godthab is set as device time zone, display it as if
America/Nuuk is chosen.
If time zone is known, but is not an alternative and not shown
in time zone picker, region will de derived from user's locale.

Bug: 155738410
Test: atest com.android.settings.datetime.timezone.model
Test: set persist.sys.timezone via adb and checked
Date & Time screen

Change-Id: I168fb4319e144dbe9e2496d06a681d4c09b411c0
2021-03-29 11:18:57 +01:00
Almaz Mingaleev
fcf1fcfe9b Show pop-up banner when Location is off and user tries to enable GeoTZ.
As of now GeoTZ state remains unchanged even if user enables
Location toggle.

Bug: 152746236
Test: m -j30 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceControllerTest"
Test: checked manually that dialog opens Location settings page
Change-Id: I5fd3288e9d5a7aac3bc82da6944b4ccd6bb9e0f5
2021-03-23 19:43:49 +00:00
Almaz Mingaleev
a29a6ceab4 Fix imports in LocationTimeZoneDetectionPreferenceController.
Capabilities are extracted to separate class to reuse them
in time API.

Bug: 172891783
Test: m -j30 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceControllerTest"
Change-Id: If7351c4f022c69262ddffd26efacd449dc7238c5
2021-03-11 17:58:26 +00:00
Almaz Mingaleev
ab05918e08 Move GeoTZ toggle to Date&Time settings screen.
Previous sub-menu is deleted.

Toggle is always enabled and shows current configuration
setting. If MLS or auto time zone detection is off,
the toggle has not effect.

Bug: 152746236
Test: toggled and checked dumpsys time_zone_detector
Test: checked summary info on different MLS/set time zone automatically
states combinations
Test: m -j30 RunSettingsRoboTests
ROBOTEST_FILTER="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceControllerTest"

Change-Id: I75ee41cfcaaf34b1b63e18809be4cd614446017d
Merged-In: I75ee41cfcaaf34b1b63e18809be4cd614446017d
2021-03-10 11:07:36 +00:00
Neil Fuller
218404394f Move the Location time zone detection setting
Move the Location time zone detection setting to Date & Time as per
UI review / product request.

This initial commit just moves the existing MVP setting behavior to a
different screen. Still invisible by default.

Enable with:
$ adb shell setprop persist.sys.location_time_zone_detection_feature_enabled 1
.. plus a reboot.

Bug: 152746236
Test: Manual: build / boot / toggle switch in SettingsUI / inspect output of adb shell dumpsys time_zone_detector
Test: m -j30 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.datetime.LocationTimeZoneDetectionPreferenceControllerTest"
Test: m -j30 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.datetime.locationtimezone.TimeZoneDetectionTogglePreferenceControllerTest"
Test: m -j30 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.datetime.locationtimezone.TimeZoneDetectionSettingsTest"
Change-Id: I9ecfa853014a9f92086a9cb2d34e1517474ceb93
2020-11-10 09:23:22 +00:00
Edgar Wang
8829e515ca Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: Ibe64a68d7bddf84780dfac33555c097ff55c97a8
2020-07-30 12:54:27 +08:00
vichang
bc7f639e15 Merge "Move libcore.timezone to the i18n module - Final part" am: 268371c44e am: 7485036f53
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1348663

Change-Id: I8e81b3d707bce016006bf0af1f75785ecd15648e
2020-07-02 10:50:06 +00:00
Victor Chang
b07e53c1c8 Move libcore.timezone to the i18n module - Final part
Bug: 141747409
Test: atest CtsLibcoreTestCases  CtsLibcoreTestCases
Change-Id: I48a1f383403a553639f525ef92996292fab84c5e
2020-06-30 14:35:09 +01:00
Neil Fuller
6bcbd8ed89 Merge "Fix missing zone strings in some cases" am: 738df11447 am: 6a19fdf877
Change-Id: Id54f91141814eb0f1adda28f9ec72b48f434c997
2020-04-29 12:45:01 +00:00
Neil Fuller
eafec7a244 Fix missing zone strings in some cases
ICU's TimeZoneNames requires a "canonical" zone ID, otherwise it will
return no data. Usually the ID being used is the same as the canonical
ID so there's no problem. TZDB version 2020a switched the ID of one of
Greenland's zones from America/Godthab to America/Nuuk, and ICU/CLDR
hold their translation data against America/Godthab in the current
version of ICU on Android.

Bug: 155167041
Test: Manual - viewed settings on a device with the tzdb 2020a update
Change-Id: Ia89c777a832f8b41c8d56d3327a9b7370ba44b52
2020-04-29 10:16:19 +01:00
Tobias Thierer
f5b13fe3b1 Merge "OWNERS: Remove tobiast." am: dffcd7a949 am: 21b01bc4f2
Change-Id: Ie2a65cdd33e7922685153fcb1eb17791fcf562a6
2020-03-27 11:51:34 +00:00
Tobias Thierer
a854ddae3d OWNERS: Remove tobiast.
Test: Manual CL review only.
Bug: 152399425
Change-Id: Ifca2d6e8ecd59a924c6e5d8ca60749be5d5c8728
2020-03-26 12:17:00 +00:00
Automerger Merge Worker
de86f9c950 Merge "Tidy up libcore.timezone APIs" am: 45834d96a8 am: 35ffa52384 am: 798407a441
Change-Id: I486df8f44bcd67baf933853145f7617cf6b0e891
2020-01-31 16:32:04 +00:00
Neil Fuller
7b54a31132 Tidy up libcore.timezone APIs
Tidy up the libcore.timezone APIs to make them as close as possible to
android.timezone. In future, these classes should be repackages to be
the actual android.timezone classes, so the APIs need to be in sync.

Bug: 148086409
Test: treehugger
Change-Id: I8d0521467bb3c3c8741ce98f50cde0ee8c1bec1a
2020-01-28 15:08:31 +00:00