Remove some debugging log to avoid print too much data out
Fixes: 194251993 Fixes: 194021631 Test: make SettingsRoboTests Change-Id: Ibd1c7ce9d664820b2975039582a1ea5fb18b0be1
This commit is contained in:
@@ -173,6 +173,9 @@ public class AppBatteryPreferenceController extends BasePreferenceController
|
||||
new AsyncTask<Void, Void, BatteryDiffEntry>() {
|
||||
@Override
|
||||
protected BatteryDiffEntry doInBackground(Void... unused) {
|
||||
if (mPackageName == null) {
|
||||
return null;
|
||||
}
|
||||
final List<BatteryDiffEntry> batteryDiffEntries =
|
||||
BatteryChartPreferenceController.getBatteryLast24HrUsageData(mContext);
|
||||
if (batteryDiffEntries == null) {
|
||||
@@ -186,8 +189,7 @@ public class AppBatteryPreferenceController extends BasePreferenceController
|
||||
== ConvertUtils.CONSUMER_TYPE_UID_BATTERY)
|
||||
.filter(entry -> entry.mBatteryHistEntry.mUserId == mUserId)
|
||||
.filter(entry -> {
|
||||
if (entry.mBatteryHistEntry.mPackageName
|
||||
.equals(mPackageName)) {
|
||||
if (mPackageName.equals(entry.getPackageName())) {
|
||||
Log.i(TAG, "Return target application: "
|
||||
+ entry.mBatteryHistEntry.mPackageName
|
||||
+ " | uid: " + entry.mBatteryHistEntry.mUid
|
||||
|
@@ -226,8 +226,8 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
new Pair(ConvertUtils.METRIC_KEY_PACKAGE, packageName),
|
||||
new Pair(ConvertUtils.METRIC_KEY_BATTERY_LEVEL, histEntry.mBatteryLevel),
|
||||
new Pair(ConvertUtils.METRIC_KEY_BATTERY_USAGE, powerPref.getPercent()));
|
||||
Log.d(TAG, String.format("handleClick() label=%s key=%s enntry=\n%s",
|
||||
diffEntry.getAppLabel(), histEntry.getKey(), histEntry));
|
||||
Log.d(TAG, String.format("handleClick() label=%s key=%s package=%s",
|
||||
diffEntry.getAppLabel(), histEntry.getKey(), histEntry.mPackageName));
|
||||
AdvancedPowerUsageDetail.startBatteryDetailPage(
|
||||
mActivity, mFragment, diffEntry, powerPref.getPercent(),
|
||||
isValidToShowSummary(packageName), getSlotInformation());
|
||||
@@ -285,9 +285,10 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
}
|
||||
forceRefreshUi();
|
||||
Log.d(TAG, String.format(
|
||||
"setBatteryHistoryMap() size=%d\nkeys=%s\nlevels=%s",
|
||||
"setBatteryHistoryMap() size=%d key=%s\nlevels=%s",
|
||||
batteryHistoryMap.size(),
|
||||
utcToLocalTime(mPrefContext, mBatteryHistoryKeys),
|
||||
ConvertUtils.utcToLocalTime(mPrefContext,
|
||||
mBatteryHistoryKeys[mBatteryHistoryKeys.length - 1]),
|
||||
Arrays.toString(mBatteryHistoryLevels)));
|
||||
|
||||
// Loads item icon and label in the background.
|
||||
@@ -403,14 +404,14 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
final String appLabel = entry.getAppLabel();
|
||||
final Drawable appIcon = entry.getAppIcon();
|
||||
if (TextUtils.isEmpty(appLabel) || appIcon == null) {
|
||||
Log.w(TAG, "cannot find app resource for\n" + entry);
|
||||
Log.w(TAG, "cannot find app resource for:" + entry.getPackageName());
|
||||
continue;
|
||||
}
|
||||
final String prefKey = entry.mBatteryHistEntry.getKey();
|
||||
PowerGaugePreference pref = mAppListPrefGroup.findPreference(prefKey);
|
||||
if (pref != null) {
|
||||
isAdded = true;
|
||||
Log.w(TAG, "preference should be removed for\n" + entry);
|
||||
Log.w(TAG, "preference should be removed for:" + entry.getPackageName());
|
||||
} else {
|
||||
pref = (PowerGaugePreference) mPreferenceCache.get(prefKey);
|
||||
}
|
||||
@@ -587,15 +588,6 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
mHandler.post(() -> mPreferenceScreen.addPreference(mFooterPreference));
|
||||
}
|
||||
|
||||
private static String utcToLocalTime(Context context, long[] timestamps) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (int index = 0; index < timestamps.length; index++) {
|
||||
builder.append(String.format("%s| ",
|
||||
ConvertUtils.utcToLocalTime(context, timestamps[index])));
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private static boolean contains(String target, CharSequence[] packageNames) {
|
||||
if (target != null && packageNames != null) {
|
||||
for (CharSequence packageName : packageNames) {
|
||||
|
@@ -139,6 +139,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
||||
|
||||
/** Sets all levels value to draw the trapezoid shape */
|
||||
public void setLevels(int[] levels) {
|
||||
Log.d(TAG, "setLevels() " + (levels == null ? "null" : levels.length));
|
||||
if (levels == null) {
|
||||
mLevels = null;
|
||||
return;
|
||||
|
@@ -22,6 +22,7 @@ import java.time.Duration;
|
||||
|
||||
/** A container class to carry data from {@link ContentValues}. */
|
||||
public class BatteryHistEntry {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "BatteryHistEntry";
|
||||
|
||||
/** Keys for accessing {@link ContentValues} or {@link Cursor}. */
|
||||
@@ -316,9 +317,11 @@ public class BatteryHistEntry {
|
||||
if (upperHistEntry.mConsumePower < consumePower
|
||||
|| upperHistEntry.mForegroundUsageTimeInMs < foregroundUsageTimeInMs
|
||||
|| upperHistEntry.mBackgroundUsageTimeInMs < backgroundUsageTimeInMs) {
|
||||
Log.w(TAG, String.format(
|
||||
"abnormal interpolation:\nupper:%s\nlower:%s",
|
||||
upperHistEntry, lowerHistEntry));
|
||||
if (DEBUG) {
|
||||
Log.w(TAG, String.format(
|
||||
"abnormal interpolation:\nupper:%s\nlower:%s",
|
||||
upperHistEntry, lowerHistEntry));
|
||||
}
|
||||
}
|
||||
final double batteryLevel =
|
||||
lowerHistEntry == null
|
||||
|
@@ -41,6 +41,7 @@ import java.util.TimeZone;
|
||||
|
||||
/** A utility class to convert data into another types. */
|
||||
public final class ConvertUtils {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "ConvertUtils";
|
||||
private static final Map<String, BatteryHistEntry> EMPTY_BATTERY_MAP = new HashMap<>();
|
||||
private static final BatteryHistEntry EMPTY_BATTERY_HIST_ENTRY =
|
||||
@@ -259,10 +260,12 @@ public final class ConvertUtils {
|
||||
foregroundUsageTimeInMs + backgroundUsageTimeInMs;
|
||||
if (totalUsageTimeInMs > TOTAL_TIME_THRESHOLD) {
|
||||
final float ratio = TOTAL_TIME_THRESHOLD / totalUsageTimeInMs;
|
||||
Log.w(TAG, String.format("abnormal usage time %d|%d for:\n%s",
|
||||
Duration.ofMillis(foregroundUsageTimeInMs).getSeconds(),
|
||||
Duration.ofMillis(backgroundUsageTimeInMs).getSeconds(),
|
||||
currentEntry));
|
||||
if (DEBUG) {
|
||||
Log.w(TAG, String.format("abnormal usage time %d|%d for:\n%s",
|
||||
Duration.ofMillis(foregroundUsageTimeInMs).getSeconds(),
|
||||
Duration.ofMillis(backgroundUsageTimeInMs).getSeconds(),
|
||||
currentEntry));
|
||||
}
|
||||
foregroundUsageTimeInMs =
|
||||
Math.round(foregroundUsageTimeInMs * ratio);
|
||||
backgroundUsageTimeInMs =
|
||||
|
Reference in New Issue
Block a user