From be300225df4ac43f84c854a646ee1af5d1ae61e6 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 27 Aug 2014 14:04:32 -0700 Subject: [PATCH] Fix issues #16941902, #16901402, and #16135174. Issue #16941902: Charged % of battery is mismatching between phone status area(top right corner) and battery screen Need to make sure the stats are updated when we come back to the foreground. Issue #16901402: Crash in Settings observed after tap on Battery option Don't allow us to have a null stats object. Issue #16135174: Apps page "smoke" gradient footer must be removed Finish tweaking layout to match mocks. Change-Id: I29d56b506a9468ec548feef7c3f9502a9b16ef4d --- res/layout/manage_applications_item.xml | 8 +- res/layout/running_processes_header.xml | 210 ++++++++++-------- res/layout/running_processes_item.xml | 11 +- .../settings/fuelgauge/PowerUsageSummary.java | 11 +- 4 files changed, 134 insertions(+), 106 deletions(-) diff --git a/res/layout/manage_applications_item.xml b/res/layout/manage_applications_item.xml index bf93840fb12..e749859e2d4 100755 --- a/res/layout/manage_applications_item.xml +++ b/res/layout/manage_applications_item.xml @@ -44,7 +44,7 @@ android:layout_marginTop="2dip" android:singleLine="true" android:ellipsize="marquee" - android:textAppearance="?android:attr/textAppearanceMedium" + android:textAppearance="@android:style/TextAppearance.Material.Subhead" android:textAlignment="viewStart" /> + android:textAppearance="@android:style/TextAppearance.Material.Body1" + android:textColor="?android:attr/textColorSecondary" /> diff --git a/res/layout/running_processes_header.xml b/res/layout/running_processes_header.xml index a5a2bc7c14a..38ff6143e3a 100644 --- a/res/layout/running_processes_header.xml +++ b/res/layout/running_processes_header.xml @@ -27,152 +27,168 @@ + android:layout_height="32sp" + android:layout_marginTop="8sp" + android:orientation="horizontal"> - - - + android:layout_gravity="center" + android:orientation="horizontal"> + + + + + android:layout_height="32sp" + android:orientation="horizontal"> - - - + android:layout_gravity="center" + android:orientation="horizontal"> + + + + + android:layout_height="32sp" + android:orientation="horizontal"> - - - + android:layout_gravity="center" + android:orientation="horizontal"> + + + + diff --git a/res/layout/running_processes_item.xml b/res/layout/running_processes_item.xml index 52cecf640bb..036a90e45c7 100644 --- a/res/layout/running_processes_item.xml +++ b/res/layout/running_processes_item.xml @@ -48,7 +48,7 @@ android:layout_weight="1" android:singleLine="true" android:ellipsize="marquee" - android:textAppearance="?android:attr/textAppearanceMedium" + android:textAppearance="@android:style/TextAppearance.Material.Subhead" android:textAlignment="viewStart" /> + android:textAppearance="@android:style/TextAppearance.Material.Body1" + android:textColor="?android:attr/textColorSecondary" /> @@ -69,7 +70,8 @@ android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" - android:textAppearance="?android:attr/textAppearanceSmall" + android:textAppearance="@android:style/TextAppearance.Material.Body1" + android:textColor="?android:attr/textColorSecondary" android:textAlignment="viewStart" /> + android:textAppearance="@android:style/TextAppearance.Material.Body1" + android:textColor="?android:attr/textColorSecondary" /> diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java index b26ba65f978..5325ed3e717 100644 --- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java +++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java @@ -112,6 +112,12 @@ public class PowerUsageSummary extends PreferenceFragment { setHasOptionsMenu(true); } + @Override + public void onStart() { + super.onStart(); + mStatsHelper.clearStats(); + } + @Override public void onResume() { super.onResume(); @@ -250,7 +256,8 @@ public class PowerUsageSummary extends PreferenceFragment { mAppListGroup.addPreference(mHistPref); boolean addedSome = false; - PowerProfile powerProfile = mStatsHelper.getPowerProfile(); + final PowerProfile powerProfile = mStatsHelper.getPowerProfile(); + final BatteryStats stats = mStatsHelper.getStats(); final double averagePower = powerProfile.getAveragePower(PowerProfile.POWER_SCREEN_FULL); if (averagePower >= MIN_AVERAGE_POWER_THRESHOLD_MILLI_AMP) { final List profiles = mUm.getUserProfiles(); @@ -259,7 +266,7 @@ public class PowerUsageSummary extends PreferenceFragment { final List usageList = mStatsHelper.getUsageList(); - final int dischargeAmount = mStatsHelper.getStats().getDischargeAmount(mStatsType); + final int dischargeAmount = stats != null ? stats.getDischargeAmount(mStatsType) : 0; final int numSippers = usageList.size(); for (int i = 0; i < numSippers; i++) { final BatterySipper sipper = usageList.get(i);