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

Commit 9c0f8938 authored by Gustav Sennton's avatar Gustav Sennton Committed by Android (Google) Code Review
Browse files

Merge changes Iba1716ed,Ib2bf20c3,I5ba2f8da into main

* changes:
  Add shell/desktopmode to ktfmt directories
  Run ktmft on WindowManager/Shell/s/c/a/wm/shell/desktopmode
  Run ktmft on a subset of files under WindowManager/Shell/s/c/a/wm/shell/desktopmode
parents 0308cc75 52f3a205
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
               tests/
               tools/
bpfmt = -d
ktfmt = --kotlinlang-style --include-dirs=services/permission,packages/SystemUI,libs/WindowManager/Shell/src/com/android/wm/shell/freeform,libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/education
ktfmt = --kotlinlang-style --include-dirs=services/permission,packages/SystemUI,libs/WindowManager/Shell/src/com/android/wm/shell/freeform,libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode

[Hook Scripts]
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
+2 −2
Original line number Diff line number Diff line
@@ -106,13 +106,13 @@ constructor(
                // Scale the end bounds of the window down with an anchor in the center
                inset(
                    (startBounds.width().toFloat() * (1 - CLOSE_ANIM_SCALE) / 2).toInt(),
                    (startBounds.height().toFloat() * (1 - CLOSE_ANIM_SCALE) / 2).toInt()
                    (startBounds.height().toFloat() * (1 - CLOSE_ANIM_SCALE) / 2).toInt(),
                )
                val offsetY =
                    TypedValue.applyDimension(
                            TypedValue.COMPLEX_UNIT_DIP,
                            CLOSE_ANIM_OFFSET_Y,
                            context.resources.displayMetrics
                            context.resources.displayMetrics,
                        )
                        .toInt()
                offset(/* dx= */ 0, offsetY)
+18 −14
Original line number Diff line number Diff line
@@ -49,15 +49,17 @@ class DesktopActivityOrientationChangeHandler(
    }

    private fun onInit() {
        taskStackListener.addListener(object : TaskStackListenerCallback {
        taskStackListener.addListener(
            object : TaskStackListenerCallback {
                override fun onActivityRequestedOrientationChanged(
                    taskId: Int,
                @ScreenOrientation requestedOrientation: Int
                    @ScreenOrientation requestedOrientation: Int,
                ) {
                    // Handle requested screen orientation changes at runtime.
                    handleActivityOrientationChange(taskId, requestedOrientation)
                }
        })
            }
        )
    }

    /**
@@ -77,7 +79,7 @@ class DesktopActivityOrientationChangeHandler(

    private fun handleActivityOrientationChange(
        taskId: Int,
        @ScreenOrientation requestedOrientation: Int
        @ScreenOrientation requestedOrientation: Int,
    ) {
        if (!Flags.respectOrientationChangeForUnresizeable()) return
        val task = shellTaskOrganizer.getRunningTaskInfo(taskId) ?: return
@@ -93,10 +95,12 @@ class DesktopActivityOrientationChangeHandler(
            if (taskWidth > taskHeight) ORIENTATION_LANDSCAPE else ORIENTATION_PORTRAIT

        // Non-resizeable activity requested opposite orientation.
        if (orientation == ORIENTATION_PORTRAIT
                && ActivityInfo.isFixedOrientationLandscape(requestedOrientation)
            || orientation == ORIENTATION_LANDSCAPE
                && ActivityInfo.isFixedOrientationPortrait(requestedOrientation)) {
        if (
            orientation == ORIENTATION_PORTRAIT &&
                ActivityInfo.isFixedOrientationLandscape(requestedOrientation) ||
                orientation == ORIENTATION_LANDSCAPE &&
                    ActivityInfo.isFixedOrientationPortrait(requestedOrientation)
        ) {

            val finalSize = Size(taskHeight, taskWidth)
            // Use the center x as the resizing anchor point.
+2 −3
Original line number Diff line number Diff line
@@ -71,8 +71,7 @@ class DesktopBackNavigationTransitionHandler(
        animations +=
            info.changes
                .filter {
                    it.mode == info.type &&
                            it.taskInfo?.windowingMode == WINDOWING_MODE_FREEFORM
                    it.mode == info.type && it.taskInfo?.windowingMode == WINDOWING_MODE_FREEFORM
                }
                .mapNotNull { createMinimizeAnimation(it, finishTransaction, onAnimFinish) }
        if (animations.isEmpty()) return false
@@ -83,7 +82,7 @@ class DesktopBackNavigationTransitionHandler(
    private fun createMinimizeAnimation(
        change: TransitionInfo.Change,
        finishTransaction: Transaction,
        onAnimFinish: (Animator) -> Unit
        onAnimFinish: (Animator) -> Unit,
    ): Animator? {
        val t = Transaction()
        val sc = change.leash
+12 −6
Original line number Diff line number Diff line
@@ -64,16 +64,22 @@ class DesktopDisplayEventHandler(

    private fun refreshDisplayWindowingMode() {
        // TODO: b/375319538 - Replace the check with a DisplayManager API once it's available.
        val isExtendedDisplayEnabled = 0 != Settings.Global.getInt(
            context.contentResolver, DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, 0
        val isExtendedDisplayEnabled =
            0 !=
                Settings.Global.getInt(
                    context.contentResolver,
                    DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
                    0,
                )
        if (!isExtendedDisplayEnabled) {
            // No action needed in mirror or projected mode.
            return
        }

        val hasNonDefaultDisplay = rootTaskDisplayAreaOrganizer.getDisplayIds()
            .any { displayId -> displayId != DEFAULT_DISPLAY }
        val hasNonDefaultDisplay =
            rootTaskDisplayAreaOrganizer.getDisplayIds().any { displayId ->
                displayId != DEFAULT_DISPLAY
            }
        val targetDisplayWindowingMode =
            if (hasNonDefaultDisplay) {
                WINDOWING_MODE_FREEFORM
Loading