The cursor loader was being started when the battery prediction
feature was not enabled. This could lead to null pointers because
it was not possible to provide it with a valid URI which would
make the CursorLoader unhappy. This CL makes it so we just skip
the CursorLoader initialization entirely when we know the feature
is disabled so we don't have this issue. It also includes a test
to make sure this does not regress.
Test: Robotests
Bug: 38371686
Change-Id: I4f6f6278bbc16668bca0b51fcc7e30f27a9e216f
When battery asyncLoader is loading batterystats, show a battery
placeholder(critical level) and animate to real status once data is
loaded.
Bug: 35917699
Test: RunSettingsRoboTests
Change-Id: Ie4ff73ff2cc0b9e17b4541e3284bf2ac34da42c4
Merged-In: Ie4ff73ff2cc0b9e17b4541e3284bf2ac34da42c4
Fix merge conflict from oc-dev
When battery asyncLoader is loading batterystats, show a battery
placeholder(critical level) and animate to real status once data is
loaded.
Bug: 35917699
Test: RunSettingsRoboTests
Change-Id: Ie4ff73ff2cc0b9e17b4541e3284bf2ac34da42c4
The null check for the cursor happens in the try block
which causes a null pointer error in the finally block
even though we avoid executing the other code because
we still try to close the cursor. This change moves
that outside of the try block to avoid that. Also added
a test to verify that a no-op occurs in the method that
uses the enhanced prediction that would have caught this.
Additionally, the method for checking if the enhanced
prediction was available was not being called in Settings.
This CL adds that check and a relevant tests to ensure it
is respected.
Test: Robotests
Bug: 38031439
Change-Id: I6924acb5552baf09a9ff0cdef8e30881115aa1ca
Added code that checks if the provider for the enhanced battery
drain estimate is available. If it is available we use that
value instead of the one computed by BatteryStats.
Test: Robotests
Bug: 37753227
Change-Id: I7eae01b56f85d33eafc42ee0f18bb752779581b2
When the app contains anomaly, we should show anomaly icon(triangle
alert).
This cl also extracts a new method refreshAppListGroup from refreshUi.
New method is used to only refresh appListGroup. Reason for this action:
1. Improve performance(partial refresh)
2. We init AnomalyLoader in refreshUi, invoke refreshUi in
onLoadFinish will create infinite loop.
Bug: 36924669
Test: RunSettingsRoboTests
Change-Id: If54c89349e21763ca714123ac6ae884bd0f6a377
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
Talk back will read "Used for 3m" as "Used for 3 meters", but
it will read "Used for 3h 3m" correctly.
This cl add specific Ttsspan if the time only contains "minute"
Bug: 36379530
Test: Run SettingsRoboTests
Change-Id: I033575938cce24221980dddd9d66be4e18804541
Change preference keys of duplicate settings between
display and battery to avoid duplication in search.
Bug: 33701673
Test: make RunSettingsRoboTests
Change-Id: Iaad52f16ce33c478c64bcec656cc8edbe0c97283
Merged-In: I56c82e9e7f163d345065ca478849de9b14c173fe
This cl refine battery icon ui in low battery mode:
1. Should show indicator(fixed in ag/2035178)
2. Show bolt icon when charging
3. When battery is low, set battery background as red and indicator
as white.
This cl also includes the field updates for battery.
Bug: 36862496
Test: RunSettingsRoboTests
Change-Id: Ifb2ed339742119bbff78712df09288b895756b1f
This cl moves following methods to BatteryUtils:
1. shouldHideSipper
2. removeHiddenBatterySippers
3. calculateBatteryPercent
As a result, we could use these methods in battery page as well
as app info page.
This cl also move bunch of tests to new file and add test for
method calculateBatteryPercent
Bug: 36816681
Test: RunSettingsRoboTests
Change-Id: Ic32700fe9741fbb96363db4af2d4fccb3ee8e317
The removed types are:
1. DrainType.UNACCOUNTED
2. DrainType.OVERCOUNTED
This cl removes the above types in PowerUsageSummary and
PowerUsageAdvanced
Bug: 36874846
Test: RunSettingsRoboTests
Change-Id: I1807c44a2c0a9c2fa124cdef962a6411ae6830ca
1. Refine the battery header view
2. Move stats section to the place above power management
3. Add last full charge battery stat
4. Add the disclaimer as a footer
Also update the method name in test file, and this ui changes
also fix the header flash problem.
Bug: 36576021
Bug: 36494178
Test: RunSettingsRoboTests
Change-Id: I9784dbbbe16e61da7287f300183347dd4eee6a2b
(cherry picked from commit edfd09d590)
Also move the systemui to category system
Fix: 36644740
Fix: 36645264
Test: RunSettingsRoboTests
Change-Id: I6b64a7dca58091f3a1d8b7d99c8bae7ddf9169f9
(cherry picked from commit 1e95b74f77)
Media is a bundled process which contains the following packages:
com.android.providers.downloads
com.android.mtp
com.android.providers.media
com.android.providers.downloads.ui
This cl moves them to advanced battery page.
1. Bluetooth lives in category bluetooth
2. Media lives in category system
Bug: 35811926
Test: RunSettingsRoboTests
Change-Id: Ie229fa15e2e62b67d571988f7f4e7788a665bcdd
This cl adds isTypeSystem to PowerUsageFeatureProvider and
changes isTypeService. After this cl, the following items will
be moved to advanced battery page:
1. Calendar Storage(Move to System)
2. MediaServer(Move to System)
Create this check in FeatureProvider to make sure this check
is flexible in different cases. Also refactor the PowerUsageSummary
to use same test fragment
Bug: 35629871
Bug: 35628690
Bug: 35317876
Test: RunSettingsRoboTest
Change-Id: I8c083cb2557a7e900aea01e682c13a000bacb7a9
Battery header uses AsyncTask to update the label. So if user
press back button before the update completes, the "getContext()"
in AsyncTask callback will return null, which causes the crash.
It seems there is no good way to fix it expect adding a NPE check.
Bug: 35650224
Test: RunSettingsRoboTests
Change-Id: I7bd9fd87caa13614fe1896cf72557a09744691c1
When battery is full of charge, usageList in BatteryStatsHelper
will be empty. As a result, we cannot find BatterySipper with
type screen and cell, which creates the null pointer error.
In this cl, I add NPE check for sipper. When sipper is null, all
data will be set to default value. I also add check for totalPower
so we won't have divided by zero error.
Bug: 35757789
Test: RunSettingsRoboTests
Change-Id: I80f3c0c542e0a50868e7c314a8d9b3c17999d8c6
Add a preferenceGroup at the bottom of the page, which contains
Screen and Cell usage data.
Bug: 35305983
Test: RunSettingsRoboTests & Screenshot
Change-Id: Ida6e92ddbd7155ec974a2f04c6d6d02ab9dab210
In the previous cl we hide unrelated apps and distribute hidden
battery usage among other apps. Now we add a toggle in menu to
show old power accounting as well.
Bug: 35366708
Test: RunSettingsRoboTests
Change-Id: I6918b7095cf84d9756ad3972ff50a62aeae1de0e
1. When there exists estimate time, show it, otherwise
show battery status label.
2. Change the summary based on whether it is charging.
(Estimated time left vs Time to full charge)
Bug: 35328749
Test: RunSettingsRoboTests
Change-Id: I64ee8acd248062b4effcfc58ed908be7d89621a3
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
1. Add screen check in the shouldHideSipper()
2. remove all the battery usage for hiddenSipper from
percentage calculation, in this way we can distribute
hidden sippers to all the apps
Bug: 35153599
Test: RunSettingsRoboTests
Change-Id: I82673b282c14c92269d7f8bc71e07de90a37720c
This summary shows the active time of the app. For example
"Used for 27m".
Bug: 34467139
Test: RunSettingsRoboTests & Take screenshots
Change-Id: I0ef48427ad21be4dacd290fffb2c5d519ef58506
It doesn't make sense to show battery cost of "SCREEN". In this cl, I
attribute this cost to all the other apps/services.
Bug: 34390125
Test: RunSettingsRoboTests
Change-Id: Ia6ff39d5fa21eacf1ff97a28e2ff59d1cf169885
We want to hide the OS items from battery usage page and let users
focus on the items that they can control.
Currently the hidden items are:
Android OS, Android System, Phone idle, Cell Standby
Bug: 34274844
Test: RunSettingsRoboTests & screenshots
Change-Id: I75165376d5038b6ec17a7b73ae3c5fcd24753fa9
This cl is to fix the preference flicker issue. The main reason is
that we cannot find cached preference because of the inconsistent
search key. The search key is calculated without considering
uidObj, but the key in preference(aka changed preference) maybe
changed later based on the existence of uidObj. So when we search
the changed preference using the wrong key, we won't get it even
though it exists in the cache.
In my cl, I group two parts(search key calc + considering uidObj)
together in a method to extract the key.
Bug: 33663705
Test: make RunSettingsRoboTests
Change-Id: I2ca0c558ffc0d49ed9576321ecbc02542b568d65