Fixing some lint errors.
Bug: 220586744 Test: 'adb dumpsys display' Change-Id: Ie14ed808a7ee37ad82bc668626ea1bd9bb92374f
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.server.display;
|
package com.android.server.display;
|
||||||
|
|
||||||
|
import static android.text.TextUtils.formatSimple;
|
||||||
|
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -36,6 +38,7 @@ import com.android.server.display.whitebalance.DisplayWhiteBalanceController;
|
|||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -994,25 +997,25 @@ public abstract class BrightnessMappingStrategy {
|
|||||||
Arrays.sort(luxes);
|
Arrays.sort(luxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer sbLux = null;
|
StringBuilder sbLux = null;
|
||||||
StringBuffer sbNits = null;
|
StringBuilder sbNits = null;
|
||||||
StringBuffer sbLong = null;
|
StringBuilder sbLong = null;
|
||||||
StringBuffer sbShort = null;
|
StringBuilder sbShort = null;
|
||||||
StringBuffer sbBrightness = null;
|
StringBuilder sbBrightness = null;
|
||||||
StringBuffer sbPercent = null;
|
StringBuilder sbPercent = null;
|
||||||
StringBuffer sbPercentHbm = null;
|
StringBuilder sbPercentHbm = null;
|
||||||
boolean needsHeaders = true;
|
boolean needsHeaders = true;
|
||||||
String separator = "";
|
String separator = "";
|
||||||
for (int i = 0; i < luxes.length; i++) {
|
for (int i = 0; i < luxes.length; i++) {
|
||||||
float lux = luxes[i];
|
float lux = luxes[i];
|
||||||
if (needsHeaders) {
|
if (needsHeaders) {
|
||||||
sbLux = new StringBuffer(" lux: ");
|
sbLux = new StringBuilder(" lux: ");
|
||||||
sbNits = new StringBuffer(" default: ");
|
sbNits = new StringBuilder(" default: ");
|
||||||
sbLong = new StringBuffer(" long-term: ");
|
sbLong = new StringBuilder(" long-term: ");
|
||||||
sbShort = new StringBuffer(" current: ");
|
sbShort = new StringBuilder(" current: ");
|
||||||
sbBrightness = new StringBuffer(" current(bl): ");
|
sbBrightness = new StringBuilder(" current(bl): ");
|
||||||
sbPercent = new StringBuffer(" current(%): ");
|
sbPercent = new StringBuilder(" current(%): ");
|
||||||
sbPercentHbm = new StringBuffer(" current(%hbm): ");
|
sbPercentHbm = new StringBuilder(" current(hbm%): ");
|
||||||
needsHeaders = false;
|
needsHeaders = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,13 +1045,13 @@ public abstract class BrightnessMappingStrategy {
|
|||||||
String format = separator + "%" + maxLen + "s";
|
String format = separator + "%" + maxLen + "s";
|
||||||
separator = ", ";
|
separator = ", ";
|
||||||
|
|
||||||
sbLux.append(String.format(format, strLux));
|
sbLux.append(formatSimple(format, strLux));
|
||||||
sbNits.append(String.format(format, strNits));
|
sbNits.append(formatSimple(format, strNits));
|
||||||
sbLong.append(String.format(format, strLong));
|
sbLong.append(formatSimple(format, strLong));
|
||||||
sbShort.append(String.format(format, strShort));
|
sbShort.append(formatSimple(format, strShort));
|
||||||
sbBrightness.append(String.format(format, strBrightness));
|
sbBrightness.append(formatSimple(format, strBrightness));
|
||||||
sbPercent.append(String.format(format, strPercent));
|
sbPercent.append(formatSimple(format, strPercent));
|
||||||
sbPercentHbm.append(String.format(format, strPercentHbm));
|
sbPercentHbm.append(formatSimple(format, strPercentHbm));
|
||||||
|
|
||||||
// At 80 chars, start another row
|
// At 80 chars, start another row
|
||||||
if (sbLux.length() > 80 || (i == luxes.length - 1)) {
|
if (sbLux.length() > 80 || (i == luxes.length - 1)) {
|
||||||
@@ -1072,13 +1075,13 @@ public abstract class BrightnessMappingStrategy {
|
|||||||
if (value == 0.0f) {
|
if (value == 0.0f) {
|
||||||
return "0";
|
return "0";
|
||||||
} else if (value < 0.1f) {
|
} else if (value < 0.1f) {
|
||||||
return String.format("%.3f", value);
|
return String.format(Locale.US, "%.3f", value);
|
||||||
} else if (value < 1) {
|
} else if (value < 1) {
|
||||||
return String.format("%.2f", value);
|
return String.format(Locale.US, "%.2f", value);
|
||||||
} else if (value < 10) {
|
} else if (value < 10) {
|
||||||
return String.format("%.1f", value);
|
return String.format(Locale.US, "%.1f", value);
|
||||||
} else {
|
} else {
|
||||||
return String.format("%d", Math.round(value));
|
return formatSimple("%d", Math.round(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user