summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dianne Hackborn <hackbod@google.com> 2010-06-24 12:46:31 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2010-06-24 12:46:31 -0700
commit5eceb79a19f60236e5bec76fabacc0cfe2a212bb (patch)
tree7460e18e2ab020d2cd74a1b4ce43b9a4ecf85f2a
parentd8a86f0724defa231d9f2243f4c604d33eaeda63 (diff)
parent82677b9585968806800abff65c5b1529f509a313 (diff)
am 82677b95: am e57c3a88: Merge "Add APIs for finding heavy-weight apps." into gingerbread
Merge commit '82677b9585968806800abff65c5b1529f509a313' * commit '82677b9585968806800abff65c5b1529f509a313': Add APIs for finding heavy-weight apps.
-rw-r--r--api/current.xml21
-rw-r--r--core/java/android/app/ActivityManager.java17
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java3
3 files changed, 41 insertions, 0 deletions
diff --git a/api/current.xml b/api/current.xml
index c46d7df716e1..3cf3df66a669 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -22584,6 +22584,17 @@
visibility="public"
>
</field>
+<field name="FLAG_HEAVY_WEIGHT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="IMPORTANCE_BACKGROUND"
type="int"
transient="false"
@@ -22694,6 +22705,16 @@
visibility="public"
>
</field>
+<field name="flags"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="importance"
type="int"
transient="false"
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 7f95bf5d4b5b..eb7520f1c151 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -717,9 +717,24 @@ public class ActivityManager {
*/
public int uid;
+ /**
+ * All packages that have been loaded into the process.
+ */
public String pkgList[];
/**
+ * Constant for {@link #flags}: this is a heavy-weight process,
+ * meaning it will not be killed while in the background.
+ */
+ public static final int FLAG_HEAVY_WEIGHT = 1<<0;
+
+ /**
+ * Flags of information. May be any of
+ * {@link #FLAG_HEAVY_WEIGHT}.
+ */
+ public int flags;
+
+ /**
* Constant for {@link #importance}: this process is running the
* foreground UI.
*/
@@ -846,6 +861,7 @@ public class ActivityManager {
dest.writeInt(pid);
dest.writeInt(uid);
dest.writeStringArray(pkgList);
+ dest.writeInt(this.flags);
dest.writeInt(importance);
dest.writeInt(lru);
dest.writeInt(importanceReasonCode);
@@ -858,6 +874,7 @@ public class ActivityManager {
pid = source.readInt();
uid = source.readInt();
pkgList = source.readStringArray();
+ flags = source.readInt();
importance = source.readInt();
lru = source.readInt();
importanceReasonCode = source.readInt();
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d59ecdd4a5bc..b3f49d9d7cfb 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -9814,6 +9814,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
new ActivityManager.RunningAppProcessInfo(app.processName,
app.pid, app.getPackageList());
currApp.uid = app.info.uid;
+ if (mHeavyWeightProcess == app) {
+ currApp.flags |= ActivityManager.RunningAppProcessInfo.FLAG_HEAVY_WEIGHT;
+ }
int adj = app.curAdj;
if (adj >= EMPTY_APP_ADJ) {
currApp.importance = ActivityManager.RunningAppProcessInfo.IMPORTANCE_EMPTY;