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

Commit cd98fe54 authored by Youkichi Hosoi's avatar Youkichi Hosoi Committed by Android (Google) Code Review
Browse files

Merge changes I1d31def5,I759ee7c9,I94db978e,I9ac37dd8 into main

* changes:
  Toggle fullscreen state of focused task via fullscreen key
  Define new key gesture to toggle fullscreen state of focused task
  DesktopMode: Implement method to toggle fullscreen state of focused task
  Add flag to enable toggling behavior of fullscreen key
parents 04d1ae58 d7097e6a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ public final class KeyGestureEvent {
    public static final int KEY_GESTURE_TYPE_TOGGLE_QUICK_SETTINGS_PANEL = 79;
    public static final int KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK = 80;
    public static final int KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK = 81;
    public static final int KEY_GESTURE_TYPE_TOGGLE_FULLSCREEN = 82;

    public static final int FLAG_CANCELLED = 1 << 0;
    public static final int FLAG_LONG_PRESS = 1 << 1;
@@ -230,6 +231,7 @@ public final class KeyGestureEvent {
            KEY_GESTURE_TYPE_TOGGLE_QUICK_SETTINGS_PANEL,
            KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK,
            KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK,
            KEY_GESTURE_TYPE_TOGGLE_FULLSCREEN,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface KeyGestureType {
@@ -832,6 +834,8 @@ public final class KeyGestureEvent {
                return "KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK";
            case KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK:
                return "KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK";
            case KEY_GESTURE_TYPE_TOGGLE_FULLSCREEN:
                return "KEY_GESTURE_TYPE_TOGGLE_FULLSCREEN";
            default:
                return Integer.toHexString(value);
        }
+3 −0
Original line number Diff line number Diff line
@@ -345,6 +345,9 @@ public enum DesktopExperienceFlags {
    SKIP_DEACTIVATION_OF_DESK_WITH_NOTHING_IN_FRONT(
            Flags::skipDeactivationOfDeskWithNothingInFront, true,
            Flags.FLAG_SKIP_DEACTIVATION_OF_DESK_WITH_NOTHING_IN_FRONT),
    TOGGLE_FULLSCREEN_STATE_VIA_FULLSCREEN_KEY(
            Flags::toggleFullscreenStateViaFullscreenKey, false,
            Flags.FLAG_TOGGLE_FULLSCREEN_STATE_VIA_FULLSCREEN_KEY),
    USE_RESOURCES_FROM_CONTEXT_TO_CREATE_DRAWABLE_ICONS(
            com.android.graphics.flags.Flags::useResourcesFromContextToCreateDrawableIcons,
            true,
+10 −0
Original line number Diff line number Diff line
@@ -1937,4 +1937,14 @@ flag {
    }
}

flag {
    name: "toggle_fullscreen_state_via_fullscreen_key"
    namespace: "lse_desktop_experience"
    description: "Toggles the focused task's fullscreen state when the fullscreen key is pressed."
    bug: "396483171"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

# go/keep-sorted end
+4 −0
Original line number Diff line number Diff line
@@ -70,6 +70,10 @@ public interface DesktopMode {
    /** Called when requested to go to split screen from the current focused desktop app. */
    void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop);

    /** Called when requested to toggle the fullscreen state of the focused app. */
    void toggleFocusedTaskFullscreenState(
            int displayId, DesktopModeTransitionSource transitionSource);

    /**
     * Register a listener that will receive callbacks about desktop-first state. Once it's
     * registered, the listener immediately receives the current state.
+14 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.wm.shell.desktopmode.DesktopModeEventLogger.Companion.Minimiz
import com.android.wm.shell.desktopmode.common.ToggleTaskSizeInteraction
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE
import com.android.wm.shell.shared.annotations.ShellMainThread
import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource
import com.android.wm.shell.shared.desktopmode.DesktopState
import com.android.wm.shell.transition.FocusTransitionObserver
import com.android.wm.shell.windowdecor.DesktopModeWindowDecorViewModel
@@ -66,6 +67,7 @@ class DesktopModeKeyGestureHandler(
                    KeyGestureEvent.KEY_GESTURE_TYPE_SWITCH_TO_PREVIOUS_DESK,
                    KeyGestureEvent.KEY_GESTURE_TYPE_SWITCH_TO_NEXT_DESK,
                    KeyGestureEvent.KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK,
                    KeyGestureEvent.KEY_GESTURE_TYPE_TOGGLE_FULLSCREEN,
                )
            inputManager.registerKeyGestureEventHandler(supportedGestures, this)
        }
@@ -182,6 +184,18 @@ class DesktopModeKeyGestureHandler(
                    desktopModeWindowDecorViewModel.get().closeTask(focusedTask)
                }
            }
            KeyGestureEvent.KEY_GESTURE_TYPE_TOGGLE_FULLSCREEN -> {
                logV("Key gesture TOGGLE_FULLSCREEN is handled")
                mainExecutor.execute {
                    desktopTasksController
                        .get()
                        .toggleFocusedTaskFullscreenState(
                            displayId = focusTransitionObserver.globallyFocusedDisplayId,
                            userId = desktopUserRepositories.current.userId,
                            transitionSource = DesktopModeTransitionSource.KEYBOARD_SHORTCUT,
                        )
                }
            }
        }
    }

Loading