Add UI for camera + flashlight battery reporting.
Bug: 11694505 Change-Id: Idca51a2e8cc7c2fb3e9d10f84f94e66600dee6fa
This commit is contained in:
33
res/drawable/ic_settings_camera.xml
Normal file
33
res/drawable/ic_settings_camera.xml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2015 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48"
|
||||||
|
android:autoMirrored="true">
|
||||||
|
|
||||||
|
<path android:fillColor="#000000"
|
||||||
|
android:pathData="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64
|
||||||
|
4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77
|
||||||
|
18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44
|
||||||
|
24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0
|
||||||
|
1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99
|
||||||
|
12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0
|
||||||
|
9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"/>
|
||||||
|
</vector>
|
@@ -4023,6 +4023,10 @@
|
|||||||
<string name="battery_stats_screen_on_label">Screen on</string>
|
<string name="battery_stats_screen_on_label">Screen on</string>
|
||||||
<!-- [CHAR LIMIT=25] Label for battery stats gps on state graph -->
|
<!-- [CHAR LIMIT=25] Label for battery stats gps on state graph -->
|
||||||
<string name="battery_stats_gps_on_label">GPS on</string>
|
<string name="battery_stats_gps_on_label">GPS on</string>
|
||||||
|
<!-- [CHAR LIMIT=25] Label for battery stats camera on state graph -->
|
||||||
|
<string name="battery_stats_camera_on_label">Camera on</string>
|
||||||
|
<!-- [CHAR LIMIT=25] Label for battery stats flashlight on state graph -->
|
||||||
|
<string name="battery_stats_flashlight_on_label">Flashlight on</string>
|
||||||
<!-- [CHAR LIMIT=25] Label for battery stats wifi running state graph -->
|
<!-- [CHAR LIMIT=25] Label for battery stats wifi running state graph -->
|
||||||
<string name="battery_stats_wifi_running_label">Wi\u2011Fi</string>
|
<string name="battery_stats_wifi_running_label">Wi\u2011Fi</string>
|
||||||
<!-- [CHAR LIMIT=25] Label for battery stats wake lock state graph -->
|
<!-- [CHAR LIMIT=25] Label for battery stats wake lock state graph -->
|
||||||
@@ -4054,6 +4058,8 @@
|
|||||||
<string name="power_screen">Screen</string>
|
<string name="power_screen">Screen</string>
|
||||||
<!-- Label for power consumed by the flashlight -->
|
<!-- Label for power consumed by the flashlight -->
|
||||||
<string name="power_flashlight">Flashlight</string>
|
<string name="power_flashlight">Flashlight</string>
|
||||||
|
<!-- Label for power consumed by the camera -->
|
||||||
|
<string name="power_camera">Camera</string>
|
||||||
<!-- Label for power consumed by Wi-Fi -->
|
<!-- Label for power consumed by Wi-Fi -->
|
||||||
<string name="power_wifi">Wi\u2011Fi</string>
|
<string name="power_wifi">Wi\u2011Fi</string>
|
||||||
<!-- Label for power consumed by Bluetooth -->
|
<!-- Label for power consumed by Bluetooth -->
|
||||||
@@ -4099,6 +4105,10 @@
|
|||||||
<string name="usage_type_audio">Audio</string>
|
<string name="usage_type_audio">Audio</string>
|
||||||
<!-- Label for Video usage time -->
|
<!-- Label for Video usage time -->
|
||||||
<string name="usage_type_video">Video</string>
|
<string name="usage_type_video">Video</string>
|
||||||
|
<!-- Label for Camera usage time -->
|
||||||
|
<string name="usage_type_camera">Camera</string>
|
||||||
|
<!-- Label for Flashlight usage time -->
|
||||||
|
<string name="usage_type_flashlight">Flashlight</string>
|
||||||
<!-- Label for time that a feature has been on -->
|
<!-- Label for time that a feature has been on -->
|
||||||
<string name="usage_type_on_time">Time on</string>
|
<string name="usage_type_on_time">Time on</string>
|
||||||
<!-- Label for time that there was no cell coverage -->
|
<!-- Label for time that there was no cell coverage -->
|
||||||
@@ -4139,6 +4149,9 @@
|
|||||||
<!-- [CHAR_LIMIT=NONE] Description for power consumed by the flashlight -->
|
<!-- [CHAR_LIMIT=NONE] Description for power consumed by the flashlight -->
|
||||||
<string name="battery_desc_flashlight">Battery used by the flashlight</string>
|
<string name="battery_desc_flashlight">Battery used by the flashlight</string>
|
||||||
|
|
||||||
|
<!-- [CHAR_LIMIT=NONE] Description for power consumed by the camera -->
|
||||||
|
<string name="battery_desc_camera">Battery used by the camera</string>
|
||||||
|
|
||||||
<!-- Description for power consumed by display -->
|
<!-- Description for power consumed by display -->
|
||||||
<string name="battery_desc_display">Battery used by the display and backlight</string>
|
<string name="battery_desc_display">Battery used by the display and backlight</string>
|
||||||
<!-- Suggestion for reducing display power -->
|
<!-- Suggestion for reducing display power -->
|
||||||
|
@@ -182,6 +182,10 @@ public class BatteryEntry {
|
|||||||
name = context.getResources().getString(R.string.power_overcounted);
|
name = context.getResources().getString(R.string.power_overcounted);
|
||||||
iconId = R.drawable.ic_power_system;
|
iconId = R.drawable.ic_power_system;
|
||||||
break;
|
break;
|
||||||
|
case CAMERA:
|
||||||
|
name = context.getResources().getString(R.string.power_camera);
|
||||||
|
iconId = R.drawable.ic_settings_camera;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (iconId > 0) {
|
if (iconId > 0) {
|
||||||
icon = context.getDrawable(iconId);
|
icon = context.getDrawable(iconId);
|
||||||
|
@@ -131,6 +131,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
final Paint mChargingPaint = new Paint();
|
final Paint mChargingPaint = new Paint();
|
||||||
final Paint mScreenOnPaint = new Paint();
|
final Paint mScreenOnPaint = new Paint();
|
||||||
final Paint mGpsOnPaint = new Paint();
|
final Paint mGpsOnPaint = new Paint();
|
||||||
|
final Paint mFlashlightOnPaint = new Paint();
|
||||||
|
final Paint mCameraOnPaint = new Paint();
|
||||||
final Paint mWifiRunningPaint = new Paint();
|
final Paint mWifiRunningPaint = new Paint();
|
||||||
final Paint mCpuRunningPaint = new Paint();
|
final Paint mCpuRunningPaint = new Paint();
|
||||||
final Paint mDateLinePaint = new Paint();
|
final Paint mDateLinePaint = new Paint();
|
||||||
@@ -147,6 +149,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
final Path mChargingPath = new Path();
|
final Path mChargingPath = new Path();
|
||||||
final Path mScreenOnPath = new Path();
|
final Path mScreenOnPath = new Path();
|
||||||
final Path mGpsOnPath = new Path();
|
final Path mGpsOnPath = new Path();
|
||||||
|
final Path mFlashlightOnPath = new Path();
|
||||||
|
final Path mCameraOnPath = new Path();
|
||||||
final Path mWifiRunningPath = new Path();
|
final Path mWifiRunningPath = new Path();
|
||||||
final Path mCpuRunningPath = new Path();
|
final Path mCpuRunningPath = new Path();
|
||||||
final Path mDateLinePath = new Path();
|
final Path mDateLinePath = new Path();
|
||||||
@@ -164,6 +168,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
String mChargingLabel;
|
String mChargingLabel;
|
||||||
String mScreenOnLabel;
|
String mScreenOnLabel;
|
||||||
String mGpsOnLabel;
|
String mGpsOnLabel;
|
||||||
|
String mCameraOnLabel;
|
||||||
|
String mFlashlightOnLabel;
|
||||||
String mWifiRunningLabel;
|
String mWifiRunningLabel;
|
||||||
String mCpuRunningLabel;
|
String mCpuRunningLabel;
|
||||||
String mPhoneSignalLabel;
|
String mPhoneSignalLabel;
|
||||||
@@ -195,6 +201,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
int mChargingOffset;
|
int mChargingOffset;
|
||||||
int mScreenOnOffset;
|
int mScreenOnOffset;
|
||||||
int mGpsOnOffset;
|
int mGpsOnOffset;
|
||||||
|
int mFlashlightOnOffset;
|
||||||
|
int mCameraOnOffset;
|
||||||
int mWifiRunningOffset;
|
int mWifiRunningOffset;
|
||||||
int mCpuRunningOffset;
|
int mCpuRunningOffset;
|
||||||
int mPhoneSignalOffset;
|
int mPhoneSignalOffset;
|
||||||
@@ -217,6 +225,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
boolean mHaveWifi;
|
boolean mHaveWifi;
|
||||||
boolean mHaveGps;
|
boolean mHaveGps;
|
||||||
boolean mHavePhoneSignal;
|
boolean mHavePhoneSignal;
|
||||||
|
boolean mHaveCamera;
|
||||||
|
boolean mHaveFlashlight;
|
||||||
|
|
||||||
final ArrayList<TimeLabel> mTimeLabels = new ArrayList<TimeLabel>();
|
final ArrayList<TimeLabel> mTimeLabels = new ArrayList<TimeLabel>();
|
||||||
final ArrayList<DateLabel> mDateLabels = new ArrayList<DateLabel>();
|
final ArrayList<DateLabel> mDateLabels = new ArrayList<DateLabel>();
|
||||||
@@ -367,6 +377,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mChargingPaint.setStyle(Paint.Style.STROKE);
|
mChargingPaint.setStyle(Paint.Style.STROKE);
|
||||||
mScreenOnPaint.setStyle(Paint.Style.STROKE);
|
mScreenOnPaint.setStyle(Paint.Style.STROKE);
|
||||||
mGpsOnPaint.setStyle(Paint.Style.STROKE);
|
mGpsOnPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mCameraOnPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mFlashlightOnPaint.setStyle(Paint.Style.STROKE);
|
||||||
mWifiRunningPaint.setStyle(Paint.Style.STROKE);
|
mWifiRunningPaint.setStyle(Paint.Style.STROKE);
|
||||||
mCpuRunningPaint.setStyle(Paint.Style.STROKE);
|
mCpuRunningPaint.setStyle(Paint.Style.STROKE);
|
||||||
mPhoneSignalChart.setColors(com.android.settings.Utils.BADNESS_COLORS);
|
mPhoneSignalChart.setColors(com.android.settings.Utils.BADNESS_COLORS);
|
||||||
@@ -374,6 +386,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mDebugRectPaint.setStyle(Paint.Style.STROKE);
|
mDebugRectPaint.setStyle(Paint.Style.STROKE);
|
||||||
mScreenOnPaint.setColor(0xFF009688);
|
mScreenOnPaint.setColor(0xFF009688);
|
||||||
mGpsOnPaint.setColor(0xFF009688);
|
mGpsOnPaint.setColor(0xFF009688);
|
||||||
|
mCameraOnPaint.setColor(0xFF009688);
|
||||||
|
mFlashlightOnPaint.setColor(0xFF009688);
|
||||||
mWifiRunningPaint.setColor(0xFF009688);
|
mWifiRunningPaint.setColor(0xFF009688);
|
||||||
mCpuRunningPaint.setColor(0xFF009688);
|
mCpuRunningPaint.setColor(0xFF009688);
|
||||||
mChargingPaint.setColor(0xFF009688);
|
mChargingPaint.setColor(0xFF009688);
|
||||||
@@ -435,6 +449,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mBatteryBackgroundPaint.setColor(a.getInt(attr, 0));
|
mBatteryBackgroundPaint.setColor(a.getInt(attr, 0));
|
||||||
mScreenOnPaint.setColor(a.getInt(attr, 0));
|
mScreenOnPaint.setColor(a.getInt(attr, 0));
|
||||||
mGpsOnPaint.setColor(a.getInt(attr, 0));
|
mGpsOnPaint.setColor(a.getInt(attr, 0));
|
||||||
|
mCameraOnPaint.setColor(a.getInt(attr, 0));
|
||||||
|
mFlashlightOnPaint.setColor(a.getInt(attr, 0));
|
||||||
mWifiRunningPaint.setColor(a.getInt(attr, 0));
|
mWifiRunningPaint.setColor(a.getInt(attr, 0));
|
||||||
mCpuRunningPaint.setColor(a.getInt(attr, 0));
|
mCpuRunningPaint.setColor(a.getInt(attr, 0));
|
||||||
mChargingPaint.setColor(a.getInt(attr, 0));
|
mChargingPaint.setColor(a.getInt(attr, 0));
|
||||||
@@ -485,6 +501,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mChargingLabel = getContext().getString(R.string.battery_stats_charging_label);
|
mChargingLabel = getContext().getString(R.string.battery_stats_charging_label);
|
||||||
mScreenOnLabel = getContext().getString(R.string.battery_stats_screen_on_label);
|
mScreenOnLabel = getContext().getString(R.string.battery_stats_screen_on_label);
|
||||||
mGpsOnLabel = getContext().getString(R.string.battery_stats_gps_on_label);
|
mGpsOnLabel = getContext().getString(R.string.battery_stats_gps_on_label);
|
||||||
|
mCameraOnLabel = getContext().getString(R.string.battery_stats_camera_on_label);
|
||||||
|
mFlashlightOnLabel = getContext().getString(R.string.battery_stats_flashlight_on_label);
|
||||||
mWifiRunningLabel = getContext().getString(R.string.battery_stats_wifi_running_label);
|
mWifiRunningLabel = getContext().getString(R.string.battery_stats_wifi_running_label);
|
||||||
mCpuRunningLabel = getContext().getString(R.string.battery_stats_wake_lock_label);
|
mCpuRunningLabel = getContext().getString(R.string.battery_stats_wake_lock_label);
|
||||||
mPhoneSignalLabel = getContext().getString(R.string.battery_stats_phone_signal_label);
|
mPhoneSignalLabel = getContext().getString(R.string.battery_stats_phone_signal_label);
|
||||||
@@ -599,6 +617,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mEndWallTime = mEndDataWallTime + (remainingTimeUs/1000);
|
mEndWallTime = mEndDataWallTime + (remainingTimeUs/1000);
|
||||||
mNumHist = lastInteresting;
|
mNumHist = lastInteresting;
|
||||||
mHaveGps = (aggrStates&HistoryItem.STATE_GPS_ON_FLAG) != 0;
|
mHaveGps = (aggrStates&HistoryItem.STATE_GPS_ON_FLAG) != 0;
|
||||||
|
mHaveFlashlight = (aggrStates2&HistoryItem.STATE2_FLASHLIGHT_FLAG) != 0;
|
||||||
|
mHaveCamera = (aggrStates2&HistoryItem.STATE2_CAMERA_FLAG) != 0;
|
||||||
mHaveWifi = (aggrStates2&HistoryItem.STATE2_WIFI_RUNNING_FLAG) != 0
|
mHaveWifi = (aggrStates2&HistoryItem.STATE2_WIFI_RUNNING_FLAG) != 0
|
||||||
|| (aggrStates&(HistoryItem.STATE_WIFI_FULL_LOCK_FLAG
|
|| (aggrStates&(HistoryItem.STATE_WIFI_FULL_LOCK_FLAG
|
||||||
|HistoryItem.STATE_WIFI_MULTICAST_ON_FLAG
|
|HistoryItem.STATE_WIFI_MULTICAST_ON_FLAG
|
||||||
@@ -628,7 +648,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
|
|
||||||
void finishPaths(int w, int h, int levelh, int startX, int y, Path curLevelPath,
|
void finishPaths(int w, int h, int levelh, int startX, int y, Path curLevelPath,
|
||||||
int lastX, boolean lastCharging, boolean lastScreenOn, boolean lastGpsOn,
|
int lastX, boolean lastCharging, boolean lastScreenOn, boolean lastGpsOn,
|
||||||
boolean lastWifiRunning, boolean lastCpuRunning, Path lastPath) {
|
boolean lastFlashlightOn, boolean lastCameraOn, boolean lastWifiRunning,
|
||||||
|
boolean lastCpuRunning, Path lastPath) {
|
||||||
if (curLevelPath != null) {
|
if (curLevelPath != null) {
|
||||||
if (lastX >= 0 && lastX < w) {
|
if (lastX >= 0 && lastX < w) {
|
||||||
if (lastPath != null) {
|
if (lastPath != null) {
|
||||||
@@ -650,6 +671,12 @@ public class BatteryHistoryChart extends View {
|
|||||||
if (lastGpsOn) {
|
if (lastGpsOn) {
|
||||||
mGpsOnPath.lineTo(w, h-mGpsOnOffset);
|
mGpsOnPath.lineTo(w, h-mGpsOnOffset);
|
||||||
}
|
}
|
||||||
|
if (lastFlashlightOn) {
|
||||||
|
mFlashlightOnPath.lineTo(w, h-mFlashlightOnOffset);
|
||||||
|
}
|
||||||
|
if (lastCameraOn) {
|
||||||
|
mCameraOnPath.lineTo(w, h-mCameraOnOffset);
|
||||||
|
}
|
||||||
if (lastWifiRunning) {
|
if (lastWifiRunning) {
|
||||||
mWifiRunningPath.lineTo(w, h-mWifiRunningOffset);
|
mWifiRunningPath.lineTo(w, h-mWifiRunningOffset);
|
||||||
}
|
}
|
||||||
@@ -720,6 +747,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mChargingPaint.setStrokeWidth(mLineWidth);
|
mChargingPaint.setStrokeWidth(mLineWidth);
|
||||||
mScreenOnPaint.setStrokeWidth(mLineWidth);
|
mScreenOnPaint.setStrokeWidth(mLineWidth);
|
||||||
mGpsOnPaint.setStrokeWidth(mLineWidth);
|
mGpsOnPaint.setStrokeWidth(mLineWidth);
|
||||||
|
mCameraOnPaint.setStrokeWidth(mLineWidth);
|
||||||
|
mFlashlightOnPaint.setStrokeWidth(mLineWidth);
|
||||||
mWifiRunningPaint.setStrokeWidth(mLineWidth);
|
mWifiRunningPaint.setStrokeWidth(mLineWidth);
|
||||||
mCpuRunningPaint.setStrokeWidth(mLineWidth);
|
mCpuRunningPaint.setStrokeWidth(mLineWidth);
|
||||||
mDebugRectPaint.setStrokeWidth(1);
|
mDebugRectPaint.setStrokeWidth(1);
|
||||||
@@ -732,15 +761,18 @@ public class BatteryHistoryChart extends View {
|
|||||||
mCpuRunningOffset = mScreenOnOffset + fullBarOffset;
|
mCpuRunningOffset = mScreenOnOffset + fullBarOffset;
|
||||||
mWifiRunningOffset = mCpuRunningOffset + fullBarOffset;
|
mWifiRunningOffset = mCpuRunningOffset + fullBarOffset;
|
||||||
mGpsOnOffset = mWifiRunningOffset + (mHaveWifi ? fullBarOffset : 0);
|
mGpsOnOffset = mWifiRunningOffset + (mHaveWifi ? fullBarOffset : 0);
|
||||||
mPhoneSignalOffset = mGpsOnOffset + (mHaveGps ? fullBarOffset : 0);
|
mFlashlightOnOffset = mGpsOnOffset + (mHaveGps ? fullBarOffset : 0);
|
||||||
|
mCameraOnOffset = mFlashlightOnOffset + (mHaveFlashlight ? fullBarOffset : 0);
|
||||||
|
mPhoneSignalOffset = mCameraOnOffset + (mHaveCamera ? fullBarOffset : 0);
|
||||||
mLevelOffset = mPhoneSignalOffset + (mHavePhoneSignal ? fullBarOffset : 0)
|
mLevelOffset = mPhoneSignalOffset + (mHavePhoneSignal ? fullBarOffset : 0)
|
||||||
+ mLineWidth*2 + mLineWidth/2;
|
+ mLineWidth*2 + mLineWidth/2;
|
||||||
if (mHavePhoneSignal) {
|
if (mHavePhoneSignal) {
|
||||||
mPhoneSignalChart.init(w);
|
mPhoneSignalChart.init(w);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mScreenOnOffset = mGpsOnOffset = mWifiRunningOffset
|
mScreenOnOffset = mGpsOnOffset = mCameraOnOffset = mFlashlightOnOffset =
|
||||||
= mCpuRunningOffset = mChargingOffset = mPhoneSignalOffset = 0;
|
mWifiRunningOffset = mCpuRunningOffset = mChargingOffset =
|
||||||
|
mPhoneSignalOffset = 0;
|
||||||
mLevelOffset = fullBarOffset + mThinLineWidth*4;
|
mLevelOffset = fullBarOffset + mThinLineWidth*4;
|
||||||
if (mHavePhoneSignal) {
|
if (mHavePhoneSignal) {
|
||||||
mPhoneSignalChart.init(0);
|
mPhoneSignalChart.init(0);
|
||||||
@@ -754,6 +786,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mBatCriticalPath.reset();
|
mBatCriticalPath.reset();
|
||||||
mScreenOnPath.reset();
|
mScreenOnPath.reset();
|
||||||
mGpsOnPath.reset();
|
mGpsOnPath.reset();
|
||||||
|
mFlashlightOnPath.reset();
|
||||||
|
mCameraOnPath.reset();
|
||||||
mWifiRunningPath.reset();
|
mWifiRunningPath.reset();
|
||||||
mCpuRunningPath.reset();
|
mCpuRunningPath.reset();
|
||||||
mChargingPath.reset();
|
mChargingPath.reset();
|
||||||
@@ -778,6 +812,7 @@ public class BatteryHistoryChart extends View {
|
|||||||
Path curLevelPath = null;
|
Path curLevelPath = null;
|
||||||
Path lastLinePath = null;
|
Path lastLinePath = null;
|
||||||
boolean lastCharging = false, lastScreenOn = false, lastGpsOn = false;
|
boolean lastCharging = false, lastScreenOn = false, lastGpsOn = false;
|
||||||
|
boolean lastFlashlightOn = false, lastCameraOn = false;
|
||||||
boolean lastWifiRunning = false, lastWifiSupplRunning = false, lastCpuRunning = false;
|
boolean lastWifiRunning = false, lastWifiSupplRunning = false, lastCpuRunning = false;
|
||||||
int lastWifiSupplState = BatteryStats.WIFI_SUPPL_STATE_INVALID;
|
int lastWifiSupplState = BatteryStats.WIFI_SUPPL_STATE_INVALID;
|
||||||
final int N = mNumHist;
|
final int N = mNumHist;
|
||||||
@@ -871,6 +906,28 @@ public class BatteryHistoryChart extends View {
|
|||||||
lastGpsOn = gpsOn;
|
lastGpsOn = gpsOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final boolean flashlightOn =
|
||||||
|
(rec.states2&HistoryItem.STATE2_FLASHLIGHT_FLAG) != 0;
|
||||||
|
if (flashlightOn != lastFlashlightOn) {
|
||||||
|
if (flashlightOn) {
|
||||||
|
mFlashlightOnPath.moveTo(x, h-mFlashlightOnOffset);
|
||||||
|
} else {
|
||||||
|
mFlashlightOnPath.lineTo(x, h-mFlashlightOnOffset);
|
||||||
|
}
|
||||||
|
lastFlashlightOn = flashlightOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean cameraOn =
|
||||||
|
(rec.states2&HistoryItem.STATE2_CAMERA_FLAG) != 0;
|
||||||
|
if (cameraOn != lastCameraOn) {
|
||||||
|
if (cameraOn) {
|
||||||
|
mCameraOnPath.moveTo(x, h-mCameraOnOffset);
|
||||||
|
} else {
|
||||||
|
mCameraOnPath.lineTo(x, h-mCameraOnOffset);
|
||||||
|
}
|
||||||
|
lastCameraOn = cameraOn;
|
||||||
|
}
|
||||||
|
|
||||||
final int wifiSupplState =
|
final int wifiSupplState =
|
||||||
((rec.states2&HistoryItem.STATE2_WIFI_SUPPL_STATE_MASK)
|
((rec.states2&HistoryItem.STATE2_WIFI_SUPPL_STATE_MASK)
|
||||||
>> HistoryItem.STATE2_WIFI_SUPPL_STATE_SHIFT);
|
>> HistoryItem.STATE2_WIFI_SUPPL_STATE_SHIFT);
|
||||||
@@ -952,12 +1009,13 @@ public class BatteryHistoryChart extends View {
|
|||||||
|| Math.abs(lastWalltime-curWalltime) > (60*60*1000))) {
|
|| Math.abs(lastWalltime-curWalltime) > (60*60*1000))) {
|
||||||
if (curLevelPath != null) {
|
if (curLevelPath != null) {
|
||||||
finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
|
finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
|
||||||
lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
|
lastCharging, lastScreenOn, lastGpsOn, lastFlashlightOn,
|
||||||
lastCpuRunning, lastLinePath);
|
lastCameraOn, lastWifiRunning, lastCpuRunning, lastLinePath);
|
||||||
lastX = lastY = -1;
|
lastX = lastY = -1;
|
||||||
curLevelPath = null;
|
curLevelPath = null;
|
||||||
lastLinePath = null;
|
lastLinePath = null;
|
||||||
lastCharging = lastScreenOn = lastGpsOn = lastCpuRunning = false;
|
lastCharging = lastScreenOn = lastGpsOn = lastFlashlightOn =
|
||||||
|
lastCameraOn = lastCpuRunning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -992,8 +1050,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
finishPaths(x, h, levelh, startX, lastY, curLevelPath, lastX,
|
finishPaths(x, h, levelh, startX, lastY, curLevelPath, lastX,
|
||||||
lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
|
lastCharging, lastScreenOn, lastGpsOn, lastFlashlightOn, lastCameraOn,
|
||||||
lastCpuRunning, lastLinePath);
|
lastWifiRunning, lastCpuRunning, lastLinePath);
|
||||||
|
|
||||||
if (x < w) {
|
if (x < w) {
|
||||||
// If we reserved room for the remaining time, create a final path to draw
|
// If we reserved room for the remaining time, create a final path to draw
|
||||||
@@ -1237,6 +1295,18 @@ public class BatteryHistoryChart extends View {
|
|||||||
canvas.drawPath(mGpsOnPath, mGpsOnPaint);
|
canvas.drawPath(mGpsOnPath, mGpsOnPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mHaveFlashlight) {
|
||||||
|
if (!mFlashlightOnPath.isEmpty()) {
|
||||||
|
if (DEBUG) Log.d(TAG, "Drawing flashlight path");
|
||||||
|
canvas.drawPath(mFlashlightOnPath, mFlashlightOnPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mHaveCamera) {
|
||||||
|
if (!mCameraOnPath.isEmpty()) {
|
||||||
|
if (DEBUG) Log.d(TAG, "Drawing camera path");
|
||||||
|
canvas.drawPath(mCameraOnPath, mCameraOnPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mHaveWifi) {
|
if (mHaveWifi) {
|
||||||
if (!mWifiRunningPath.isEmpty()) {
|
if (!mWifiRunningPath.isEmpty()) {
|
||||||
if (DEBUG) Log.d(TAG, "Drawing wifi path");
|
if (DEBUG) Log.d(TAG, "Drawing wifi path");
|
||||||
@@ -1260,6 +1330,14 @@ public class BatteryHistoryChart extends View {
|
|||||||
canvas.drawText(mGpsOnLabel, textStartX,
|
canvas.drawText(mGpsOnLabel, textStartX,
|
||||||
height - mGpsOnOffset - mTextDescent, mTextPaint);
|
height - mGpsOnOffset - mTextDescent, mTextPaint);
|
||||||
}
|
}
|
||||||
|
if (mHaveFlashlight) {
|
||||||
|
canvas.drawText(mFlashlightOnLabel, textStartX,
|
||||||
|
height - mFlashlightOnOffset - mTextDescent, mTextPaint);
|
||||||
|
}
|
||||||
|
if (mHaveCamera) {
|
||||||
|
canvas.drawText(mCameraOnLabel, textStartX,
|
||||||
|
height - mCameraOnOffset - mTextDescent, mTextPaint);
|
||||||
|
}
|
||||||
if (mHaveWifi) {
|
if (mHaveWifi) {
|
||||||
canvas.drawText(mWifiRunningLabel, textStartX,
|
canvas.drawText(mWifiRunningLabel, textStartX,
|
||||||
height - mWifiRunningOffset - mTextDescent, mTextPaint);
|
height - mWifiRunningOffset - mTextDescent, mTextPaint);
|
||||||
|
@@ -80,6 +80,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
|||||||
R.string.battery_desc_users,
|
R.string.battery_desc_users,
|
||||||
R.string.battery_desc_unaccounted,
|
R.string.battery_desc_unaccounted,
|
||||||
R.string.battery_desc_overcounted,
|
R.string.battery_desc_overcounted,
|
||||||
|
R.string.battery_desc_camera,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void startBatteryDetailPage(
|
public static void startBatteryDetailPage(
|
||||||
@@ -126,6 +127,8 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
|||||||
R.string.usage_type_data_wifi_send,
|
R.string.usage_type_data_wifi_send,
|
||||||
R.string.usage_type_audio,
|
R.string.usage_type_audio,
|
||||||
R.string.usage_type_video,
|
R.string.usage_type_video,
|
||||||
|
R.string.usage_type_camera,
|
||||||
|
R.string.usage_type_flashlight,
|
||||||
};
|
};
|
||||||
values = new double[] {
|
values = new double[] {
|
||||||
entry.sipper.cpuTimeMs,
|
entry.sipper.cpuTimeMs,
|
||||||
@@ -139,7 +142,9 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
|||||||
entry.sipper.wifiRxPackets,
|
entry.sipper.wifiRxPackets,
|
||||||
entry.sipper.wifiTxPackets,
|
entry.sipper.wifiTxPackets,
|
||||||
0,
|
0,
|
||||||
0
|
0,
|
||||||
|
entry.sipper.cameraTimeMs,
|
||||||
|
entry.sipper.flashlightTimeMs,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (entry.sipper.drainType == BatterySipper.DrainType.APP) {
|
if (entry.sipper.drainType == BatterySipper.DrainType.APP) {
|
||||||
|
Reference in New Issue
Block a user