Listen ACTION_BATTERY_LEVEL_CHANGED in Settings and fetch usage data
when battery is full charged. Bug: 253395332 Test: make RunSettingsRoboTests + manually Change-Id: Ie83e5f319074ff404a600c4eb375fbecad651b6d
This commit is contained in:
@@ -141,6 +141,12 @@ public final class DatabaseUtils {
|
||||
});
|
||||
}
|
||||
|
||||
/** Gets the latest sticky battery intent from framework. */
|
||||
static Intent getBatteryIntent(Context context) {
|
||||
return context.registerReceiver(
|
||||
/*receiver=*/ null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
}
|
||||
|
||||
static List<ContentValues> sendBatteryEntryData(
|
||||
Context context,
|
||||
List<BatteryEntry> batteryEntryList,
|
||||
@@ -300,12 +306,6 @@ public final class DatabaseUtils {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/** Gets the latest sticky battery intent from framework. */
|
||||
private static Intent getBatteryIntent(Context context) {
|
||||
return context.registerReceiver(
|
||||
/*receiver=*/ null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
}
|
||||
|
||||
private static int getBatteryLevel(Intent intent) {
|
||||
final int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
|
||||
final int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0);
|
||||
|
Reference in New Issue
Block a user