Fuelgauge handle StatsManager Exception API

StatsManager now returns Exceptions for certain errors, instead of
returning a boolean. Thus Fuelgauge needs to be updated.

Bug: 77648233
Test: make ROBOTEST_FILTER=AnomalyConfigJobServiceTest RunSettingsRoboTests
Change-Id: I7160ac01141c673c90e33423220dc888a2710340
This commit is contained in:
Bookatz
2018-04-10 17:40:42 -07:00
parent b410c21a01
commit e832c153c0
4 changed files with 36 additions and 21 deletions

View File

@@ -104,7 +104,8 @@ public class AnomalyConfigJobServiceTest {
}
@Test
public void checkAnomalyConfig_newConfigExist_removeOldConfig() {
public void checkAnomalyConfig_newConfigExist_removeOldConfig()
throws StatsManager.StatsUnavailableException{
Settings.Global.putInt(application.getContentResolver(),
Settings.Global.ANOMALY_CONFIG_VERSION, ANOMALY_CONFIG_VERSION);
Settings.Global.putString(application.getContentResolver(), Settings.Global.ANOMALY_CONFIG,
@@ -112,11 +113,12 @@ public class AnomalyConfigJobServiceTest {
mJobService.checkAnomalyConfig(mStatsManager);
verify(mStatsManager).removeConfiguration(StatsManagerConfig.ANOMALY_CONFIG_KEY);
verify(mStatsManager).removeConfig(StatsManagerConfig.ANOMALY_CONFIG_KEY);
}
@Test
public void checkAnomalyConfig_newConfigExist_uploadNewConfig() {
public void checkAnomalyConfig_newConfigExist_uploadNewConfig()
throws StatsManager.StatsUnavailableException{
Settings.Global.putInt(application.getContentResolver(),
Settings.Global.ANOMALY_CONFIG_VERSION, ANOMALY_CONFIG_VERSION);
Settings.Global.putString(application.getContentResolver(), Settings.Global.ANOMALY_CONFIG,
@@ -124,7 +126,7 @@ public class AnomalyConfigJobServiceTest {
mJobService.checkAnomalyConfig(mStatsManager);
verify(mStatsManager).addConfiguration(eq(StatsManagerConfig.ANOMALY_CONFIG_KEY), any());
verify(mStatsManager).addConfig(eq(StatsManagerConfig.ANOMALY_CONFIG_KEY), any());
}
}