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
This commit is contained in:
Sebastian Franco
2023-10-10 10:50:28 -07:00
committed by Sebastián Franco
parent 82bf25b017
commit 9ae403298d
6 changed files with 39 additions and 0 deletions

View File

@@ -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",

View File

@@ -184,5 +184,9 @@
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
<property
android:name="android.window.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED"
android:value="true" />
</application>
</manifest>

View File

@@ -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"

View File

@@ -252,6 +252,9 @@
<!-- Used for custom widgets -->
<array name="custom_widget_providers"/>
<!-- Embed parameters -->
<dimen name="activity_split_ratio" format="float">0.5</dimen>
<integer name="min_width_split">720</integer>
<!-- Skip "Install to private" long-press shortcut packages name -->
<string-array name="skip_private_profile_shortcut_packages" translatable="false">

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:window="http://schemas.android.com/apk/res-auto">
<!-- Automatically split the following activity pairs. -->
<SplitPairRule
window:splitRatio="@dimen/activity_split_ratio"
window:splitLayoutDirection="locale"
window:splitMinWidthDp="@integer/min_width_split"
window:splitMaxAspectRatioInPortrait="alwaysAllow"
window:finishPrimaryWithSecondary="never"
window:finishSecondaryWithPrimary="always"
window:clearTop="false">
<SplitPairFilter
window:primaryActivityName="com.android.launcher3.settings.SettingsActivity"
window:secondaryActivityName="com.android.launcher3.settings.SettingsActivity"/>
</SplitPairRule>
</resources>

View File

@@ -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<LauncherState>
}
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() {