Draw the first and the last labels. Then recursively draws axis labels between the start index and the end index. If the inner number can be exactly divided into 2 parts, check and draw the middle index label and then recursively draw the 2 parts. Otherwise, divide into 3 parts. Check and draw the middle two labels and then recursively draw the 3 parts. If there are any overlaps, skip drawing and go back to the uplevel of the recursion.
screenshots: https://drive.google.com/drive/folders/11AJ4Fz6xS76LGlbAy9WfvjZpffgFkMji?resourcekey=0-HBWCQa1oQW4e0UfvLzEXGQ&usp=sharing
Bug: 242009481
Fix: 242009481
Test: manual
Change-Id: Iaa9019feba7693638d5ae64bbbee7298eb74f749
This bug is because we always use mHourlyChartIndex to construct
every view model in mHoulyViewModels. However, mHourlyChartIndex could
be got from saved instance. So mHourlyChartIndex may be out of bound in
some hourly view model which has not many hours data.
This fix removes the selectedIndex in BatteryChartViewModel constructor. Suppose the selectedIndex should be set everytime the view model is used.
Test: manual
Bug: 236101166
Bug: 241872474
Change-Id: I0bb5568ac33fcc23c406fe3af308b8d2706c5542
Moving the old restricted page to the new optimization page will happen
in a follow-up CL.
Test: Unit, manual
Bug: 238026672
Change-Id: I5fee9ebe03284a013da6bfca9ada8b166c6af91c
Support showing labels under the trapezoids instead of between the
trapezoids. For daily chart, the labels are under the trapezoids, for
hourly chart, the labels are between the trapezoids.
Test: manual
Bug: 239491373
Bug: 236101166
Change-Id: I2efb5192d4baafc7745ce269224639511848293e
If the battery level data cannot be gotten for an hour, ag/19358207 changes the level indication from 0 to null. This cl updates the battery chart view trapezoid validation logic from checking the level not zero to not null.
Test: manual
Bug: 236101166
Change-Id: I240f2b02b94ba1a3d99022c7c72a7a5adb21f9a5
- Move interpolation from DatabaseUtil
- Add the logic to wrap processed history map to BatteryLevelData
- Change ImmutableList to List in BatteryLevelData because
ImmutableList.of doesn't support null element.
Bug: 236101687
Test: make RunSettingsRoboTests
Change-Id: I0a842f24e5481faf65f667c08a4fdc11fe2f235c
When users click the battery chart, the orignal behavior is that the view changes the state by itself.
This cl refactors the bahavior to that the view callbacks to the controller, and
the controller changes the view's state.
In this way, the controller is the only source of truth of the state.
This meets the controller-view model.
Test: manual
Bug: 239491373, 236101166
Change-Id: I754ded2dba20319f1571374dfdbef27f2420ed78
Add class BatteryDiffData used to parcel battery usage diff data per
apps. It behaves as an interface between UI and data.
Bug: 236101687
Test: make RunSettingsRoboTests
Change-Id: I59daa9e8c5de2105ebf24c7a585c02e554735e78
- Keep apps optimize state as what it set even it's a system or default
app
- Previously we force system/defualt apps present as Unrestricted mode
only and disable other options but that can not shows that apps
actual optimize states, it's possible to be other states even it's a
system or default apps, so we change the UI logic back to: present
it's actual states and disable other options when it's a system or
default apps.
Bug: 234419032
Test: make SettingsRoboTests
Change-Id: Ib5b6cb0aacb570cb8d15b1bb9ac2d480356eda49
levels. It behaves as an interface between UI and data.
Bug: 236101687
Test: make RunSettingsRoboTests
Change-Id: I4f79165125254ce1372abf1a207411a183aabb23
When there are multiple accounts in the devices, the battery usage list
is shared in the current design. We will aggregate other users usage
data into a single item to support multi-user privacy requirements
Screenshot: https://screenshot.googleplex.com/AkFTUtNvnoxcuGR
Bug: 202119550
Test: make RunSettingsRoboTests
Change-Id: I6cb55f0d50a4caca83212a0a54410530a032c089
- Export onSeekBarChangeListener callback to receive change event from parent
- Update battery saver schedule trigger threshold after seekbar tounch
ending instead of update it every time during dragging or touching
Bug: 236356020
Test: make RunSettingsRoboTests
Change-Id: Ifee7cd9e7cabfbec0817a4c28254228f885d6a8d
getBatteryHistory in BatteryHistoryLoader.
getBatteryHistory couldn't be changed directly as it needs to be kept
for other features.
Bug: 236101687
Test: make RunSettingsRoboTests
Change-Id: I3e3cdd3a0225228bf76f6750f6a56f031666720f
Merged-In: I3e3cdd3a0225228bf76f6750f6a56f031666720f
getBatteryHistory in BatteryHistoryLoader.
getBatteryHistory couldn't be changed directly as it needs to be kept
for other features.
Bug: 236101687
Test: make RunSettingsRoboTests
Change-Id: I3e3cdd3a0225228bf76f6750f6a56f031666720f
We have two different "Optimization mode" page design in the android R to support bi-state for AOSP and tri-state for Pixel device. From android T, we always show tri-state for both AOSP and Pixel. So it's time to clean up the legacy design for bi-state.
This change doesn't include string resources cleanup, which will be
included in a separated cl.
Bug: 232037602
Test: make RunSettingsRoboTests
Change-Id: I5194201d0b11e2dcea958d49bf07ed837a386465