Display the chart levels data into BatteryHistoryPreference

Bug: 184807417
Bug: 180607918
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I78718a59671ca6775abc725432fbfbec6c0993fe
This commit is contained in:
ykhung
2021-04-09 17:40:40 +08:00
committed by YUKAI HUNG
parent 9b226a4ff0
commit 740ac9a047
5 changed files with 136 additions and 15 deletions

View File

@@ -25,11 +25,16 @@ import android.util.Log;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/** A utility class to convert data into another types. */
public final class ConvertUtils {
private static final String TAG = "ConvertUtils";
private static final SimpleDateFormat SIMPLE_DATE_FORMAT =
new SimpleDateFormat("MMM dd,yyyy HH:mm:ss", Locale.ENGLISH);
/** Invalid system battery consumer drain type. */
public static final int INVALID_DRAIN_TYPE = -1;
@@ -101,5 +106,10 @@ public final class ConvertUtils {
return values;
}
/** Converts UTC timestamp to human readable local time string. */
public static String utcToLocalTime(long timestamp) {
return SIMPLE_DATE_FORMAT.format(new Date(timestamp));
}
private ConvertUtils() {}
}