Commit Graph

25 Commits

Author SHA1 Message Date
jackqdyulei
85e25e34fd Fix the getForegroundActivityTotalTimeMs
The parameter in timer should be microseconds, not milliseconds

Bug: 63073847
Test: RunSettingsRoboTests
Change-Id: I5e451aee9eb30815fbefe12c0bfdc85dff884b8e
2017-06-28 12:33:20 -07:00
jackqdyulei
118e2baabe Fix the getForegroundActivityTotalTimeMs
It should return milliseconds, not microseconds time

Bug: 63073847
Test: RunSettingsRoboTests
Change-Id: Ib7ddb947646062fc50a40d300829389e0ac401ee
2017-06-27 16:49:14 -07:00
jackqdyulei
3d93fc16f4 Change the method to get foreground time.
This cl changes it to:
foregroundTime = MIN(topTime, foregroundActivityTime);

Bug: 62884954
Test: RunSettingsRoboTests
Change-Id: I236c18b19c4f06c5a6d018bc06ffb9862af51de2
2017-06-23 11:02:54 -07:00
jackqdyulei
9d0d6e4fcc Merge "Hide wifi and bt in battery settings" into oc-dev
am: 05777a7918

Change-Id: If676ec0119bebed800727f618225fd355e9da74f
2017-06-20 22:55:47 +00:00
jackqdyulei
d10608dfbb Hide wifi and bt in battery settings
Hide them in app usage list but don't smear them

Bug: 62787787
Test: RunSettingsRoboTests
Change-Id: I43c15ea8a2b32f293eb859f3fead8666e45674ef
2017-06-20 13:44:52 -07:00
jackqdyulei
72c3275a66 Refine Anomaly detail page
1. Fix the layout issue(title not vertical horizontal)
2. Add subtitle for anomaly

Bug: 36924669
Test: RunSettingsRoboTests
Change-Id: I9b3627f09bbe37b104644d203ff8924f0faaea47
2017-06-20 11:37:55 -07:00
Andrew Sapperstein
9f1e911759 Refactor test runner to use static list of resource paths
Previously everything lived in an inner class method of
SettingsRobolectricTestRunner. That method has now been turned into
a static method so that it can be called by other runners.

Bug: 62460102
Test: robotests
Change-Id: I6612b1f26404587301c534c8ba60e39d59d6c840
2017-06-09 09:21:26 -07:00
jackqdyulei
de3bb7194d Add method to calculate last full charge time
Bug: 38481300
Test: RunSettingsRoboTests
Change-Id: Icd551921f263352eb01d0c6ada62d277c8699507
2017-05-30 15:51:29 -07:00
jackqdyulei
03539a07e4 Add method to calculate last full charge time
Bug: 38481300
Test: RunSettingsRoboTests
Change-Id: Icd551921f263352eb01d0c6ada62d277c8699507
2017-05-26 13:21:42 -07:00
jackqdyulei
f984b1e1ae Sort app list after smeared on screen
Then we could make sure the app list is sorted

Bug: 62035385
Test: RunSettingsRoboTests
Change-Id: I3fa3d6ffc5930cf011e382632143e459fdbc4369
Merged-In: I3fa3d6ffc5930cf011e382632143e459fdbc4369
2017-05-25 10:09:05 -07:00
jackqdyulei
7932484fa9 Sort app list after smeared on screen
Then we could make sure the app list is sorted

Bug: 62035385
Test: RunSettingsRoboTests
Change-Id: I3fa3d6ffc5930cf011e382632143e459fdbc4369
2017-05-23 17:36:47 -07:00
jackqdyulei
495de548bd Add wakeup alarm anomaly detector
Wakeup alarm count frequent is calculated by a / b, where
1. a: the total wakeup alarm count since the last full charge
2. b: total time running since last full charge
(include sleeping time)

This cl also has the following changes:
1. Move bunch of methods to BatteryUtils
2. Create type WAKEUP_ALARM
3. Add and update tests

Upcoming cl will make sure we get the threshold from
AnomalyDetectionPolicy

Bug: 36921529
Test: RunSettingsRoboTests
Change-Id: I4f7b85606df68b6057f6c7d3f3be7f9a9a747f1d
2017-05-23 09:49:14 -07:00
TreeHugger Robot
21d2403c67 Merge "Show wifi and bluetooth item in battery settings" into oc-dev 2017-05-18 19:13:35 +00:00
jackqdyulei
7d7080ab64 Drop the misc and not smear it.
Bug: 38347725
Test: RunSettingsRoboTests
Change-Id: I573e4fb945bc212505c9211d9b92f77a6a9a2739
2017-05-17 18:12:03 -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
6c9dc0b1ca Show wifi and bluetooth item in battery settings
Change-Id: Icc1824758908b14ad895dcc28a63a5d9c685b490
Fix: 38328856
Fix: 38328641
Test: RunSettingsRoboTests
2017-05-17 10:29:55 -07:00
TreeHugger Robot
651261c7dd Merge "Only use PROCESS_STATE_TOP as foreground time." into oc-dev 2017-05-05 18:55:29 +00:00
jackqdyulei
01e690e377 Only use PROCESS_STATE_TOP as foreground time.
There are some miscalculations in state FOREGROUND_SERVICE and
FOREGROUND, so we move them out of the foreground time for now.

We will fix it after O and may add them back later.

Bug: 37000096
Test: RunSettingsRoboTests
Change-Id: Ic3f2f7fa69e8a213895c601630d1cca94fd32220
2017-05-05 10:23:09 -07:00
jackqdyulei
a245188a65 Distribute the misc among all the apps
Distribute it in:
1. Battery main page(PowerUsageSummary)
2. Advanced battery page(PowerUsageAdvanced)

Bug: 37487061
Test: RunSettingsRoboTests
Change-Id: Id1810b81a6b380d908bcdc18421530e938578c37
2017-04-25 11:48:24 -07:00
TreeHugger Robot
e5fa4cd4b5 Merge "Remove STATE_TOP_SLEEPING from foreground time" into oc-dev 2017-04-25 18:36:01 +00:00
jackqdyulei
7c6e6e9254 Remove STATE_TOP_SLEEPING from foreground time
That state means the time when app is on top while screen is off,
we should not count it as foreground usage time.

Bug: 37547898
Test: RunSettingsRoboTests
Change-Id: I67e0c135d0c4b71cd667037b0d5dc7673b53607e
2017-04-24 11:37:00 -07:00
jackqdyulei
f4c1cef322 Add TtsSpan for formatted time.
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
2017-04-21 14:42:42 -07:00
jackqdyulei
7f4c5fc1f4 Move bunch of battery methods to BatteryUtils.java
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
2017-04-12 10:10:51 -07:00
jackqdyulei
5d2918a675 Add log for BatteryUtils
This cl add logs to get more data for app usage time.

Also refactor BatteryUtils to singleton pattern because we need
to extract package name from uid.

Bug: 36909166
Test: RunSettingsRoboTests
Change-Id: I6ede354035c46e46cb856b7cf57bd1b7ccbd6d4f
2017-04-07 11:18:39 -07:00
jackqdyulei
ddba966700 Revamp the battery usage details page.
This cl adds AdvancedPowerUsageDetail to show the usage details page.
The AdvancedPowerUsageDetail contains all the needed ui components:
1. App Header
2. Two buttons
3. Usage breakdown preference category
4. Power management preference category

This cl also adds preference controller for two buttons but the
detail implementation will be added in the following cl.

Following cl will also remove previous detail page.

Bug: 35810915
Test: RunSettingsRoboTests
Change-Id: I17f95d1288762094671c0f148fa73367e51f175e
2017-03-24 20:58:44 -07:00