Merge "Add some more logging to settings battery stuff" into oc-dr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e4c9b7162d
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
@@ -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();
|
||||
}
|
||||
|
@@ -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;
|
||||
@@ -186,6 +187,7 @@ public class PowerUsageAdvanced extends PowerUsageBase {
|
||||
}
|
||||
|
||||
BatteryEntry.startRequestQueue();
|
||||
BatteryUtils.logRuntime(TAG, "refreshUI", startTime);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -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;
|
||||
@@ -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
|
||||
|
@@ -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;
|
||||
@@ -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) {
|
||||
@@ -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));
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -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() {
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -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);
|
||||
@@ -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) {
|
||||
|
Reference in New Issue
Block a user