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
This commit is contained in:
Neil Fuller
2022-07-18 13:55:06 +01:00
parent 0abfd5c416
commit d0a3929327
5 changed files with 79 additions and 32 deletions

View File

@@ -19,8 +19,5 @@ package com.android.settings.datetime;
import android.content.Context;
public interface UpdateTimeAndDateCallback {
// Minimum time is Nov 5, 2007, 0:00.
long MIN_DATE = 1194220800000L;
void updateTimeAndDateDisplay(Context context);
}