summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-06-11 10:53:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-06-11 10:53:16 -0700
commit9f8cc518e14c7a34bc52da712afbf02d84585f67 (patch)
tree20132f8e7504a7f481fc31c89370bcbbc157c807 /core/java/android
parentf5eafe40cd3f0890dd4ce98a63c8f95b786a3dd9 (diff)
parent32907cfb38bda2d3c052cf5139c5b592678fedbb (diff)
downloadframeworks_base-9f8cc518e14c7a34bc52da712afbf02d84585f67.zip
frameworks_base-9f8cc518e14c7a34bc52da712afbf02d84585f67.tar.gz
frameworks_base-9f8cc518e14c7a34bc52da712afbf02d84585f67.tar.bz2
Merge "Adjust activity manager process OOM adj." into kraken
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityManager.java18
-rw-r--r--core/java/android/os/BatteryStats.java83
2 files changed, 82 insertions, 19 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 793b9d2..7f95bf5 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -726,16 +726,24 @@ public class ActivityManager {
public static final int IMPORTANCE_FOREGROUND = 100;
/**
- * Constant for {@link #importance}: this process is running a
- * heavy-weight application and thus should not be killed.
+ * Constant for {@link #importance}: this process is running something
+ * that is actively visible to the user, though not in the immediate
+ * foreground.
*/
- public static final int IMPORTANCE_HEAVY_WEIGHT = 150;
+ public static final int IMPORTANCE_VISIBLE = 200;
/**
* Constant for {@link #importance}: this process is running something
- * that is considered to be actively visible to the user.
+ * that is considered to be actively perceptible to the user. An
+ * example would be an application performing background music playback.
*/
- public static final int IMPORTANCE_VISIBLE = 200;
+ public static final int IMPORTANCE_PERCEPTIBLE = 130;
+
+ /**
+ * Constant for {@link #importance}: this process is running a
+ * heavy-weight application and thus should not be killed.
+ */
+ public static final int IMPORTANCE_HEAVY_WEIGHT = 170;
/**
* Constant for {@link #importance}: this process is contains services
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index d114bff..4adeaeb 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -51,50 +51,36 @@ public abstract class BatteryStats implements Parcelable {
/**
* A constant indicating a sensor timer.
- *
- * {@hide}
*/
public static final int SENSOR = 3;
/**
* A constant indicating a a wifi turn on timer
- *
- * {@hide}
*/
public static final int WIFI_TURNED_ON = 4;
/**
* A constant indicating a full wifi lock timer
- *
- * {@hide}
*/
public static final int FULL_WIFI_LOCK = 5;
/**
* A constant indicating a scan wifi lock timer
- *
- * {@hide}
*/
public static final int SCAN_WIFI_LOCK = 6;
/**
* A constant indicating a wifi multicast timer
- *
- * {@hide}
*/
public static final int WIFI_MULTICAST_ENABLED = 7;
/**
* A constant indicating an audio turn on timer
- *
- * {@hide}
*/
public static final int AUDIO_TURNED_ON = 7;
/**
* A constant indicating a video turn on timer
- *
- * {@hide}
*/
public static final int VIDEO_TURNED_ON = 8;
@@ -391,6 +377,61 @@ public abstract class BatteryStats implements Parcelable {
}
}
+ public final class BatteryHistoryRecord implements Parcelable {
+ public BatteryHistoryRecord next;
+
+ public long time;
+ public byte batteryLevel;
+
+ public static final int STATE_SCREEN_MASK = 0x000000f;
+ public static final int STATE_SCREEN_SHIFT = 0;
+ public static final int STATE_SIGNAL_STRENGTH_MASK = 0x00000f0;
+ public static final int STATE_SIGNAL_STRENGTH_SHIFT = 4;
+ public static final int STATE_PHONE_STATE_MASK = 0x0000f00;
+ public static final int STATE_PHONE_STATE_SHIFT = 8;
+ public static final int STATE_DATA_CONNECTION_MASK = 0x000f000;
+ public static final int STATE_DATA_CONNECTION_SHIFT = 12;
+
+ public static final int STATE_BATTERY_PLUGGED_FLAG = 1<<30;
+ public static final int STATE_SCREEN_ON_FLAG = 1<<29;
+ public static final int STATE_GPS_ON_FLAG = 1<<28;
+ public static final int STATE_PHONE_ON_FLAG = 1<<27;
+ public static final int STATE_WIFI_ON_FLAG = 1<<26;
+ public static final int STATE_WIFI_RUNNING_FLAG = 1<<25;
+ public static final int STATE_WIFI_FULL_LOCK_FLAG = 1<<24;
+ public static final int STATE_WIFI_SCAN_LOCK_FLAG = 1<<23;
+ public static final int STATE_WIFI_MULTICAST_ON_FLAG = 1<<22;
+ public static final int STATE_BLUETOOTH_ON_FLAG = 1<<21;
+ public static final int STATE_AUDIO_ON_FLAG = 1<<20;
+ public static final int STATE_VIDEO_ON_FLAG = 1<<19;
+
+ public int states;
+
+ public BatteryHistoryRecord() {
+ }
+
+ public BatteryHistoryRecord(long time, Parcel src) {
+ this.time = time;
+ batteryLevel = (byte)src.readInt();
+ states = src.readInt();
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeLong(time);
+ dest.writeInt(batteryLevel);
+ dest.writeInt(states);
+ }
+ }
+
+ /**
+ * Return the current history of battery state changes.
+ */
+ public abstract BatteryHistoryRecord getHistory();
+
/**
* Returns the number of times the device has been started.
*/
@@ -1443,6 +1484,20 @@ public abstract class BatteryStats implements Parcelable {
*/
@SuppressWarnings("unused")
public void dumpLocked(PrintWriter pw) {
+ BatteryHistoryRecord rec = getHistory();
+ if (rec != null) {
+ pw.println("Battery History:");
+ while (rec != null) {
+ pw.print(" ");
+ pw.print(rec.time);
+ pw.print(" ");
+ pw.print(rec.batteryLevel);
+ pw.print(" ");
+ pw.println(Integer.toHexString(rec.states));
+ rec = rec.next;
+ }
+ }
+
pw.println("Total Statistics (Current and Historic):");
pw.println(" System starts: " + getStartCount()
+ ", currently on battery: " + getIsOnBattery());