diff --git a/api/current.txt b/api/current.txt
index a09a853a4419f..a2c9f7e67ac4c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -885,7 +885,7 @@ package android {
field public static final int permissionFlags = 16843719; // 0x10103c7
field public static final int permissionGroup = 16842762; // 0x101000a
field public static final int permissionGroupFlags = 16843717; // 0x10103c5
- field public static final int persistable = 16843823; // 0x101042f
+ field public static final int persistableMode = 16843823; // 0x101042f
field public static final int persistent = 16842765; // 0x101000d
field public static final int persistentDrawingCache = 16842990; // 0x10100ee
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
@@ -8041,6 +8041,7 @@ package android.content.pm {
field public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; // 0x1
field public static final int DOCUMENT_LAUNCH_NEVER = 3; // 0x3
field public static final int DOCUMENT_LAUNCH_NONE = 0; // 0x0
+ field public static final int DO_NOT_PERSIST = 1; // 0x1
field public static final int FLAG_ALLOW_TASK_REPARENTING = 64; // 0x40
field public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 8; // 0x8
field public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 8192; // 0x2000
@@ -8052,13 +8053,14 @@ package android.content.pm {
field public static final int FLAG_IMMERSIVE = 2048; // 0x800
field public static final int FLAG_MULTIPROCESS = 1; // 0x1
field public static final int FLAG_NO_HISTORY = 128; // 0x80
- field public static final int FLAG_PERSISTABLE = 4096; // 0x1000
field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
field public static final int FLAG_STATE_NOT_NEEDED = 16; // 0x10
field public static final int LAUNCH_MULTIPLE = 0; // 0x0
field public static final int LAUNCH_SINGLE_INSTANCE = 3; // 0x3
field public static final int LAUNCH_SINGLE_TASK = 2; // 0x2
field public static final int LAUNCH_SINGLE_TOP = 1; // 0x1
+ field public static final int PERSIST_ACROSS_REBOOTS = 2; // 0x2
+ field public static final int PERSIST_ROOT_ONLY = 0; // 0x0
field public static final int SCREEN_ORIENTATION_BEHIND = 3; // 0x3
field public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; // 0xa
field public static final int SCREEN_ORIENTATION_FULL_USER = 13; // 0xd
@@ -8083,6 +8085,7 @@ package android.content.pm {
field public int maxRecents;
field public java.lang.String parentActivityName;
field public java.lang.String permission;
+ field public int persistableMode;
field public int screenOrientation;
field public int softInputMode;
field public java.lang.String targetActivity;
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index f6883e2f53394..90615d3649f1f 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -929,7 +929,8 @@ public class Activity extends ContextThemeWrapper
/**
* Same as {@link #onCreate(android.os.Bundle)} but called for those activities created with
- * the attribute {@link android.R.attr#persistable} set true.
+ * the attribute {@link android.R.attr#persistableMode} set to
+ * persistAcrossReboots.
*
* @param savedInstanceState if the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
@@ -1012,8 +1013,9 @@ public class Activity extends ContextThemeWrapper
/**
* This is the same as {@link #onRestoreInstanceState(Bundle)} but is called for activities
- * created with the attribute {@link android.R.attr#persistable}. The {@link
- * android.os.PersistableBundle} passed came from the restored PersistableBundle first
+ * created with the attribute {@link android.R.attr#persistableMode} set to
+ * persistAcrossReboots. The {@link android.os.PersistableBundle} passed
+ * came from the restored PersistableBundle first
* saved in {@link #onSaveInstanceState(Bundle, PersistableBundle)}.
*
*
This method is called between {@link #onStart} and
@@ -1111,7 +1113,8 @@ public class Activity extends ContextThemeWrapper
/**
* This is the same as {@link #onPostCreate(Bundle)} but is called for activities
- * created with the attribute {@link android.R.attr#persistable}.
+ * created with the attribute {@link android.R.attr#persistableMode} set to
+ * Activities that are declared with the persistAcrossReboots attribute will be
+ provided with a PersistableBundle in onSavedInstanceState(), These activities may
+ use this PeristableBundle to save their state. Then, following a reboot, that
+ PersistableBundle will be provided back to the activity in its onCreate() method. -->
+ persistAcrossReboots.
*
* @param savedInstanceState The data most recently supplied in {@link #onSaveInstanceState}
* @param persistentState The data caming from the PersistableBundle first
@@ -1352,10 +1355,10 @@ public class Activity extends ContextThemeWrapper
/**
* This is the same as {@link #onSaveInstanceState} but is called for activities
- * created with the attribute {@link android.R.attr#persistable}. The {@link
- * android.os.PersistableBundle} passed in will be saved and presented in
- * {@link #onCreate(Bundle, PersistableBundle)} the first time that this activity
- * is restarted following the next device reboot.
+ * created with the attribute {@link android.R.attr#persistableMode} set to
+ * persistAcrossReboots. The {@link android.os.PersistableBundle} passed
+ * in will be saved and presented in {@link #onCreate(Bundle, PersistableBundle)}
+ * the first time that this activity is restarted following the next device reboot.
*
* @param outState Bundle in which to place your saved state.
* @param outPersistentState State which will be saved across reboots.
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index ea4604466a6b7..00cdbd08816d2 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -317,7 +317,7 @@ public final class ActivityThread {
}
public boolean isPersistable() {
- return (activityInfo.flags & ActivityInfo.FLAG_PERSISTABLE) != 0;
+ return activityInfo.persistableMode == ActivityInfo.PERSIST_ACROSS_REBOOTS;
}
public String toString() {
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 6e53a6fb59692..3dfa78b4804cd 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -7375,6 +7375,7 @@ public class Intent implements Parcelable, Cloneable {
for (int categoryNdx = mCategories.size() - 1; categoryNdx >= 0; --categoryNdx) {
out.attribute(null, ATTR_CATEGORY, mCategories.valueAt(categoryNdx));
}
+ out.endTag(null, TAG_CATEGORIES);
}
}
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 791e5aa46c7f6..abc8cde2c9ebd 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -103,6 +103,28 @@ public class ActivityInfo extends ComponentInfo
*/
public int documentLaunchMode;
+ /**
+ * Constant corresponding to persistRootOnly in
+ * the {@link android.R.attr#persistableMode} attribute.
+ */
+ public static final int PERSIST_ROOT_ONLY = 0;
+ /**
+ * Constant corresponding to doNotPersist in
+ * the {@link android.R.attr#persistableMode} attribute.
+ */
+ public static final int DO_NOT_PERSIST = 1;
+ /**
+ * Constant corresponding to persistAcrossReboots in
+ * the {@link android.R.attr#persistableMode} attribute.
+ */
+ public static final int PERSIST_ACROSS_REBOOTS = 2;
+ /**
+ * Value indicating how this activity is to be persisted across
+ * reboots for restoring in the Recents list.
+ * {@link android.R.attr#persistableMode}
+ */
+ public int persistableMode;
+
/**
* The maximum number of tasks rooted at this activity that can be in the recent task list.
* Refer to {@link android.R.attr#maxRecents}.
@@ -229,12 +251,6 @@ public class ActivityInfo extends ComponentInfo
* @see android.app.Activity#setImmersive(boolean)
*/
public static final int FLAG_IMMERSIVE = 0x0800;
- /**
- * Bit in {@link #flags} indicating that this activity is to be persisted across
- * reboots for display in the Recents list.
- * {@link android.R.attr#persistable}
- */
- public static final int FLAG_PERSISTABLE = 0x1000;
/**
* Bit in {@link #flags} indicating that tasks started with this activity are to be
* removed from the recent list of tasks when the last activity in the task is finished.
@@ -641,13 +657,23 @@ public class ActivityInfo extends ComponentInfo
return theme != 0 ? theme : applicationInfo.theme;
}
+ private String persistableModeToString() {
+ switch(persistableMode) {
+ case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY";
+ case DO_NOT_PERSIST: return "DO_NOT_PERSIST";
+ case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS";
+ default: return "UNKNOWN=" + persistableMode;
+ }
+ }
+
public void dump(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
if (permission != null) {
pw.println(prefix + "permission=" + permission);
}
pw.println(prefix + "taskAffinity=" + taskAffinity
- + " targetActivity=" + targetActivity);
+ + " targetActivity=" + targetActivity
+ + " persistableMode=" + persistableModeToString());
if (launchMode != 0 || flags != 0 || theme != 0) {
pw.println(prefix + "launchMode=" + launchMode
+ " flags=0x" + Integer.toHexString(flags)
@@ -688,6 +714,7 @@ public class ActivityInfo extends ComponentInfo
dest.writeInt(softInputMode);
dest.writeInt(uiOptions);
dest.writeString(parentActivityName);
+ dest.writeInt(persistableMode);
}
public static final Parcelable.Creator