1. Add both model and detector
2. Move the screen usage method to BatteryUtils
so we could reuse it.
3. Add and update the tests
Bug: 70570352
Test: RunSettingsRoboTests
Change-Id: I6a7248d9d48ee8cb6fc2c18c8c225210d49b6bc9
This cl adds the basic structure for battery tip:
1. BaseBatteryTip: Model class to represent the tip and build
preference and dialog
2. SummaryTip: Display a general battery summary(i.e. your battery
is good..)
3. BatteryTipLoader: AsyncLoader to load the battery tips.
4. BatteryTipPreferenceController: preference controller for
preference group to display battery tips
This cl also:
1. Remove the anomaly code in PowerUsageSummary and we will add it
to app restriction in future.
2. Add preference_category_no_title.xml to avoid the extra 32dp
blank at the top.
Bug: 70570352
Test: RunSettingsRoboTests
Change-Id: If91a553888e2eb91d55fb1d0d7bbea69652f144c
If feature flag is on, then display the app list. Otherwise disable
it.
Bug: 70234293
Test: RunSettingsRoboTests
Change-Id: I1663f925abf95e0e4c1a46d98ca165303a76e979
Move the app list in battery settings to PreferenceController. So that
we can:
1. Clean the code in PowerUsageSummary
2. Make it easy to add/move the app list to other place in furture.
This cl:
1. Move and make it invisible since in P we don't show app list in
battery main page.
2. Move related test to BatteryAppListPreferenceControllerTest
Bug: 70234293
Test: RunSettingsRoboTests
Change-Id: Ice7a42394916ff5e71305bfe22f5c35868d87fc7
Create PowerUsageSummaryLegacy and power_usage_summary_legacy, which
contains the old implementaion.
Bug: 69797586
Test: RunSettingsRoboTests
Change-Id: Icb9c25f06889462a6eedea48ae166043a6636848
This is dead code that should no longer be around. Note: we can't
remove the metrics constant from the proto because then someone
might try reusing it.
Test: Robotests Pass
Bug: 65599785
Change-Id: Idda679eeca739e34c2371b7aafec23a3339b7f1a
Previously, relative times were formatted using formatElapsedTime()
(appending translations of "ago" to them), sometimes resulting in
grammatically hard-to-understand or unnatural localizations. Now we
use ICU's RelativeDateTimeFormatter, which uses grammatically correct
and natural localizations from CLDR data.
Bug: 64507689
Bug: 64605781
Bug: 64556849
Bug: 64550172
Test: make -j RunSettingsRoboTests
Change-Id: Ia2d098b190ab99e7748ef6f03b919f5c6174ba7d
Before this cl, the app list couldn't distinguish different users
because all of them have the same key: USER.
This cl adds userId into key, to make sure the preference key
is unique.
Bug: 64605854
Test: RunSettingsRoboTests
Change-Id: Ia4de2ff85b214465a35f1983ca69a9280d053154
Convert input device search into a search query loader
And remove old logic from DynamicIndexableContentMonitor
Change-Id: If652b1ea7c8add9185bbd025055e14925d3a8eec
Bug: 64310452
Bug: 63831980
Test: robotests
If we only toggle the app type in battery settings, don't update
the header. Then it won't have flicker in battery header.
Bug: 64065456
Test: RunSettingsRoboTest
Change-Id: If1cfa745f723f808ad9c5fd921be797acd3199ba
Add foreground service time to foreground usage time of apps. This will
account for app usage that user is aware of but is not being displayed
on screen, such as playing music while screen is locked.
Change-Id: Ica9fe0819e46b50299eb2eab7f0483ea01441fb0
Fixes: 38313557
Test: RunSettingsRoboTests
Previously, the long click handler was unregistered on first use and
never re-registered. This meant that, e.g., on plugging and unplugging
the phone, debug mode stopped working. This change moves long click
activation into restartBatteryInfoLoader().
Bug: 63133793
Test: make RunSettingsRoboTests
Merged-In: I4c25a1f05ab3718bf06faf455cf670b5460a7306
Change-Id: I4c25a1f05ab3718bf06faf455cf670b5460a7306
Previously, the long click handler was unregistered on first use and
never re-registered. This meant that, e.g., on plugging and unplugging
the phone, debug mode stopped working. This change moves long click
activation into restartBatteryInfoLoader().
Bug: 63133793
Test: make RunSettingsRoboTests
Change-Id: I4c25a1f05ab3718bf06faf455cf670b5460a7306
Change it from "Screen usage 2m" to "2m", since this is not a screen
usage. This cl has effect on all non-app batterySipper.
Bug: 63443732
Test: RunSettingsRoboTests
Change-Id: I027b3234bd7b56738ab31c5dfbc0d8bd7f19186e
Hide it in any condition:
1. both in app usage list and device usage list
2. in all targets(i.e. user, userdebug..)
Bug: 62422405
Test: RunSettingsRoboTests
Change-Id: I36bd043942ce7e2353163868bf6d86f422f8e7ee
Instead, this decision is being handled via AnomalyDetectionPolicy.
Change-Id: I5b1831c78e31e3be984dda07bcea9f0b0a25d52f
Fixes: 62871629
Test: robotests
Before this cl, it will re-calculate battery percentage once we get
anomaly data, which will add screen usage data twice. This cl make it
only update anomaly icon after the anomaly detection is done.
Bug: 62803379
Test: RunSettingsRoboTests
Change-Id: I2089646679e299fa948b1f3ed21f4a13a1317aa3
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
This flag is used to decide whether to show all the apps
(including system app, service..) in battery settings
Handle it in onCreate() and onSaveInstanceState()
Bug: 62422948
Test: RunSettingsRoboTests
Change-Id: I30c0d6e1e25902f1192fc2564aa09d635b5e0f4f
1. If it is a normal app, show "Screen usage TIME"
2. If it is a hidden app, show "TIME"
Note that in this case the item screen will show "TIME"
Bug: 62422404
Test: RunSettingsRoboTests
Change-Id: Ie8d6caf998d18994ac158f0217109c0e5e9f92ba
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
this CL changes BatteryInfo methods to all use the async style
callback approach it had for one of the methods. Non-async methods
are now annotated to only be used in worker threads. BatteryInfo
can now be obtained via callback by calling one of the async
methods. Alternatively if there is a worker thread available
the synchronous methods similar to the old ones can be used.
The callback methods have all been changed so that they cascade to a
async method that takes all the required info as paremeters. This
will minimize the amount of churn in files that currently use
BatteryInfo.
A new loader was created that can be used to get BatteryInfo in
places that wish to get it. This loader is used in
PowerUsageSummary to get the BatteryInfo.
Test: Robotests
Bug: 38399275
Bug: 38398949
Bug: 38399654
Change-Id: Ic5a82d8ca4c85fad1b883226327ec083badf861d
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
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
Merged-In: Ic3622bb73562ba42e69b37e5674a724c03c45f12
Change-Id: Ic3622bb73562ba42e69b37e5674a724c03c45f12
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
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
This CL updates the battery page to get the updated strings and
other relevant battery info from directly from SettingsLib by
providing it an overrided drain time instead of manually changing
the value in the returned info. This will provide the added benefit
of using the new strings when appropriate that tell the user that
the estimate provided is based on their usage.
Test: robotests
Bug: 38399659
Change-Id: I0db572c2ea78910756314b6bf066d37e9f90a15c
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