Commit Graph

24 Commits

Author SHA1 Message Date
ykhung
cdd73e7fec Add kill-switch to distinguish chart or non-chart design
Bug: 184807417
Bug: 180607918
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: Iacbb012209d552b58b774f90f5b0aeb60ce6d33d
2021-04-09 07:21:06 +00:00
Dmitri Plotnikov
313dbc0355 Remove references to BatteryStatsHelper from PowerUsageBase
Bug: 180630447
Bug: 173745486

Test: make RunSettingsRoboTests
Test: male RunSettingsGoogleRoboTests
Change-Id: Ifed69c4fdd741f75b0b962f9d3200f0ed533358f
2021-03-18 06:07:29 +00:00
Dmitri Plotnikov
820bee81d6 Transition BatteryInfo and BatteryUtils to BatteryUsageStats API
Bug: 173745486
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.BatteryHistoryPreferenceTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.BatteryInfoLoaderTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.BatteryInfoTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.BatteryUtilsTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.batterytip.detectors

Change-Id: I469ff8b88aa3307422c02f51943df4ef1759db56
2021-03-12 14:08:42 -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
Raff Tsai
8291671f97 Fix testcase error and UI refresh issue
Restricted App list can be update in RestrictedAppDetails page and
go back to SmartBatterySettings page without update the App list.
We need to update the list in updateState() again.

Fixes: 140585454
Test: manual, robolectric
Change-Id: I48a197351ffb9b07490f1de7ba1f7417102458a2
2019-09-09 12:00:21 +08:00
Raff Tsai
577240642d Fix Battery usage page refresh issue
restartBatteryStatsLoader made a loader existed in fragment. onStart
will resume the loader. onResume registers mBatteryBroadcastReceiver
will caused the loader activated the second time. We move
restartBatteryStatsLoader to onStart can reduce the loader runs only
once.

Fixes: 140488811
Test: manual
Change-Id: I4cac574ea8e9c07c1a9df48a57fb8140d5687b21
2019-09-05 14:37:21 +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
e39e8d7f93 Clean up obsolete battery settings files
Fixes: 112440820
Test: robotest still pass
Change-Id: I91e8a4094bb2077c7998ef663d5545e9a3e18d03
2018-08-09 17:24:55 -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
Lei Yu
d2b295ba36 Update the battery broadcast receiver.
Add a type for battery receiver, then in callback client know for
which reason it been invoked:
1. battery level change
2. battery saver state change
3. battery plug state change

So in this CL, we won't update battery tip for battery level change,
then battery tip won't be dismissed by itself.

Also note in onResume() we will manually update battery tip. So if
user stay in battery settings page and close the screen, once he opens
it we will still force update everything.

Fixes: 79171742
Test: RunSettingsRoboTests

Change-Id: I997844216fd8267e545d74e0d434de9e338f76a1
2018-05-11 16:02:07 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Jaekyun Seok
47f6e54895 Move codes generating html file from xml files to SettingsLib (1/2)
LicenseHtmlGeneratorFromXml, LicenseHtmlLoader and indirecly AsyncLoader
shoud be commonly used by Settings and TvSettings.

So this CL will move them to SettingsLib.

Test: building succeeded and tested on sailfish.
  make ROBOTEST_FILTER=SettingsLicenseActivityTest RunSettingsRoboTests

Change-Id: I12e9169b1d3d313a6c5da0d575a6526327268381
2017-12-07 06:41:30 +09:00
jackqdyulei
ceaab271c5 Don't init batterystats in onCreate()
After ag/2573096, the batterystats will be refreshed after each
broadcastReceiver registeration. And this registeration happens
in onResume().

So we don't need to init batterystats in onCreate() anymore.

Bug: 65629008
Test: RunSettingsRoboTests
Change-Id: I4ed2d420c6f2bb77d726dac4dd58fa6704ce6929
2017-09-13 16:36:30 -07:00
Salvador Martinez
7961627680 Add some more logging to settings battery stuff
This CL adds logging to areas which are possible suspects for
the slowdown some people have been reporting in the
PowerUsageAdvanced screen. It times the time it takes for various
battery stats methods as well as the time it takes to draw things.

Test: still build (only adds logging)
Bug: 62959645
Bug: 63442960
Change-Id: I7e6c5e83e33a931057c9fdef14d3bef84f514940
2017-07-19 18:16:56 -07:00
jackqdyulei
114cf2a1a7 Never store battery stats for cache
In PowerUsageBase, it will store battery stats if it has a configuration
change, which will make BatteryStatsLoaderHelper never get the correct
battery stats because it uses Bundle.EMPTY as the bundle message.

This cl:
1. Remove the store action even though it is configuration change.
2. Always use null to get battery stats
3. Always start a battery status check in register()

Bug: 63658232
Test: RunSettingsRoboTests
Change-Id: Ifbf970c63378ed66dddcdae4d952b7d1fd84216a
2017-07-14 15:36:40 -07:00
jackqdyulei
2b923ce44f Smear screen power usage based on activity time.
Bug: 38328636
Test: RunSettingsRoboTests
Change-Id: I8e7baadcd88a8e9d674f5bc8d8e42e0f3953c98a
2017-05-17 18:06:47 -07:00
jackqdyulei
106dc459e0 Move battery stats loading to AsyncLoader.
It takes 3-4 seconds to load the battery settings page in Ryu. Main
reason is that it takes too long to init BatteryStatsHelper.

This cl moves loading code to AsyncLoader, and we will refresh ui once
the loading part is finished.

Following cl will add animation for the battery header to make it not
so janky

Bug: 37196170
Test: RunSettingsRoboTest
Change-Id: I40dfdde4a072e28a56c8fdf0ec6d671b5109fc6d
2017-04-25 13:26:17 -07:00
jackqdyulei
6246fad7ff Make battery status refresh in SettingsActivity
Before this cl, the battery text in SettingsActivity is one time
update, won't refresh based on real battery status.

This cl elicits BatteryBroadcastReceiver from PowerUsageBase and
make it reusable in both SettingsActivity and battery page.

BatteryBroadcastReceiver will invoke callback if:
1. Battery level changed on integer level(100->99)
2. Battery status has changed(i.e. charging)

Bug: 29346753
Test: RunSettingsRoboTests

Change-Id: If522d15a700ccbc8bae24f5712e05ec27ea4cbfa
2017-04-14 15:08:57 -07:00
jackqdyulei
9d5412f9ea Remove refresh menu icon in battery settings
Bug: 35645326
Test: RunSettingsRoboTests
Change-Id: I87f7da93cfb7a5ca46718de4acd33422fe42b9bf
2017-02-21 19:02:33 -08:00
jackqdyulei
51967c0e6a Add BatteryMeterView in Settings
1. Show gauge icon at the top of battery main page instead of
battery usage graph.
2. Move the click action from battery usage graph to gauge icon.

Bug: 34387464
Test: RunSettingsRoboTest

Change-Id: Ib182619d6805b401cde03a50e2ae907cf4df7b94
2017-02-13 11:03:07 -08:00
jackqdyulei
722fc818c7 Add power management settings into Settings->Battery
The items been added to group are: Adaptive brightness, Sleep.
Battery saver has been moved into this group as well.

Also refactor the code a little bit to make it fit the
preferenceController. Whole refactor of PowerUsageSummary and
PowerUsageDetail will be tracked in b/34386721

Bug: 34279051
Test: runSettingsRoboTests & Screenshot
Change-Id: I702d8479d1b80f7e9cf1a46752c75bf5d189e0f6
2017-01-23 10:20:07 -08:00
Jaewoong Jung
1e0f8ff5e5 Adds a menu item for additional battery info to battery settings.
Bug: 33352540
Test: No additional test failures.

Change-Id: Ibfc1a9463c93d3c087ed712fe45d3d0717472c6a
2016-12-16 12:25:32 -08:00
Jason Monk
1eb54eb2ff Add high power whitelist for apps
- Strings not final!
 - New UX for power usage details (more preferency)
 - Add high power apps list shows on/off and screen to
   change (when possible)
 - Link from power usage summary to high power list
 - Link from advanced apps to high power list

Bug: 19991702
Change-Id: I97c927ed82d3b89041e4429b427508545763d66c
2015-05-04 14:38:01 -04:00