From 9ae403298d0cc5dc070ae0098a9669c6f7e399e3 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Tue, 10 Oct 2023 10:50:28 -0700 Subject: [PATCH] Updating launcher settings so that they become split-screen Following this guide: https://developer.android.com/guide/topics/large-screens/activity-embedding#extract_an_activity_from_a_split_to_full_window Bug: 204463748 Test: Open the settings app and open multiple settings, for now only the options inside of the launcher3 package work Flag: ACONFIG com.android.launcher3.Flags.enableTwoPaneLauncherSettings DEVELOPMENT Change-Id: Ie6a9eb3760171da92d94cf06376127b02afff8df --- Android.bp | 1 + AndroidManifest-common.xml | 4 ++++ aconfig/launcher.aconfig | 7 +++++++ res/values/config.xml | 3 +++ res/xml/split_configuration.xml | 18 ++++++++++++++++++ src/com/android/launcher3/Launcher.java | 6 ++++++ 6 files changed, 39 insertions(+) create mode 100644 res/xml/split_configuration.xml diff --git a/Android.bp b/Android.bp index e2dd48dc57..0a5f0b87c8 100644 --- a/Android.bp +++ b/Android.bp @@ -175,6 +175,7 @@ android_library { "androidx.preference_preference", "androidx.slice_slice-view", "androidx.cardview_cardview", + "androidx.window_window", "com.google.android.material_material", "iconloader_base", "view_capture", diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index 7e824ec15c..a31ee80460 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -184,5 +184,9 @@ android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" tools:node="remove" /> + + diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index f34105a146..255550ed90 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -85,6 +85,13 @@ flag { bug: "315055849" } +flag { + name: "enable_two_pane_launcher_settings" + namespace: "launcher" + description: "Enables two panel settings when on large enough displays" + bug: "204463748" +} + flag { name: "enable_shortcut_dont_suggest_app" namespace: "launcher" diff --git a/res/values/config.xml b/res/values/config.xml index 2a8ec2854a..5bdd7ebb36 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -252,6 +252,9 @@ + + 0.5 + 720 diff --git a/res/xml/split_configuration.xml b/res/xml/split_configuration.xml new file mode 100644 index 0000000000..531fef893b --- /dev/null +++ b/res/xml/split_configuration.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 826eeb285d..39b8de161a 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -152,6 +152,7 @@ import androidx.annotation.RequiresApi; import androidx.annotation.StringRes; import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; +import androidx.window.embedding.RuleController; import com.android.launcher3.DropTarget.DragObject; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; @@ -580,6 +581,11 @@ public class Launcher extends StatefulActivity } setTitle(R.string.home_screen); mStartupLatencyLogger.logEnd(LAUNCHER_LATENCY_STARTUP_ACTIVITY_ON_CREATE); + + if (com.android.launcher3.Flags.enableTwoPaneLauncherSettings()) { + RuleController.getInstance(this).setRules( + RuleController.parseRules(this, R.xml.split_configuration)); + } } protected ModelCallbacks createModelCallbacks() {