Commit Graph

27 Commits

Author SHA1 Message Date
Jason Chiu
cf1517cfcc Fix Settings creating too many threads unexpectedly
Provide a method to submit a Callable for execution in the shared
background thread pool.

Bug: 143434413
Test: manual, robotest
Change-Id: I149b5926f20acd0e43c4071cc35520c6bc50efef
Merged-In: I149b5926f20acd0e43c4071cc35520c6bc50efef
(cherry picked from commit ab21b8a838)
2019-11-12 16:32:01 +08:00
tmfang
a2389bf462 Format relative time with specific style
In some cases, we expect the relative time in a short
format. So, we make this method can input a format style.

Fixes: 126871866
Test: visual
Change-Id: Iba5fb8d3acbf357b8c7d54065abf3e2fd74fac03
2019-03-18 11:17:03 +08:00
Evan Laird
4d8a2a4143 Go back to original string for <1 day case
Battery remaining estimate will say "Until H:MM" in quick settings. Also
shorten the alloted #chars from 100 to 20

Test: visual
Fixes: 124861973
Change-Id: I48893e0254c6b3f84901866f6bf376015ca61251
2019-03-11 19:39:04 -04:00
Raff Tsai
9753fe6efb Change batteryTip text
Fixes: 121042353
Test: Robolectric
Change-Id: I96ee0d88b69b97bed09c6a5d12bf736283503cc7
2019-03-09 00:13:04 +08:00
Evan Laird
85ee4a3cdf Always show time remaining estimate string in QS
QS will always show the time remaining estimate string, unless charging
or the estimate is unavailable

Test: visual
Fixes: 127519046
Change-Id: Iaa268ce631d3196967748b7f562d26e19ddeb465
2019-03-06 20:41:37 -05:00
Salvador Martinez
7ad2c179e1 Remove potential duplicate runnable + add logging
This CL removes an existing runnable for showing the low battery
warning if it hasn't finished. Additionally, it adds some logging
to the trigger method to make it possible to debug issues.

Test: PowerUITests still pass
Bug: 111374781
Change-Id: Iaaf6fa8233cc23f2e608a7968dac617eab0d5ce3
2019-02-11 16:27:10 -08:00
Evan Laird
4bf21dffaa Add estimated time remaining text to QS
- Add an API to BatteryController to get an estimated time remaining
string.
- BatteryController will now check up to once per minute what the
estimated time will be and builds the string using PowerUtil.
- If the "show percentage" setting is on, the estimated time remaining
string (and battery icon) will show next to the system icons in QS
- Also make the battery percent in QS obey the setting

Test: visual
Bug: 116481529
Change-Id: Iaafa00127c8b8baae40956254a1237c8b7ac079b
2018-11-13 10:47:14 -05:00
Fan Zhang
2cda28326a Update javadoc to deprecate non-compat version widgets
Test: rebuild
Change-Id: Iac6e16463760f66b9ff8ec64aa47c168ef67dd6c
2018-09-14 09:07:41 -07:00
TreeHugger Robot
4a64b0323a Merge "Revert "Add log for StringUtil"" 2018-09-05 03:13:37 +00:00
Lei Yu
c6047d3cb7 Revert "Add log for StringUtil"
This reverts commit 1aedf0768c.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Iad115dd31eaea573ee43163c8ab69a7d7140f543
2018-09-04 18:32:53 +00:00
TreeHugger Robot
528ffcc310 Merge "Add log for StringUtil" 2018-08-30 21:10:32 +00:00
jackqdyulei
1aedf0768c Add log for StringUtil
Bug: 111694886
Test: Build
Change-Id: Icf7a57baa81a554bdbe7c1359d61d78abc77e0db
2018-08-30 11:14:24 -07:00
Fan Zhang
f7802eacfd Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I9acb311ec05f72f0a37f08b0d26785841fe91de5
2018-08-28 15:16:58 -07:00
tmfang
464da581aa Preparation task for Settings Fragment Migration
Create some compatible files.
These files can be used for Settings Fragment Migration task.

Bug: 110259478
Test: make RunSettingsLibRoboTests -j40
Change-Id: Ib3d52e9a5f5bed5c194d429fdfa4b0d01ed07f01
2018-07-09 11:06:43 -07:00
Aurimas Liutikas
fd52c1433c Migrated SystemUI & SettingsLib to androidx
Test: make SystemUI SettingsLib
Bug:76692459
Change-Id: I248fdf4042a0a97bc6349091da21c936c2d37c95
2018-04-20 12:48:23 -07:00
Salvador Martinez
2ee2b0a785 Make util method public
A utility method is private but we need it elsewhere. This CL
just makes it public. Also it restricts the use of the method to
just rounding positive values to positive multiples. It is only
meant for rounding time.

Test: robotests
Bug: 77874313
Change-Id: Ieb222c7f752b6a907fca5f91ddd4f4a4b67a0d2a
2018-04-16 16:31:37 -07:00
Salvador Martinez
b9e8cfa5d3 Update battery strings to respect user 24 hour setting
ICU on android doesn't respect users 24 hour setting by default.
This CL makes it so that tell ICU what the users setting is so that
it will respect it.

Test: robotests updated
Bug: 77483888
Change-Id: I46eec2a10530b8b490f6a681c3a9b0a9dd4d68bd
2018-04-05 15:00:23 -07:00
Lei Yu
128f56302d Change the time format to short
So it will show "2 days, 15 hr, 2 min" instead of "2d 15h 2m"

Bug: 76113036
Test: RunSettingsLibRoboTests
Change-Id: I31df2ac8e1ebc0616ef58ea2d21a50ca9788b392
2018-03-27 11:28:59 -07:00
Julia Reynolds
4ccdede3e3 Update duration text
Change-Id: Ib390aaf1a82d28ab197628b09e80ca439c392eae
Fixes: 72651488
Bug: 74318867
Test: make -j RunSettingsLibRoboTests
2018-03-21 15:37:31 -04:00
TreeHugger Robot
80fd74680e Merge "Update battery discharging strings" 2018-02-28 23:22:30 +00:00
Salvador Martinez
eec87364b4 Update battery discharging strings
Changes were made to the strings for Settings and SysUI. This
CL updates the shared strings to reflect those changes.

Test: robotests
Bug: 73290523
Bug: 72996609
Bug: 73904361
Change-Id: I43e3185e4b0b59cc9c0ee2fd550096b3b472284f
2018-02-27 17:08:17 -08:00
Zhizhi Liu
638084deaa Move IconCache to SettingsLib(I).
Aim to share IconCache between Settings & TvSettings.

Test: Compiled
Change-Id: Ia7c9807cea587b6d654c80f6dbbf43467f48cc5b
2018-02-23 14:05:11 -08:00
Salvador Martinez
eb9ab29ec6 Add shared strings to settingsLib
Now that hybrid notifications exist in SysUI these strings should
be moved into settingsLib so we don't duplicate them. Additionally
several utility methods were moved so that they could be shared to
help keep behavior and strings consistent between different system
components that show battery time remaining.

Test: robotests
Bug: 65656091
Bug: 66909350
Bug: 67469159
Change-Id: Ifdaf02cf39354ed0088560490eabf8b101788a83
2018-02-07 10:55:42 -08:00
Jaekyun Seok
8d923f0b8e Move codes generating html file from xml files to SettingsLib (2/2)
LicenseHtmlGeneratorFromXml, LicenseHtmlLoader and indirecly AsyncLoader
shoud be commonly used by Settings and TvSettings.

So this CL will move them to SettingsLib.

Bug: 37763148
Test: building succeeded and tested on sailfish
  make ROBOTEST_FILTER=LicenseHtmlGeneratorFromXmlTest RunSettingsLibRoboTests
  make ROBOTEST_FILTER=LicenseHtmlLoaderTest RunSettingsLibRoboTests

Change-Id: I86b59d82c46b6c5f520a6be260363f1b6ffd43f4
2017-12-07 09:56:52 +09:00
Fan Zhang
dadfd50325 Misc change to support loading dynamic summary/icon in app
- Add ThreadUtils.postOnBackground helper method
- Don't fallback to app.icon if tile's metadata contains icon uri
- Deprecate TITLE_RES_ID in favor of TITLE metadata

Bug: 63758074
Test: robotests
Change-Id: Ie60fb4677cdb12c3ff313ffdfdb4a4f4960fac0f
2017-08-02 21:38:49 +00:00
Fan Zhang
d30c05c293 Make a helper method to post work to ui thread.
Bug: 36131513
Bug: 63896139
Test: robotests
Change-Id: If7154f17926f86157816987221f449a48ae6fd4e
2017-07-21 17:05:09 -07:00
Juan Lang
5efe8f0a09 Import FooterPreferenceMixin and its dependencies into SettingsLib.
This will allow this class to be reused by apps other than Settings.

Test: make RunSettingsLibRoboTests && make RunSettingsRoboTests &&
make RunSettingsGoogleRoboTests
Change-Id: Ic4aa3945df71357fb2f99262ab299020e94a6eb9
2017-05-12 09:23:08 -07:00