Format battery java code

After this CL, we can follow Guideline:go/hc-mainline-dev#format-code to keep java format consistent.

Test: manual
Bug: 304439460
Change-Id: I5bb77f81b0bd9be618e34942eaaee8296bc42796
This commit is contained in:
Jun Lan
2023-11-02 18:55:52 +08:00
parent da70c86bda
commit cca804e1ed
127 changed files with 4343 additions and 3581 deletions

View File

@@ -34,8 +34,7 @@ public final class BatteryOptimizeLogUtils {
private static final String BATTERY_OPTIMIZE_FILE_NAME = "battery_optimize_historical_logs";
private static final String LOGS_KEY = "battery_optimize_logs_key";
@VisibleForTesting
static final int MAX_ENTRIES = 40;
@VisibleForTesting static final int MAX_ENTRIES = 40;
private BatteryOptimizeLogUtils() {}
@@ -45,8 +44,11 @@ public final class BatteryOptimizeLogUtils {
writeLog(getSharedPreferences(context), action, packageName, actionDescription);
}
static void writeLog(SharedPreferences sharedPreferences, Action action,
String packageName, String actionDescription) {
static void writeLog(
SharedPreferences sharedPreferences,
Action action,
String packageName,
String actionDescription) {
writeLog(
sharedPreferences,
BatteryOptimizeHistoricalLogEntry.newBuilder()
@@ -70,10 +72,7 @@ public final class BatteryOptimizeLogUtils {
String loggingContent =
Base64.encodeToString(newLogBuilder.build().toByteArray(), Base64.DEFAULT);
sharedPreferences
.edit()
.putString(LOGS_KEY, loggingContent)
.apply();
sharedPreferences.edit().putString(LOGS_KEY, loggingContent).apply();
}
private static BatteryOptimizeHistoricalLog parseLogFromString(String storedLogs) {
@@ -107,9 +106,11 @@ public final class BatteryOptimizeLogUtils {
}
private static String toString(BatteryOptimizeHistoricalLogEntry entry) {
return String.format("%s\t%s\taction:%s\tevent:%s",
return String.format(
"%s\t%s\taction:%s\tevent:%s",
ConvertUtils.utcToLocalTimeForLogging(entry.getTimestamp()),
entry.getPackageName(), entry.getAction(),
entry.getPackageName(),
entry.getAction(),
entry.getActionDescription());
}