Loading core/java/android/os/BatteryStats.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -277,13 +277,15 @@ public abstract class BatteryStats implements Parcelable { public abstract long getVideoTurnedOnTime(long batteryRealtime, int which); public abstract long getVideoTurnedOnTime(long batteryRealtime, int which); /** /** * Note that these must match the constants in android.os.LocalPowerManager. * Note that these must match the constants in android.os.PowerManager. * Also, if the user activity types change, the BatteryStatsImpl.VERSION must * also be bumped. */ */ static final String[] USER_ACTIVITY_TYPES = { static final String[] USER_ACTIVITY_TYPES = { "other", "cheek", "touch", "long_touch", "touch_up", "button", "unknown" "other", "button", "touch" }; }; public static final int NUM_USER_ACTIVITY_TYPES = 7; public static final int NUM_USER_ACTIVITY_TYPES = 3; public abstract void noteUserActivityLocked(int type); public abstract void noteUserActivityLocked(int type); public abstract boolean hasUserActivity(); public abstract boolean hasUserActivity(); Loading core/java/com/android/internal/os/BatteryStatsImpl.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,7 @@ public final class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version // Current on-disk Parcel version private static final int VERSION = 61 + (USE_OLD_HISTORY ? 1000 : 0); private static final int VERSION = 62 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. // 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 = 2000; Loading Loading @@ -2681,9 +2681,12 @@ public final class BatteryStatsImpl extends BatteryStats { if (mUserActivityCounters == null) { if (mUserActivityCounters == null) { initUserActivityLocked(); initUserActivityLocked(); } } if (type < 0) type = 0; if (type >= 0 && type < NUM_USER_ACTIVITY_TYPES) { else if (type >= NUM_USER_ACTIVITY_TYPES) type = NUM_USER_ACTIVITY_TYPES-1; mUserActivityCounters[type].stepAtomic(); mUserActivityCounters[type].stepAtomic(); } else { Slog.w(TAG, "Unknown user activity type " + type + " was specified.", new Throwable()); } } } @Override @Override Loading Loading
core/java/android/os/BatteryStats.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -277,13 +277,15 @@ public abstract class BatteryStats implements Parcelable { public abstract long getVideoTurnedOnTime(long batteryRealtime, int which); public abstract long getVideoTurnedOnTime(long batteryRealtime, int which); /** /** * Note that these must match the constants in android.os.LocalPowerManager. * Note that these must match the constants in android.os.PowerManager. * Also, if the user activity types change, the BatteryStatsImpl.VERSION must * also be bumped. */ */ static final String[] USER_ACTIVITY_TYPES = { static final String[] USER_ACTIVITY_TYPES = { "other", "cheek", "touch", "long_touch", "touch_up", "button", "unknown" "other", "button", "touch" }; }; public static final int NUM_USER_ACTIVITY_TYPES = 7; public static final int NUM_USER_ACTIVITY_TYPES = 3; public abstract void noteUserActivityLocked(int type); public abstract void noteUserActivityLocked(int type); public abstract boolean hasUserActivity(); public abstract boolean hasUserActivity(); Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,7 @@ public final class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version // Current on-disk Parcel version private static final int VERSION = 61 + (USE_OLD_HISTORY ? 1000 : 0); private static final int VERSION = 62 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. // 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 = 2000; Loading Loading @@ -2681,9 +2681,12 @@ public final class BatteryStatsImpl extends BatteryStats { if (mUserActivityCounters == null) { if (mUserActivityCounters == null) { initUserActivityLocked(); initUserActivityLocked(); } } if (type < 0) type = 0; if (type >= 0 && type < NUM_USER_ACTIVITY_TYPES) { else if (type >= NUM_USER_ACTIVITY_TYPES) type = NUM_USER_ACTIVITY_TYPES-1; mUserActivityCounters[type].stepAtomic(); mUserActivityCounters[type].stepAtomic(); } else { Slog.w(TAG, "Unknown user activity type " + type + " was specified.", new Throwable()); } } } @Override @Override Loading