Fix UI flashes issue when entering to the app in the cold start am: 5b27fd923a

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14456007

Change-Id: Id4d9678378f1d1aae64ea8ca9e64ab3458b2b680
This commit is contained in:
ykhung
2021-05-09 04:27:18 +00:00
committed by Automerger Merge Worker
6 changed files with 14 additions and 7 deletions

View File

@@ -167,6 +167,7 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
super.displayPreference(screen);
mPrefContext = screen.getContext();
mAppListGroup = screen.findPreference(mPreferenceKey);
mAppListGroup.setTitle(mPrefContext.getString(R.string.power_usage_list_summary));
}
@Override

View File

@@ -157,6 +157,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
} else {
mTextPaint = null;
}
setVisibility(View.VISIBLE);
requestLayout();
}

View File

@@ -214,13 +214,11 @@ public final class ConvertUtils {
currentEntry.mBackgroundUsageTimeInMs,
nextEntry.mBackgroundUsageTimeInMs,
nextTwoEntry.mBackgroundUsageTimeInMs);
final double consumePower =
double consumePower =
getDiffValue(
currentEntry.mConsumePower,
nextEntry.mConsumePower,
nextTwoEntry.mConsumePower);
totalConsumePower += consumePower;
// Excludes entry since we don't have enough data to calculate.
if (foregroundUsageTimeInMs == 0
&& backgroundUsageTimeInMs == 0
@@ -246,7 +244,9 @@ public final class ConvertUtils {
Math.round(foregroundUsageTimeInMs * ratio);
backgroundUsageTimeInMs =
Math.round(backgroundUsageTimeInMs * ratio);
consumePower = consumePower * ratio;
}
totalConsumePower += consumePower;
batteryDiffEntryList.add(
new BatteryDiffEntry(
context,