summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2014-04-03 10:40:43 -0700
committerCraig Mautner <cmautner@google.com>2014-04-03 10:40:43 -0700
commit4cfa8dc77ad0d74b214477ba5be28632fb3ff031 (patch)
treec9abf1052c57d75eaa79588333e883591484fa88 /core
parente3c38a0b0ebefa0a86be944259467c8acc9e5e49 (diff)
downloadframeworks_base-4cfa8dc77ad0d74b214477ba5be28632fb3ff031.zip
frameworks_base-4cfa8dc77ad0d74b214477ba5be28632fb3ff031.tar.gz
frameworks_base-4cfa8dc77ad0d74b214477ba5be28632fb3ff031.tar.bz2
Add the persistable attribute for Activities
This is used for documents to allow them to be persisted across reboots. Fixes bug 13735406. Change-Id: I5655ac99589d58ed5716429cf7a1ffeee677aee1
Diffstat (limited to 'core')
-rw-r--r--core/java/android/content/pm/ActivityInfo.java7
-rw-r--r--core/java/android/content/pm/PackageParser.java6
-rw-r--r--core/res/res/values/attrs_manifest.xml13
-rw-r--r--core/res/res/values/public.xml1
4 files changed, 26 insertions, 1 deletions
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 40275d8..9916476 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -189,6 +189,13 @@ public class ActivityInfo extends ComponentInfo
*/
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}
+ * @hide
+ */
+ public static final int FLAG_PERSISTABLE = 0x1000;
+ /**
* @hide Bit in {@link #flags}: If set, this component will only be seen
* by the primary user. Only works with broadcast receivers. Set from the
* {@link android.R.attr#primaryUserOnly} attribute.
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index a89c507..4b5616f 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -57,7 +57,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.jar.JarEntry;
import java.util.jar.StrictJarFile;
import java.util.zip.ZipEntry;
@@ -2448,6 +2447,11 @@ public class PackageParser {
a.info.flags |= ActivityInfo.FLAG_IMMERSIVE;
}
+ if (sa.getBoolean(
+ com.android.internal.R.styleable.AndroidManifestActivity_persistable, false)) {
+ a.info.flags |= ActivityInfo.FLAG_PERSISTABLE;
+ }
+
if (!receiver) {
if (sa.getBoolean(
com.android.internal.R.styleable.AndroidManifestActivity_hardwareAccelerated,
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 39b8a6b..b14453a 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -866,6 +866,18 @@
<!-- The name of the logical parent of the activity as it appears in the manifest. -->
<attr name="parentActivityName" format="string" />
+ <!-- Define an activity that will persist across reboots. If such an activity is in the
+ Recents list when the device is shut off it will appear in the Recents list when
+ the device is next powered on. To be persisted all activities in the task from the
+ root activity up to the last activity before a <em>break</em> must be declared with
+ the persistable attribute. A <em>break</em> is the first activity after the root
+ started with Intent.FLAG_CLEAR_TASK_WHEN_RESET.
+
+ <p>Activities that are declared with the persistable attribute will be provided with a
+ forced-persistable Bundle in onCreate() and onSavedInstanceState(), and must only
+ be passed a persistable Bundle in their Intent.extras. -->
+ <attr name="persistable" format="boolean" />
+
<!-- The <code>manifest</code> tag is the root of an
<code>AndroidManifest.xml</code> file,
describing the contents of an Android package (.apk) file. One
@@ -1528,6 +1540,7 @@
<!-- @hide This broacast receiver will only receive broadcasts for the
primary user. Can only be used with receivers. -->
<attr name="primaryUserOnly" format="boolean" />
+ <attr name="persistable" />
</declare-styleable>
<!-- The <code>activity-alias</code> tag declares a new
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 8300f38..667adde 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2142,6 +2142,7 @@
<public type="attr" name="colorButtonPressed" />
<public type="attr" name="colorButtonNormalColored" />
<public type="attr" name="colorButtonPressedColored" />
+ <public type="attr" name="persistable" />
<public-padding type="dimen" name="l_resource_pad" end="0x01050010" />