Merge "BatteryStatsImpl: Keep less history around for low mem devices."

This commit is contained in:
Narayan Kamath
2017-06-13 11:38:41 +00:00
committed by Android (Google) Code Review

View File

@@ -121,15 +121,34 @@ public class BatteryStatsImpl extends BatteryStats {
private static final int VERSION = 159 + (USE_OLD_HISTORY ? 1000 : 0);
// Maximum number of items we will record in the history.
private static final int MAX_HISTORY_ITEMS = 2000;
private static final int MAX_HISTORY_ITEMS;
// No, really, THIS is the maximum number of items we will record in the history.
private static final int MAX_MAX_HISTORY_ITEMS = 3000;
private static final int MAX_MAX_HISTORY_ITEMS;
// The maximum number of names wakelocks we will keep track of
// per uid; once the limit is reached, we batch the remaining wakelocks
// in to one common name.
private static final int MAX_WAKELOCKS_PER_UID = 100;
private static final int MAX_WAKELOCKS_PER_UID;
static final int MAX_HISTORY_BUFFER; // 256KB
static final int MAX_MAX_HISTORY_BUFFER; // 320KB
static {
if (ActivityManager.isLowRamDeviceStatic()) {
MAX_HISTORY_ITEMS = 800;
MAX_MAX_HISTORY_ITEMS = 1200;
MAX_WAKELOCKS_PER_UID = 40;
MAX_HISTORY_BUFFER = 96*1024; // 96KB
MAX_MAX_HISTORY_BUFFER = 128*1024; // 128KB
} else {
MAX_HISTORY_ITEMS = 2000;
MAX_MAX_HISTORY_ITEMS = 3000;
MAX_WAKELOCKS_PER_UID = 100;
MAX_HISTORY_BUFFER = 256*1024; // 256KB
MAX_MAX_HISTORY_BUFFER = 320*1024; // 256KB
}
}
// Number of transmit power states the Wifi controller can be in.
private static final int NUM_WIFI_TX_LEVELS = 1;
@@ -299,8 +318,6 @@ public class BatteryStatsImpl extends BatteryStats {
boolean mRecordingHistory = false;
int mNumHistoryItems;
static final int MAX_HISTORY_BUFFER = 256*1024; // 256KB
static final int MAX_MAX_HISTORY_BUFFER = 320*1024; // 320KB
final Parcel mHistoryBuffer = Parcel.obtain();
final HistoryItem mHistoryLastWritten = new HistoryItem();
final HistoryItem mHistoryLastLastWritten = new HistoryItem();