From f56c9f432bafda9765f5ffcb25be5259645e121d Mon Sep 17 00:00:00 2001 From: Ruben Brunk Date: Fri, 22 Apr 2016 18:20:55 -0700 Subject: [PATCH] Add manifest attribute for VR activities. - Allow jank-free VR->VR activity transitions, even during long activity transitions. Bug: 28115931 Change-Id: I1e3fd1a5245bac3433ea6282cb1c7a71f0e0266f --- api/current.txt | 1 + api/system-current.txt | 1 + api/test-current.txt | 1 + core/java/android/content/pm/ActivityInfo.java | 13 +++++++++++++ core/java/android/content/pm/PackageParser.java | 3 +++ core/res/res/values/attrs_manifest.xml | 10 ++++++++++ core/res/res/values/public.xml | 1 + .../java/com/android/server/am/ActivityRecord.java | 4 ++++ 8 files changed, 34 insertions(+) diff --git a/api/current.txt b/api/current.txt index 966967c110f35..1ac015d4d36c3 100644 --- a/api/current.txt +++ b/api/current.txt @@ -514,6 +514,7 @@ package android { field public static final int elevation = 16843840; // 0x1010440 field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 + field public static final int enableVrMode = 16844072; // 0x1010528 field public static final int enabled = 16842766; // 0x101000e field public static final int end = 16843996; // 0x10104dc field public static final int endColor = 16843166; // 0x101019e diff --git a/api/system-current.txt b/api/system-current.txt index aade3e17c4faf..26f8e766b9c7a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -611,6 +611,7 @@ package android { field public static final int elevation = 16843840; // 0x1010440 field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 + field public static final int enableVrMode = 16844072; // 0x1010528 field public static final int enabled = 16842766; // 0x101000e field public static final int end = 16843996; // 0x10104dc field public static final int endColor = 16843166; // 0x101019e diff --git a/api/test-current.txt b/api/test-current.txt index 4548b1b6e3236..a1d637f9f7e31 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -514,6 +514,7 @@ package android { field public static final int elevation = 16843840; // 0x1010440 field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 + field public static final int enableVrMode = 16844072; // 0x1010528 field public static final int enabled = 16842766; // 0x101000e field public static final int end = 16843996; // 0x10104dc field public static final int endColor = 16843166; // 0x101019e diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 0f4cbbba707b1..167befc089dd3 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -190,6 +190,13 @@ public class ActivityInfo extends ComponentInfo */ public int resizeMode; + /** + * Name of the VrListenerService component to run for this activity. + * @see android.R.attr#enableVrMode + * @hide + */ + public String requestedVrComponent; + /** * Bit in {@link #flags} indicating whether this activity is able to * run in multiple processes. If @@ -794,6 +801,7 @@ public class ActivityInfo extends ComponentInfo lockTaskLaunchMode = orig.lockTaskLaunchMode; windowLayout = orig.windowLayout; resizeMode = orig.resizeMode; + requestedVrComponent = orig.requestedVrComponent; } /** @@ -896,6 +904,9 @@ public class ActivityInfo extends ComponentInfo + windowLayout.heightFraction + ", " + windowLayout.gravity); } pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode)); + if (requestedVrComponent != null) { + pw.println(prefix + "requestedVrComponent=" + requestedVrComponent); + } super.dumpBack(pw, prefix, flags); } @@ -939,6 +950,7 @@ public class ActivityInfo extends ComponentInfo dest.writeInt(0); } dest.writeInt(resizeMode); + dest.writeString(requestedVrComponent); } public static final Parcelable.Creator CREATOR @@ -972,6 +984,7 @@ public class ActivityInfo extends ComponentInfo windowLayout = new WindowLayout(source); } resizeMode = source.readInt(); + requestedVrComponent = source.readString(); } /** diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 4108f6dea139b..b8c7659452f86 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -3554,6 +3554,9 @@ public class PackageParser { a.info.encryptionAware = a.info.directBootAware = sa.getBoolean( R.styleable.AndroidManifestActivity_directBootAware, false); + + a.info.requestedVrComponent = + sa.getString(R.styleable.AndroidManifestActivity_enableVrMode); } else { a.info.launchMode = ActivityInfo.LAUNCH_MULTIPLE; a.info.configChanges = 0; diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 5b4364d45c736..b321a3cfec230 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -552,6 +552,15 @@ should not be interrupted with other activities or notifications. --> + + + +