From f729fb2f621fdca518f81c1b1b57328ec05cf1f9 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Thu, 30 Jun 2022 20:04:40 +0800 Subject: [PATCH] Add ActivityEmbedding Property key Allow apps to define ActivityEmbedding related flags in AndroidManifest using tags, so that the system can read the info before the apps launch. The property is for apps to provide consent to allow the System to override ActivityEmbedding rules for the apps. Bug: 236778622 Test: atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingPropertyTests Change-Id: Ibd5f9ed41b94de0bf9ff2c81a7ffa19d1067b769 --- core/api/current.txt | 1 + core/java/android/view/WindowManager.java | 27 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index bb3264701ca5a..24034e8baa72a 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -51530,6 +51530,7 @@ package android.view { method public default boolean isCrossWindowBlurEnabled(); method public default void removeCrossWindowBlurEnabledListener(@NonNull java.util.function.Consumer); method public void removeViewImmediate(android.view.View); + field public static final String PROPERTY_ACTIVITY_EMBEDDING_ALLOW_SYSTEM_OVERRIDE = "android.window.PROPERTY_ACTIVITY_EMBEDDING_ALLOW_SYSTEM_OVERRIDE"; } public static class WindowManager.BadTokenException extends java.lang.RuntimeException { diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 13ea7af7a623e..b8808eebee8e5 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -819,6 +819,33 @@ public interface WindowManager extends ViewManager { */ public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array"; + /** + * Application level {@link android.content.pm.PackageManager.Property} tag for developers to + * provide consent for their app to allow OEMs to manually provide ActivityEmbedding split + * rule configuration on behalf of the app. + * + *

If {@code true}, the system CAN override the windowing behaviors for the app, such as + * showing some activities side-by-side. In this case, it will report that ActivityEmbedding + * APIs are disabled for the app to avoid conflict. + * + *

If {@code false}, the system MUST NOT override the window behavior for the app. It should + * be used if the app wants to provide their own ActivityEmbedding split rules, or if the app + * wants to opt-out of system overrides for any other reason. + * + *

Default is {@code false}. + * + *

Example usage: + *

+     * <application>
+     *   <property
+     *     android:name="android.window.PROPERTY_ACTIVITY_EMBEDDING_ALLOW_SYSTEM_OVERRIDE"
+     *     android:value="true|false"/>
+     * </application>
+     * 
+ */ + String PROPERTY_ACTIVITY_EMBEDDING_ALLOW_SYSTEM_OVERRIDE = + "android.window.PROPERTY_ACTIVITY_EMBEDDING_ALLOW_SYSTEM_OVERRIDE"; + /** * Request for keyboard shortcuts to be retrieved asynchronously. *