summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2015-04-01 12:17:18 -0700
committerCraig Mautner <cmautner@google.com>2015-04-15 14:27:56 -0700
commit15df08abd8190353e1430f88c2ed6462d72a5b25 (patch)
treeab7294d951d4bf403a2af98d82f7e4ed7070e539 /core/java/android/content
parent8315167693d033a8857e4d10c2f1df52b15a8b78 (diff)
downloadframeworks_base-15df08abd8190353e1430f88c2ed6462d72a5b25.zip
frameworks_base-15df08abd8190353e1430f88c2ed6462d72a5b25.tar.gz
frameworks_base-15df08abd8190353e1430f88c2ed6462d72a5b25.tar.bz2
Introduce android:lockTaskMode
The ability for tasks to be started in locktask mode or pinned is dependent on the value of android:lockTaskMode for the root activity of the task. For bug 19995702 Change-Id: I514a144a3a0ff7dbdd4987da5361b94bdfe9a437
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/pm/ActivityInfo.java44
-rw-r--r--core/java/android/content/pm/PackageParser.java3
2 files changed, 43 insertions, 4 deletions
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 4723c0d..8d82aa2 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -609,7 +609,7 @@ public class ActivityInfo extends ComponentInfo
* attribute.
*/
public int configChanges;
-
+
/**
* The desired soft input mode for this activity's main window.
* Set from the {@link android.R.attr#windowSoftInputMode} attribute
@@ -648,6 +648,37 @@ public class ActivityInfo extends ComponentInfo
*/
public boolean resizeable;
+ /** @hide */
+ public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0;
+ /** @hide */
+ public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1;
+ /** @hide */
+ public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2;
+ /** @hide */
+ public static final int LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED = 3;
+
+ /** @hide */
+ public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) {
+ switch (lockTaskLaunchMode) {
+ case LOCK_TASK_LAUNCH_MODE_DEFAULT:
+ return "LOCK_TASK_LAUNCH_MODE_DEFAULT";
+ case LOCK_TASK_LAUNCH_MODE_NEVER:
+ return "LOCK_TASK_LAUNCH_MODE_NEVER";
+ case LOCK_TASK_LAUNCH_MODE_ALWAYS:
+ return "LOCK_TASK_LAUNCH_MODE_ALWAYS";
+ case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED:
+ return "LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED";
+ default:
+ return "unknown=" + lockTaskLaunchMode;
+ }
+ }
+ /**
+ * Value indicating if the activity is to be locked at startup. Takes on the values from
+ * {@link android.R.attr#lockTaskMode}.
+ * @hide
+ */
+ public int lockTaskLaunchMode;
+
public ActivityInfo() {
}
@@ -665,13 +696,15 @@ public class ActivityInfo extends ComponentInfo
uiOptions = orig.uiOptions;
parentActivityName = orig.parentActivityName;
maxRecents = orig.maxRecents;
+ resizeable = orig.resizeable;
+ lockTaskLaunchMode = orig.lockTaskLaunchMode;
}
-
+
/**
* Return the theme resource identifier to use for this activity. If
* the activity defines a theme, that is used; else, the application
* theme is used.
- *
+ *
* @return The theme associated with this activity.
*/
public final int getThemeResource() {
@@ -709,7 +742,8 @@ public class ActivityInfo extends ComponentInfo
if (uiOptions != 0) {
pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
}
- pw.println(prefix + "resizeable=" + resizeable);
+ pw.println(prefix + "resizeable=" + resizeable + " lockTaskLaunchMode="
+ + lockTaskLaunchModeToString(lockTaskLaunchMode));
super.dumpBack(pw, prefix);
}
@@ -739,6 +773,7 @@ public class ActivityInfo extends ComponentInfo
dest.writeInt(persistableMode);
dest.writeInt(maxRecents);
dest.writeInt(resizeable ? 1 : 0);
+ dest.writeInt(lockTaskLaunchMode);
}
public static final Parcelable.Creator<ActivityInfo> CREATOR
@@ -767,5 +802,6 @@ public class ActivityInfo extends ComponentInfo
persistableMode = source.readInt();
maxRecents = source.readInt();
resizeable = (source.readInt() == 1);
+ lockTaskLaunchMode = source.readInt();
}
}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 7464cab..40f4e8f 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -3159,6 +3159,9 @@ public class PackageParser {
R.styleable.AndroidManifestActivity_screenOrientation,
ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
+
+ a.info.lockTaskLaunchMode =
+ sa.getInt(R.styleable.AndroidManifestActivity_lockTaskMode, 0);
} else {
a.info.launchMode = ActivityInfo.LAUNCH_MULTIPLE;
a.info.configChanges = 0;