Commit Graph

40 Commits

Author SHA1 Message Date
pajacechen
f45427bd59 [Reskin] Replace string for chargin on hold
- replace the string for charging on hold in settings main page and
  battery status in battery settings page

Bug: 315748218
Test: Manual Test
Flag: NA
Change-Id: I130d377912e150d593f6480e2bbdf43048b6916e
2024-01-15 19:20:21 +08:00
Jun Lan
cca804e1ed Format battery java code
After this CL, we can follow Guideline:go/hc-mainline-dev#format-code to keep java format consistent.

Test: manual
Bug: 304439460
Change-Id: I5bb77f81b0bd9be618e34942eaaee8296bc42796
2023-11-06 13:55:48 +08:00
Chaohui Wang
0aca2ffbdb Clean up used EntityHeaderController
From DataUsageSummaryPreferenceController and
BatteryHeaderPreferenceController.

There are no entity header UI for these 2 controllers, so no need to
create EntityHeaderController instance.

Bug: 295260929
Test: manual - on mobile settings page
Test: manual - on data usage page
Test: manual - on battery settings page
Change-Id: Ib96c9ae93de31f86434e5203ef4acac3af50e0ef
2023-08-24 14:08:17 +08:00
Chaohui Wang
cc2133ba8e Clean up unused fields from EntityHeaderController
Bug: 295260929
Test: manual - on pages with header
Test: robo test
Change-Id: Icebd63dbb5d3d44b4b46d3bececb8b65b30b4883
2023-08-21 13:58:07 +08:00
Chaohui Wang
2541381259 Fix references to resources for Settings
Bug: 293810334
Test: m Settings
Change-Id: Ie140278f492ef7e1c062ec1ecae2866c521a86aa
2023-08-08 01:56:05 +00:00
Chaohui Wang
9ed6eccb75 Remove context from batteryStatusFeatureProvider
BatteryStatusFeatureProvider is created by using application context,
no need pass context in when get.

Bug: 286764889
Test: m Settings
Change-Id: Ie5f39c3f074a1937526461eba45f11f7ec212cba
2023-07-06 15:56:08 +08:00
ykhung
c234196bc1 Support incompatible charger state in the battery main page
https://screenshot.googleplex.com/PrSzAtMAhsyqbsR

Bug: 271775549
Test: make test RunSettingsRoboTests
Change-Id: I0bb912eaab9c8837eaa3a9b998b3ebb5a8e6f99f
2023-05-04 14:57:07 +08:00
Wesley.CW Wang
2c6fd8fd3b Update battery charging status string
- Present status string only when status anomalous
 - Remove app usage pages divider

Bug: 185448191
Bug: 187767337
Bug: 187778673
Test: make SettingsRoboTests
Change-Id: I7829e9deed05fb7d95d483ddb718abfdc53b1aa6
2021-05-12 21:14:23 +08:00
Mill Chen
e545bff7da Apply the correct style to Battery and Storage page
Since some pages were styling the action bar programmatically before, the
color of collapsing toolbar will be overridden. Removing them will fix
the problem with inconsist color. This change also fixed some pages with
inconsist theme.

Bug: 185444608
Test: visual verified
1) Settings -> Battery / Storage
2) Scrolling the collapsing toolbar and make it collapsed
3) Observe and see if the color of toolbar is different from the one of
status bar

Change-Id: I5e792747ea3f4deb05428ea5afe6a64f29f9da89
2021-04-16 00:25:50 +08:00
Wesley.CW Wang
f1ca264f69 Refine battery settings layout
- Add loading text to progress bar to prevent UI flaky
 - Setup enable/disable state for battery saver switch
 - Remove battery saver page divider

Bug: 177964551
Bug: 177964753
Bug: 184626649
Test: make SettingsRoboTests, visually
Change-Id: I8e05c0c0f02710729e1f59eff23fb3f425770de9
2021-04-10 17:39:14 +00:00
Wesley.CW Wang
756028aadd Support help message when battery is unavailable(1/2)
- Present help preference when battery is unavailable

Bug: 179237551
Test: make SettingsRoboTests
Change-Id: If6e82210d831123cb1169d53a18d24cb2c576b10
2021-04-09 11:24:51 +08:00
Wesley.CW Wang
d324393fac Update battery states text to support battery feature(1/2)
- Update progress bar bottom text when receiving battery feature callback

Bug: 183689347
Bug: 177407113
Test: make SettingsRoboTests
Change-Id: Ic8b24cbb149f7e470d28327a9a1dd84bbd5673f7
2021-04-08 06:39:22 +00:00
Wesley.CW Wang
11d74e7231 Update battery states text
- Update progress bar bottom text when battery states changed(charging,
 discharging, power saver and low battery)

Bug: 183689347
Bug: 177407113
Test: make SettingsRoboTests
Change-Id: I0397eb1dea7fcb14357750f84d1d5b1a7dc7d19a
2021-04-08 05:10:34 +00:00
Wesley.CW Wang
fdfda5e589 Update battery progress bar
- Setup state text to bottom text view
 - Remove battery state icon
 Screenshot: https://screenshot.googleplex.com/At9tAVDgnoQBtNS.png

Bug: 177407113
Test: make RunSettingsRoboTests
Change-Id: I86cfe83982da70b8fc49386f388c1a068295e205
2021-03-31 17:04:24 +00:00
Wesley.CW Wang
e940dcb448 Update UsageProgressBarPref icon when device is charging or low battery
- Add new icon for battery low state
 - Update UsageProgressBarPref icon when charging or low battery
 Screenshots:
   https://screenshot.googleplex.com/9HBvV6t6dVsG8eD.png
   https://screenshot.googleplex.com/6TsRu6BTN338FvT.png
   https://screenshot.googleplex.com/nGE29cfsmgKuuaP.png
   https://screenshot.googleplex.com/85NWXSg2PevXAsy.png

Bug: 179237746
Test: make RunSettingsRoboTests -j40
Change-Id: I057874bbf45594c90466cf346b054bf033815dac
2021-03-11 06:32:20 +00:00
Wesley.CW Wang
f4bc35333b Update battery percentage column to UsageProgressBarPref (1/2)
- Change battery percentage column to new design
 - Remove debug info case
 Screenshots:
   https://screenshot.googleplex.com/9rvRfK3wBtpnarZ.png
   https://screenshot.googleplex.com/5iAjNXTptDechAm.png

Bug: 177407113
Test: make RunSettingsRoboTests -j40
Change-Id: I5d046be29a036910036e72edb677b69bc2c0a03f
2021-02-19 10:23:53 +00:00
Stephane Lee
b60870cb7d Add adaptive charging to the top level settings menu
Bug: 172009945
Test: Trigger adaptive charging and verify string in menu
Change-Id: Iba2d81e779e2b4aaa3c7b7c38710a03c6792c4a9
2021-01-04 15:37:21 -08:00
Daniel Chapin
2f51836ca1 Revert "Add adaptive charging to the top level settings menu"
Revert submission 12989357-fix_ac_menu

Reason for revert: Bug: 176473169
Reverted Changes:
I6fc50a5ae:Add adaptive charging to the top level settings me...
I8f600287c:Add adaptive charging to the top level settings me...

Change-Id: I2928a96112bb8d2beeb071f231af6595edead4fa
2020-12-29 17:55:13 +00:00
Stephane Lee
8fee0917f8 Add adaptive charging to the top level settings menu
Bug: 172009945
Test: Trigger adaptive charging and verify string in menu
Change-Id: I8f600287c38e3992bb884faeb4df3d91570851a0
2020-12-22 11:19:57 -08:00
Wesley.CW Wang
9a6aae5006 Add Battery Defender feature to Settings
- Reupload CL from ag/13108999 to fix the merge conflict
 - Adding new tips of Battery Defender, will be presented once battery is overheated
 - Launch Help Center article of battery overheat when clicking Battery Defender tip
 Screenshots: https://screenshot.googleplex.com/7jUibTJANgR6UQ6.png
 	      https://screenshot.googleplex.com/tUj2LLi87SfndBN.png

Bug: 172794045
Bug: 173497281
Bug: 173496188
Test: make RunSettingsRoboTests -j40
Change-Id: Ibb106a5d42cdf6232abf9ddf4b3225bdcebccf4a
2020-12-01 16:00:49 +08:00
Mill Chen
ad99e2ef38 Update related UI if battery is not present
This change is to update the related UI in the battery page if the
battery is not present. This includes the following updates:
1. Update the summary of battery tile in the Settings homepage
2. Replace the battery level with "Unknown"
3. Replace the summary with help message in the battery page
4. Remove the battery meter icon

Bug: 171368508
Test: verify on an issue device
Change-Id: I892e0d137143160a0bce0c11ce9265120ebb8fd4
2020-10-23 23:35:15 +08:00
Jeffrey Carlyle
4e2071ae78 Add BatteryStatusFeatureProvider
This allows the battery header status line to be overridden.

Bug: 150239363
Test: implemented provider and changed status line text
Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com>
Change-Id: I05bedbee641f087de5ee1b25a00724ce2de51f87
2020-06-18 01:50:36 -07:00
Raff Tsai
648ada031d Fix Battery page animation
TextView summary1 has default height 2 line. If the content is longer
than 2 line, the TextView increases itself which causes the animation.
By increasing minLines to 3, it can avoid the animation. And remove
summary2 because it is only for debug purpose, the debug information
can be merged to summary1.

Fixes: 139554919
Test: visual, make RunSettingsRoboTests
Change-Id: I167ac87c9bd83035e00d4991961599e76f4f69e1
2019-08-19 16:47:53 +08:00
jackqdyulei
fd0f48df86 Update battery dashboard based on spec
Following CL will change "battery suggestion" to card layout.

Bug: 119618813
Test: Screenshot
Change-Id: If71e5c0e4a4e230358aa0c8aa584028082f31d2e
2019-01-03 12:59:12 -08:00
tmfang
dce94bb237 Use SettingsLib's LayoutPreference
- Remove LayoutPreference in Settings source code.
- Remove unused style, layout
- Replace old imports to com.android.settingslib.widget.LayoutPreference
- Replace old XML tag to com.android.settingslib.widget.LayoutPreference

Test: robotest, manual test
Bug: 120005054
Change-Id: I9ae1ae14a16f443e11ac5d75b6038c7c5e253844
2018-11-27 13:12:53 +08:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
jackqdyulei
1becb7764d Fix the time flicker in battery settings page
Don't clear the text when reciever has been re-registered in
onResume(), where quickUpdate has been called.

Change-Id: Ie056dfb225a1bf6c224932b310a97499fc26e8f0
Fixes: 69312991
Test: RunSettingsRoboTests
2018-08-22 14:55:21 -07:00
jackqdyulei
076b674764 PowerUsageSummary: move controllers to xml
Also change the following controllers to have standard constructor
1. BatteryHeaderPreferenceController
2. BatteryTipPreferenceController

Change-Id: I2e68082295eb8ef18de9fef9483a10b070c77a47
Fixes: 111131567
Test: robotest
2018-07-26 11:40:28 -07:00
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -07:00
tmfang
99cc23d0da Settings Fragment Migration (Change imports)
This commit *only* changes imports and optimize imports.
We don't do anything else.

This patch can't compile pass and run test case.
We will update other patches to fix these problem.

Change list.

1. import android.app.Fragment; ->
   import androidx.fragment.app.Fragment;
2. import android.app.DialogFragment; ->
   import androidx.fragment.app.DialogFragment;
3. import android.app.ListFragment; ->
   import androidx.fragment.app.ListFragment;
4. import android.app.LoaderManager; ->
   import androidx.loader.app.LoaderManager;
5. import android.content.AsyncTaskLoader; ->
   import androidx.loader.content.AsyncTaskLoader;
6. import android.content.Loader; ->
   import androidx.loader.content.Loader;
7. import android.app.FragmentTransaction; ->
   import androidx.fragment.app.FragmentTransaction;
8. import android.app.FragmentManager; ->
   import androidx.fragment.app.FragmentManager;
9. import android.app.LoaderManager.LoaderCallbacks; ->
    import androidx.loader.app.LoaderManager.LoaderCallbacks;

Bug: 110259478
Test: Can't test it.
Change-Id: I0a3f98fff34a3494a839c3c42aeabcec3df2c8b3
2018-07-11 18:23:51 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Weien Wang
27e9617c16 Fix the battery icon on the battery page when low battery
Check power-saving state for drawing the battery icon on the battery page.
It will draw red + icon as status-bar did when battery saver is on.

Change-Id: Iee4a17c8e5cb3c8ee5d978eb23e3980597d09a1c
Fixes: 77150820
Test: Manual test, atest BatteryMeterViewTest BatteryHeaderPreferenceControllerTest
2018-05-24 08:05:15 +00:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
jackqdyulei
051fb19dd4 Merge "Add quickUpdate method to BatteryHeaderPrefCtrl" into oc-dr1-dev am: 7ea8ecdae1
am: fc55a3cef1

Change-Id: I7d23a1bab37417064a1ffc358f9856d711426c19
2017-06-28 17:20:04 +00:00
jackqdyulei
19648756cb Add quickUpdate method to BatteryHeaderPrefCtrl
This cl adds a method called quickUpdateHeaderPreference, which will
update the following items immediately without waiting for the
BatteryInfo:
1. Battery level
2. Battery charging status(whether to show lighting bolt)
3. Clear the charging summary

Note: this cl doesn't optimize the BatteryInfo loading time.

This cl also rename "TimeText" to "BatteryPercentText" because in
new UI that textview is used to display battery percentage.

Bug: 63029231
Test: RunSettingsRoboTests
Change-Id: I8cc886b35e937d73b46e47e303ff0994ccdcb61c
2017-06-27 13:35:41 -07:00
Tony Mantler
1d583e125f Make PreferenceController a mixin
Bug: 62912136
Test: Existing tests in BaseSearchIndexProviderTest
Change-Id: Ieda359806c09a019840b2005446c7ec8b61fdb00
2017-06-26 10:58:36 -07:00
Salvador Martinez
f4727ea07f Add ability to see both battery estimates on long press
If the enhanced estimate is being used in battery settings
it is now possible to long press on the text to have it display
both instead of the string that is normally used.

Adds another loader to enable this since it needs both the old
and the new estimates simultaneously.

Feature is hidden behind a feature flag that only googlers will
have enabled.

Test: robotests
Bug: 38399275
Change-Id: I5caf26513baada27efd50ddb0e72d3868da47150
2017-06-05 16:26:32 -07:00
Fan Zhang
fe23da579d Misc layout fixes
- Apply entity header effect to battery summary screen.
- BidiWrap wifi ap name is it's correctly displayed in RLT languages
- Remove footer preference layout - settingslib already has one

Fix: 62039146
Fix: 62138362
Fix: 37920219
Test: make RunSettingsRoboTests

Change-Id: Idf1385ee40772c63075e5f81eb039c6da56256ab
2017-06-05 11:25:49 -07:00
Salvador Martinez
0e8c88376c Move BatteryInfo to settings from settingslib
This CL simply moves BatteryInfo from settingslib to settings and
makes sure the tests still pass. No other changes are made other than
imports or minor changes needed to make sure existing code does not
break.

Test: Robotests still pass
Bug: 38399275
Bug: 38398949
Bug: 38399654
Change-Id: I59803348e2780b7676ccc6c43234a586c184d71f
2017-06-01 11:34:08 -07:00
jackqdyulei
605dbc66be Split loading process for battery header
This cl creates BatteryHeaderPreferenceController, which will first
load the battery level in ui thread(in displayPreference()), then
display the remaining time once we get the battery stats.

This is the best we can do to avoid ui flashing while removing the
animation

Bug: 38349587
Test: RunSettingsRoboTests

Change-Id: Ic3622bb73562ba42e69b37e5674a724c03c45f12
2017-05-23 13:22:42 -07:00