Loading src/com/android/settings/fuelgauge/BatteryHistoryPreference.java +3 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.settings.graph.UsageView; * subsystem/app type. */ public class BatteryHistoryPreference extends Preference { private static final String TAG = "BatteryHistoryPreference"; private CharSequence mSummary; private TextView mSummaryView; Loading Loading @@ -73,6 +74,7 @@ public class BatteryHistoryPreference extends Preference { @Override public void onBindViewHolder(PreferenceViewHolder view) { super.onBindViewHolder(view); final long startTime = System.currentTimeMillis(); if (mBatteryInfo == null) { return; } Loading @@ -88,5 +90,6 @@ public class BatteryHistoryPreference extends Preference { UsageView usageView = (UsageView) view.findViewById(R.id.battery_usage); usageView.findViewById(R.id.label_group).setAlpha(.7f); mBatteryInfo.bindHistory(usageView); BatteryUtils.logRuntime(TAG, "onBindViewHolder", startTime); } } src/com/android/settings/fuelgauge/BatteryInfo.java +8 −1 Original line number Diff line number Diff line Loading @@ -136,14 +136,19 @@ public class BatteryInfo { public static void getBatteryInfo(final Context context, final Callback callback, boolean shortString) { final long startTime = System.currentTimeMillis(); BatteryStatsHelper statsHelper = new BatteryStatsHelper(context, true); statsHelper.create((Bundle) null); BatteryUtils.logRuntime(LOG_TAG, "time to make batteryStatsHelper", startTime); BatteryInfo.getBatteryInfo(context, callback, statsHelper, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, BatteryStatsHelper statsHelper, boolean shortString) { getBatteryInfo(context, callback, statsHelper.getStats(), shortString); final long startTime = System.currentTimeMillis(); BatteryStats stats = statsHelper.getStats(); BatteryUtils.logRuntime(LOG_TAG, "time for getStats", startTime); getBatteryInfo(context, callback, stats, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, Loading Loading @@ -181,7 +186,9 @@ public class BatteryInfo { @Override protected void onPostExecute(BatteryInfo batteryInfo) { final long startTime = System.currentTimeMillis(); callback.onBatteryInfoLoaded(batteryInfo); BatteryUtils.logRuntime(LOG_TAG, "time for callback", startTime); } }.execute(); } Loading src/com/android/settings/fuelgauge/PowerUsageAdvanced.java +2 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ public class PowerUsageAdvanced extends PowerUsageBase { @Override protected void refreshUi() { final long startTime = System.currentTimeMillis(); final Context context = getContext(); if (context == null) { return; Loading @@ -186,6 +187,7 @@ public class PowerUsageAdvanced extends PowerUsageBase { } BatteryEntry.startRequestQueue(); BatteryUtils.logRuntime(TAG, "refreshUI", startTime); } @VisibleForTesting Loading src/com/android/settings/fuelgauge/PowerUsageBase.java +3 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ public abstract class PowerUsageBase extends DashboardFragment // +1 to allow ordering for PowerUsageSummary. @VisibleForTesting static final int MENU_STATS_REFRESH = Menu.FIRST + 1; private static final String TAG = "PowerUsageBase"; protected BatteryStatsHelper mStatsHelper; protected UserManager mUm; Loading Loading @@ -89,7 +90,9 @@ public abstract class PowerUsageBase extends DashboardFragment protected abstract void refreshUi(); protected void updatePreference(BatteryHistoryPreference historyPref) { final long startTime = System.currentTimeMillis(); historyPref.setStats(mStatsHelper); BatteryUtils.logRuntime(TAG, "updatePreference", startTime); } @Override Loading src/com/android/settings/graph/UsageGraph.java +13 −0 Original line number Diff line number Diff line Loading @@ -29,15 +29,18 @@ import android.graphics.Path; import android.graphics.Shader.TileMode; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.SparseIntArray; import android.util.TypedValue; import android.view.View; import com.android.settings.fuelgauge.BatteryUtils; import com.android.settingslib.R; public class UsageGraph extends View { private static final int PATH_DELIM = -1; public static final String LOG_TAG = "UsageGraph"; private final Paint mLinePaint; private final Paint mFillPaint; Loading Loading @@ -108,10 +111,12 @@ public class UsageGraph extends View { } void setMax(int maxX, int maxY) { final long startTime = System.currentTimeMillis(); mMaxX = maxX; mMaxY = maxY; calculateLocalPaths(); postInvalidate(); BatteryUtils.logRuntime(LOG_TAG, "setMax", startTime); } void setDividerLoc(int height) { Loading @@ -133,6 +138,7 @@ public class UsageGraph extends View { private void addPathAndUpdate(SparseIntArray points, SparseIntArray paths, SparseIntArray localPaths) { final long startTime = System.currentTimeMillis(); for (int i = 0, size = points.size(); i < size; i++) { paths.put(points.keyAt(i), points.valueAt(i)); } Loading @@ -140,6 +146,7 @@ public class UsageGraph extends View { paths.put(points.keyAt(points.size() - 1) + 1, PATH_DELIM); calculateLocalPaths(paths, localPaths); postInvalidate(); BatteryUtils.logRuntime(LOG_TAG, "addPathAndUpdate", startTime); } void setAccentColor(int color) { Loading @@ -151,9 +158,11 @@ public class UsageGraph extends View { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { final long startTime = System.currentTimeMillis(); super.onSizeChanged(w, h, oldw, oldh); updateGradient(); calculateLocalPaths(); BatteryUtils.logRuntime(LOG_TAG, "onSizeChanged", startTime); } private void calculateLocalPaths() { Loading @@ -162,6 +171,7 @@ public class UsageGraph extends View { } private void calculateLocalPaths(SparseIntArray paths, SparseIntArray localPaths) { final long startTime = System.currentTimeMillis(); if (getWidth() == 0) { return; } Loading Loading @@ -194,6 +204,7 @@ public class UsageGraph extends View { localPaths.put(lx, ly); } } BatteryUtils.logRuntime(LOG_TAG,"calculateLocalPaths", startTime); } private boolean hasDiff(int x1, int x2) { Loading @@ -220,6 +231,7 @@ public class UsageGraph extends View { @Override protected void onDraw(Canvas canvas) { final long startTime = System.currentTimeMillis(); // Draw lines across the top, middle, and bottom. if (mMiddleDividerLoc != 0) { drawDivider(0, canvas, mTopDividerTint); Loading @@ -235,6 +247,7 @@ public class UsageGraph extends View { drawLinePath(canvas, mLocalProjectedPaths, mDottedPaint); drawFilledPath(canvas, mLocalPaths, mFillPaint); drawLinePath(canvas, mLocalPaths, mLinePaint); BatteryUtils.logRuntime(LOG_TAG, "onDraw", startTime); } private void drawLinePath(Canvas canvas, SparseIntArray localPaths, Paint paint) { Loading Loading
src/com/android/settings/fuelgauge/BatteryHistoryPreference.java +3 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.settings.graph.UsageView; * subsystem/app type. */ public class BatteryHistoryPreference extends Preference { private static final String TAG = "BatteryHistoryPreference"; private CharSequence mSummary; private TextView mSummaryView; Loading Loading @@ -73,6 +74,7 @@ public class BatteryHistoryPreference extends Preference { @Override public void onBindViewHolder(PreferenceViewHolder view) { super.onBindViewHolder(view); final long startTime = System.currentTimeMillis(); if (mBatteryInfo == null) { return; } Loading @@ -88,5 +90,6 @@ public class BatteryHistoryPreference extends Preference { UsageView usageView = (UsageView) view.findViewById(R.id.battery_usage); usageView.findViewById(R.id.label_group).setAlpha(.7f); mBatteryInfo.bindHistory(usageView); BatteryUtils.logRuntime(TAG, "onBindViewHolder", startTime); } }
src/com/android/settings/fuelgauge/BatteryInfo.java +8 −1 Original line number Diff line number Diff line Loading @@ -136,14 +136,19 @@ public class BatteryInfo { public static void getBatteryInfo(final Context context, final Callback callback, boolean shortString) { final long startTime = System.currentTimeMillis(); BatteryStatsHelper statsHelper = new BatteryStatsHelper(context, true); statsHelper.create((Bundle) null); BatteryUtils.logRuntime(LOG_TAG, "time to make batteryStatsHelper", startTime); BatteryInfo.getBatteryInfo(context, callback, statsHelper, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, BatteryStatsHelper statsHelper, boolean shortString) { getBatteryInfo(context, callback, statsHelper.getStats(), shortString); final long startTime = System.currentTimeMillis(); BatteryStats stats = statsHelper.getStats(); BatteryUtils.logRuntime(LOG_TAG, "time for getStats", startTime); getBatteryInfo(context, callback, stats, shortString); } public static void getBatteryInfo(final Context context, final Callback callback, Loading Loading @@ -181,7 +186,9 @@ public class BatteryInfo { @Override protected void onPostExecute(BatteryInfo batteryInfo) { final long startTime = System.currentTimeMillis(); callback.onBatteryInfoLoaded(batteryInfo); BatteryUtils.logRuntime(LOG_TAG, "time for callback", startTime); } }.execute(); } Loading
src/com/android/settings/fuelgauge/PowerUsageAdvanced.java +2 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ public class PowerUsageAdvanced extends PowerUsageBase { @Override protected void refreshUi() { final long startTime = System.currentTimeMillis(); final Context context = getContext(); if (context == null) { return; Loading @@ -186,6 +187,7 @@ public class PowerUsageAdvanced extends PowerUsageBase { } BatteryEntry.startRequestQueue(); BatteryUtils.logRuntime(TAG, "refreshUI", startTime); } @VisibleForTesting Loading
src/com/android/settings/fuelgauge/PowerUsageBase.java +3 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ public abstract class PowerUsageBase extends DashboardFragment // +1 to allow ordering for PowerUsageSummary. @VisibleForTesting static final int MENU_STATS_REFRESH = Menu.FIRST + 1; private static final String TAG = "PowerUsageBase"; protected BatteryStatsHelper mStatsHelper; protected UserManager mUm; Loading Loading @@ -89,7 +90,9 @@ public abstract class PowerUsageBase extends DashboardFragment protected abstract void refreshUi(); protected void updatePreference(BatteryHistoryPreference historyPref) { final long startTime = System.currentTimeMillis(); historyPref.setStats(mStatsHelper); BatteryUtils.logRuntime(TAG, "updatePreference", startTime); } @Override Loading
src/com/android/settings/graph/UsageGraph.java +13 −0 Original line number Diff line number Diff line Loading @@ -29,15 +29,18 @@ import android.graphics.Path; import android.graphics.Shader.TileMode; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.SparseIntArray; import android.util.TypedValue; import android.view.View; import com.android.settings.fuelgauge.BatteryUtils; import com.android.settingslib.R; public class UsageGraph extends View { private static final int PATH_DELIM = -1; public static final String LOG_TAG = "UsageGraph"; private final Paint mLinePaint; private final Paint mFillPaint; Loading Loading @@ -108,10 +111,12 @@ public class UsageGraph extends View { } void setMax(int maxX, int maxY) { final long startTime = System.currentTimeMillis(); mMaxX = maxX; mMaxY = maxY; calculateLocalPaths(); postInvalidate(); BatteryUtils.logRuntime(LOG_TAG, "setMax", startTime); } void setDividerLoc(int height) { Loading @@ -133,6 +138,7 @@ public class UsageGraph extends View { private void addPathAndUpdate(SparseIntArray points, SparseIntArray paths, SparseIntArray localPaths) { final long startTime = System.currentTimeMillis(); for (int i = 0, size = points.size(); i < size; i++) { paths.put(points.keyAt(i), points.valueAt(i)); } Loading @@ -140,6 +146,7 @@ public class UsageGraph extends View { paths.put(points.keyAt(points.size() - 1) + 1, PATH_DELIM); calculateLocalPaths(paths, localPaths); postInvalidate(); BatteryUtils.logRuntime(LOG_TAG, "addPathAndUpdate", startTime); } void setAccentColor(int color) { Loading @@ -151,9 +158,11 @@ public class UsageGraph extends View { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { final long startTime = System.currentTimeMillis(); super.onSizeChanged(w, h, oldw, oldh); updateGradient(); calculateLocalPaths(); BatteryUtils.logRuntime(LOG_TAG, "onSizeChanged", startTime); } private void calculateLocalPaths() { Loading @@ -162,6 +171,7 @@ public class UsageGraph extends View { } private void calculateLocalPaths(SparseIntArray paths, SparseIntArray localPaths) { final long startTime = System.currentTimeMillis(); if (getWidth() == 0) { return; } Loading Loading @@ -194,6 +204,7 @@ public class UsageGraph extends View { localPaths.put(lx, ly); } } BatteryUtils.logRuntime(LOG_TAG,"calculateLocalPaths", startTime); } private boolean hasDiff(int x1, int x2) { Loading @@ -220,6 +231,7 @@ public class UsageGraph extends View { @Override protected void onDraw(Canvas canvas) { final long startTime = System.currentTimeMillis(); // Draw lines across the top, middle, and bottom. if (mMiddleDividerLoc != 0) { drawDivider(0, canvas, mTopDividerTint); Loading @@ -235,6 +247,7 @@ public class UsageGraph extends View { drawLinePath(canvas, mLocalProjectedPaths, mDottedPaint); drawFilledPath(canvas, mLocalPaths, mFillPaint); drawLinePath(canvas, mLocalPaths, mLinePaint); BatteryUtils.logRuntime(LOG_TAG, "onDraw", startTime); } private void drawLinePath(Canvas canvas, SparseIntArray localPaths, Paint paint) { Loading