diff --git a/core/api/current.txt b/core/api/current.txt
index abf8112908d64..18d8fc72a40d8 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -1492,6 +1492,7 @@ package android {
field public static final int targetCellWidth = 16844340; // 0x1010634
field public static final int targetClass = 16842799; // 0x101002f
field @Deprecated public static final int targetDescriptions = 16843680; // 0x10103a0
+ field public static final int targetDisplayCategory;
field public static final int targetId = 16843740; // 0x10103dc
field public static final int targetName = 16843853; // 0x101044d
field public static final int targetPackage = 16842785; // 0x1010021
@@ -11138,6 +11139,7 @@ package android.content.pm {
field public int screenOrientation;
field public int softInputMode;
field public String targetActivity;
+ field @Nullable public String targetDisplayCategory;
field public String taskAffinity;
field public int theme;
field public int uiOptions;
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 26c947b5f916d..fda4119aff997 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -220,6 +220,23 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
*/
public String launchToken;
+ /**
+ * Specifies the category of the target display the activity is expected to run on. Set from
+ * the {@link android.R.attr#targetDisplayCategory} attribute. Upon creation, a virtual display
+ * can specify which display categories it supports and one of the category must be present in
+ * the activity's manifest to allow this activity to run. The default value is {@code null},
+ * which indicates the activity does not belong to a restricted display category and thus can
+ * only run on a display that didn't specify any display categories. Each activity can only
+ * specify one category it targets to but a virtual display can support multiple restricted
+ * categories.
+ *
+ * This field should be formatted as a Java-language-style free form string(for example,
+ * com.google.automotive_entertainment), which may contain uppercase or lowercase letters ('A'
+ * through 'Z'), numbers, and underscores ('_') but may only start with letters.
+ */
+ @Nullable
+ public String targetDisplayCategory;
+
/**
* Activity can not be resized and always occupies the fullscreen area with all windows fully
* visible.
@@ -1313,6 +1330,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
mMaxAspectRatio = orig.mMaxAspectRatio;
mMinAspectRatio = orig.mMinAspectRatio;
supportsSizeChanges = orig.supportsSizeChanges;
+ targetDisplayCategory = orig.targetDisplayCategory;
}
/**
@@ -1651,6 +1669,9 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
if (mKnownActivityEmbeddingCerts != null) {
pw.println(prefix + "knownActivityEmbeddingCerts=" + mKnownActivityEmbeddingCerts);
}
+ if (targetDisplayCategory != null) {
+ pw.println(prefix + "targetDisplayCategory=" + targetDisplayCategory);
+ }
super.dumpBack(pw, prefix, dumpFlags);
}
@@ -1697,6 +1718,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
dest.writeFloat(mMinAspectRatio);
dest.writeBoolean(supportsSizeChanges);
sForStringSet.parcel(mKnownActivityEmbeddingCerts, dest, flags);
+ dest.writeString8(targetDisplayCategory);
}
/**
@@ -1822,6 +1844,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
if (mKnownActivityEmbeddingCerts.isEmpty()) {
mKnownActivityEmbeddingCerts = null;
}
+ targetDisplayCategory = source.readString8();
}
/**
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index b5c7ea6bf4c55..eac2b94436319 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -3062,6 +3062,20 @@
+
+
+
+
+
+
+
+
+