Extract method getBatteryInfo() from loader

In battery tips, we need synchronized method to get batteryInfo.
This cl move the logic to BatteryUtils, then in battery tips we
could use this method directly.

Bug: 70570352
Test: robotest still pass
Change-Id: Id69349a25395ae472a9b3152c6f04127ee32c4e1
This commit is contained in:
jackqdyulei
2017-12-13 11:13:14 -08:00
parent fde63fc351
commit 0c6d7e744a
3 changed files with 50 additions and 44 deletions

View File

@@ -198,7 +198,7 @@ public class AdvancedPowerUsageDetailTest {
doReturn(mPackageManager).when(mTestActivity).getPackageManager();
doReturn(mAppOpsManager).when(mTestActivity).getSystemService(Context.APP_OPS_SERVICE);
mBatteryUtils = spy(BatteryUtils.getInstance(mTestActivity));
mBatteryUtils = spy(new BatteryUtils(mContext));
doReturn(FOREGROUND_SERVICE_TIME_US).when(mBatteryUtils).getForegroundServiceTotalTimeUs(
any(BatteryStats.Uid.class), anyLong());