Add infra for battery tip

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
This commit is contained in:
jackqdyulei
2017-12-12 12:52:35 -08:00
parent 444989ad35
commit fde63fc351
13 changed files with 700 additions and 65 deletions

View File

@@ -339,15 +339,14 @@ public class PowerUsageSummaryTest {
}
@Test
public void testInitAnomalyDetectionIfPossible_detectionEnabled_init() {
public void testRestartBatteryTipLoader() {
//TODO: add policy logic here when BatteryTipPolicy is implemented
doReturn(mLoaderManager).when(mFragment).getLoaderManager();
doReturn(mAnomalyDetectionPolicy).when(mFragment).getAnomalyDetectionPolicy();
when(mAnomalyDetectionPolicy.isAnomalyDetectionEnabled()).thenReturn(true);
mFragment.restartAnomalyDetectionIfPossible();
mFragment.restartBatteryTipLoader();
verify(mLoaderManager).restartLoader(eq(PowerUsageSummary.ANOMALY_LOADER), eq(Bundle.EMPTY),
any());
verify(mLoaderManager).restartLoader(eq(PowerUsageSummary.BATTERY_TIP_LOADER),
eq(Bundle.EMPTY), any());
}
@Test