summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm/ServiceInfo.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-04-12 18:16:08 -0700
committerDianne Hackborn <hackbod@google.com>2011-04-12 18:28:06 -0700
commit0c5001d776d56bae02a5cc2663286a125d99bc5e (patch)
treeea7458737297e313c454f18d672e2b997af13990 /core/java/android/content/pm/ServiceInfo.java
parent26b05f7dc35f47bc62bf9630df288ae2d6e4657e (diff)
downloadframeworks_base-0c5001d776d56bae02a5cc2663286a125d99bc5e.zip
frameworks_base-0c5001d776d56bae02a5cc2663286a125d99bc5e.tar.gz
frameworks_base-0c5001d776d56bae02a5cc2663286a125d99bc5e.tar.bz2
Add APIs to remove tasks.
You can remove sub-tasks inside of a task, or an entire task. When removing an entire task, you can have its process killed as well. When the process is killed, any running services will get an onTaskRemoved() callback for them to do cleanup before their process is killed (and the service possibly restarted). Or they can set a new android:stopWithTask attribute to just have the service automatically (cleanly) stopped at this point. Change-Id: I1891bc2da006fa53b99c52f9040f1145650e6808
Diffstat (limited to 'core/java/android/content/pm/ServiceInfo.java')
-rw-r--r--core/java/android/content/pm/ServiceInfo.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/content/pm/ServiceInfo.java b/core/java/android/content/pm/ServiceInfo.java
index 087a4fe..612e345 100644
--- a/core/java/android/content/pm/ServiceInfo.java
+++ b/core/java/android/content/pm/ServiceInfo.java
@@ -33,17 +33,35 @@ public class ServiceInfo extends ComponentInfo
*/
public String permission;
+ /**
+ * Bit in {@link #flags}: If set, the service will automatically be
+ * stopped by the system if the user removes a task that is rooted
+ * in one of the application's activities. Set from the
+ * {@link android.R.attr#stopWithTask} attribute.
+ */
+ public static final int FLAG_STOP_WITH_TASK = 0x0001;
+
+ /**
+ * Options that have been set in the service declaration in the
+ * manifest.
+ * These include:
+ * {@link #FLAG_STOP_WITH_TASK}
+ */
+ public int flags;
+
public ServiceInfo() {
}
public ServiceInfo(ServiceInfo orig) {
super(orig);
permission = orig.permission;
+ flags = orig.flags;
}
public void dump(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
pw.println(prefix + "permission=" + permission);
+ pw.println(prefix + "flags=0x" + Integer.toHexString(flags));
}
public String toString() {
@@ -59,6 +77,7 @@ public class ServiceInfo extends ComponentInfo
public void writeToParcel(Parcel dest, int parcelableFlags) {
super.writeToParcel(dest, parcelableFlags);
dest.writeString(permission);
+ dest.writeInt(flags);
}
public static final Creator<ServiceInfo> CREATOR =
@@ -74,5 +93,6 @@ public class ServiceInfo extends ComponentInfo
private ServiceInfo(Parcel source) {
super(source);
permission = source.readString();
+ flags = source.readInt();
}
}