Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0175dcfd authored by mattsziklay's avatar mattsziklay Committed by Matt Sziklay
Browse files

Add "New Window" option to Handle Menu.

Adds the "New Window" option to Handle Menu when the task that opened
Handle Menu supports multi-instance. The button will do the following:

1 - In a fullscreen task, opens the calling task and a new instance in
split screen.
2 - In a split screen task, replaces the non-calling task with a new
instance of the calling task.
3 - In a desktop task, opens a new instance in a desktop window.

Still to implement: Launched freeform apps do not currently respect the
desktop windowing limit. Additionally, we still need a transition
handler to ensure animations match the spec.

Bug: 336289597
Test: Manual, atest desktop tests
Flag: com.android.window.flags.enable_desktop_windowing_multi_instance_features

Change-Id: I5b3bde3e00ebbe014870237108ccbeb658b73d7c
parent 115b4239
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="20dp"
    android:height="20dp"
    android:viewportWidth="20"
    android:viewportHeight="20">
  <path
      android:pathData="M15 16V14H13V12.5H15V10.5H16.5V12.5H18.5V14H16.5V16H15ZM3.5 17C3.09722 17 2.74306 16.8542 2.4375 16.5625C2.14583 16.2569 2 15.9028 2 15.5V4.5C2 4.08333 2.14583 3.72917 2.4375 3.4375C2.74306 3.14583 3.09722 3 3.5 3H14.5C14.9167 3 15.2708 3.14583 15.5625 3.4375C15.8542 3.72917 16 4.08333 16 4.5V9H14.5V7H3.5V15.5H13.625V17H3.5ZM3.5 5.5H14.5V4.5H3.5V5.5ZM3.5 5.5V4.5V5.5Z"
      android:fillColor="#1C1C14"/>
</vector>
+9 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@
    <LinearLayout
        android:id="@+id/more_actions_pill"
        android:layout_width="match_parent"
        android:layout_height="@dimen/desktop_mode_handle_menu_more_actions_pill_height"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/desktop_mode_handle_menu_pill_spacing_margin"
        android:layout_marginStart="1dp"
        android:orientation="vertical"
@@ -139,6 +139,14 @@
            android:drawableStart="@drawable/desktop_mode_ic_handle_menu_screenshot"
            android:drawableTint="?androidprv:attr/materialColorOnSurface"
            style="@style/DesktopModeHandleMenuActionButton"/>

        <Button
            android:id="@+id/new_window_button"
            android:contentDescription="@string/new_window_text"
            android:text="@string/new_window_text"
            android:drawableStart="@drawable/desktop_mode_ic_handle_menu_new_window"
            android:drawableTint="?androidprv:attr/materialColorOnSurface"
            style="@style/DesktopModeHandleMenuActionButton" />
    </LinearLayout>

    <LinearLayout
+6 −3
Original line number Diff line number Diff line
@@ -497,7 +497,7 @@

    <!-- The maximum height of the handle menu in desktop mode. Four pills (52dp each) plus 2dp
        spacing between them plus 4dp top padding. -->
    <dimen name="desktop_mode_handle_menu_height">218dp</dimen>
    <dimen name="desktop_mode_handle_menu_height">270dp</dimen>

    <!-- The elevation set on the handle menu pills. -->
    <dimen name="desktop_mode_handle_menu_pill_elevation">1dp</dimen>
@@ -508,8 +508,11 @@
    <!-- The height of the handle menu's "Windowing" pill in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_windowing_pill_height">52dp</dimen>

    <!-- The height of the handle menu's "More Actions" pill in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_more_actions_pill_height">52dp</dimen>
    <!-- The maximum height of the handle menu's "New Window" button in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_new_window_height">52dp</dimen>

    <!-- The maximum height of the handle menu's "Screenshot" button in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_screenshot_height">52dp</dimen>

    <!-- The height of the handle menu's "Open in browser" pill in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_open_in_browser_pill_height">52dp</dimen>
+2 −0
Original line number Diff line number Diff line
@@ -282,6 +282,8 @@
    <string name="screenshot_text">Screenshot</string>
    <!-- Accessibility text for the handle menu open in browser button [CHAR LIMIT=NONE] -->
    <string name="open_in_browser_text">Open in browser</string>
    <!-- Accessibility text for the handle menu new window button [CHAR LIMIT=NONE] -->
    <string name="new_window_text">New Window</string>
    <!-- Accessibility text for the handle menu close button [CHAR LIMIT=NONE] -->
    <string name="close_text">Close</string>
    <!-- Accessibility text for the handle menu close menu button [CHAR LIMIT=NONE] -->
+1 −3
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.content.pm.LauncherApps
import android.content.pm.PackageManager
import android.os.UserHandle
import android.view.WindowManager.PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.protolog.ProtoLog
import com.android.wm.shell.R
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL
@@ -41,7 +40,6 @@ class MultiInstanceHelper @JvmOverloads constructor(
    /**
     * Returns whether a specific component desires to be launched in multiple instances.
     */
    @VisibleForTesting
    fun supportsMultiInstanceSplit(componentName: ComponentName?): Boolean {
        if (componentName == null || componentName.packageName == null) {
            // TODO(b/262864589): Handle empty component case
@@ -60,7 +58,7 @@ class MultiInstanceHelper @JvmOverloads constructor(

        if (!supportsMultiInstanceProperty) {
            // If not checking the multi-instance properties, then return early
            return false;
            return false
        }

        // Check the activity property first
Loading