Loading libs/WindowManager/Shell/res/layout/desktop_mode_focused_window_decor.xml→libs/WindowManager/Shell/res/layout/desktop_mode_app_handle.xml +0 −0 File moved. View file libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml→libs/WindowManager/Shell/res/layout/desktop_mode_app_header.xml +0 −0 File moved. View file libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +19 −19 Original line number Diff line number Diff line Loading @@ -69,9 +69,9 @@ import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.shared.DesktopModeStatus; import com.android.wm.shell.windowdecor.extension.TaskInfoKt; import com.android.wm.shell.windowdecor.viewholder.DesktopModeAppControlsWindowDecorationViewHolder; import com.android.wm.shell.windowdecor.viewholder.DesktopModeFocusedWindowDecorationViewHolder; import com.android.wm.shell.windowdecor.viewholder.DesktopModeWindowDecorationViewHolder; import com.android.wm.shell.windowdecor.viewholder.AppHandleViewHolder; import com.android.wm.shell.windowdecor.viewholder.AppHeaderViewHolder; import com.android.wm.shell.windowdecor.viewholder.WindowDecorationViewHolder; import kotlin.Unit; Loading @@ -90,7 +90,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin private final Choreographer mChoreographer; private final SyncTransactionQueue mSyncQueue; private DesktopModeWindowDecorationViewHolder mWindowDecorViewHolder; private WindowDecorationViewHolder mWindowDecorViewHolder; private View.OnClickListener mOnCaptionButtonClickListener; private View.OnTouchListener mOnCaptionTouchListener; private View.OnLongClickListener mOnCaptionLongClickListener; Loading Loading @@ -232,16 +232,16 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin } if (oldRootView != mResult.mRootView) { if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_focused_window_decor) { mWindowDecorViewHolder = new DesktopModeFocusedWindowDecorationViewHolder( if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_handle) { mWindowDecorViewHolder = new AppHandleViewHolder( mResult.mRootView, mOnCaptionTouchListener, mOnCaptionButtonClickListener ); } else if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_controls_window_decor) { == R.layout.desktop_mode_app_header) { loadAppInfoIfNeeded(); mWindowDecorViewHolder = new DesktopModeAppControlsWindowDecorationViewHolder( mWindowDecorViewHolder = new AppHeaderViewHolder( mResult.mRootView, mOnCaptionTouchListener, mOnCaptionButtonClickListener, Loading Loading @@ -331,8 +331,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin boolean shouldSetTaskPositionAndCrop) { final int captionLayoutId = getDesktopModeWindowDecorLayoutId(taskInfo.getWindowingMode()); final boolean isAppHeader = captionLayoutId == R.layout.desktop_mode_app_controls_window_decor; final boolean isAppHandle = captionLayoutId == R.layout.desktop_mode_focused_window_decor; captionLayoutId == R.layout.desktop_mode_app_header; final boolean isAppHandle = captionLayoutId == R.layout.desktop_mode_app_handle; relayoutParams.reset(); relayoutParams.mRunningTaskInfo = taskInfo; relayoutParams.mLayoutResId = captionLayoutId; Loading Loading @@ -405,7 +405,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * resource. Otherwise, return ID_NULL and caption width be set to task width. */ private static int getCaptionWidthId(int layoutResId) { if (layoutResId == R.layout.desktop_mode_focused_window_decor) { if (layoutResId == R.layout.desktop_mode_app_handle) { return R.dimen.desktop_mode_fullscreen_decor_caption_width; } return Resources.ID_NULL; Loading Loading @@ -568,7 +568,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin @Override @NonNull Rect calculateValidDragArea() { final int appTextWidth = ((DesktopModeAppControlsWindowDecorationViewHolder) final int appTextWidth = ((AppHeaderViewHolder) mWindowDecorViewHolder).getAppNameTextWidth(); final int leftButtonsWidth = loadDimensionPixelSize(mContext.getResources(), R.dimen.desktop_mode_app_details_width_minus_text) + appTextWidth; Loading Loading @@ -747,7 +747,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin */ boolean checkTouchEventInFocusedCaptionHandle(MotionEvent ev) { if (isHandleMenuActive() || !(mWindowDecorViewHolder instanceof DesktopModeFocusedWindowDecorationViewHolder)) { instanceof AppHandleViewHolder)) { return false; } Loading Loading @@ -836,8 +836,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin private static int getDesktopModeWindowDecorLayoutId(@WindowingMode int windowingMode) { return windowingMode == WINDOWING_MODE_FREEFORM ? R.layout.desktop_mode_app_controls_window_decor : R.layout.desktop_mode_focused_window_decor; ? R.layout.desktop_mode_app_header : R.layout.desktop_mode_app_handle; } private void updatePositionInParent() { Loading Loading @@ -889,20 +889,20 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin } void setAnimatingTaskResize(boolean animatingTaskResize) { if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_focused_window_decor) return; ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder) if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_handle) return; ((AppHeaderViewHolder) mWindowDecorViewHolder) .setAnimatingTaskResize(animatingTaskResize); } /** Called when there is a {@Link ACTION_HOVER_EXIT} on the maximize window button. */ void onMaximizeWindowHoverExit() { ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder) ((AppHeaderViewHolder) mWindowDecorViewHolder) .onMaximizeWindowHoverExit(); } /** Called when there is a {@Link ACTION_HOVER_ENTER} on the maximize window button. */ void onMaximizeWindowHoverEnter() { ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder) ((AppHeaderViewHolder) mWindowDecorViewHolder) .onMaximizeWindowHoverEnter(); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.java +1 −2 Original line number Diff line number Diff line Loading @@ -218,8 +218,7 @@ class HandleMenu { final int menuX, menuY; final int captionWidth = mTaskInfo.getConfiguration() .windowConfiguration.getBounds().width(); if (mLayoutResId == R.layout.desktop_mode_app_controls_window_decor) { if (mLayoutResId == R.layout.desktop_mode_app_header) { // Align the handle menu to the left of the caption. menuX = mMarginMenuStart; menuY = mMarginMenuTop; Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeFocusedWindowDecorationViewHolder.kt→libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/AppHandleViewHolder.kt +19 −4 Original line number Diff line number Diff line /* * 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. */ package com.android.wm.shell.windowdecor.viewholder import android.animation.ObjectAnimator Loading @@ -12,14 +27,14 @@ import com.android.wm.shell.R import com.android.wm.shell.animation.Interpolators /** * A desktop mode window decoration used when the window is in full "focus" (i.e. fullscreen). It * hosts a simple handle bar from which to initiate a drag motion to enter desktop mode. * A desktop mode window decoration used when the window is in full "focus" (i.e. fullscreen/split). * It hosts a simple handle bar from which to initiate a drag motion to enter desktop mode. */ internal class DesktopModeFocusedWindowDecorationViewHolder( internal class AppHandleViewHolder( rootView: View, onCaptionTouchListener: View.OnTouchListener, onCaptionButtonClickListener: View.OnClickListener ) : DesktopModeWindowDecorationViewHolder(rootView) { ) : WindowDecorationViewHolder(rootView) { companion object { private const val CAPTION_HANDLE_ANIMATION_DURATION: Long = 100 Loading Loading
libs/WindowManager/Shell/res/layout/desktop_mode_focused_window_decor.xml→libs/WindowManager/Shell/res/layout/desktop_mode_app_handle.xml +0 −0 File moved. View file
libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml→libs/WindowManager/Shell/res/layout/desktop_mode_app_header.xml +0 −0 File moved. View file
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +19 −19 Original line number Diff line number Diff line Loading @@ -69,9 +69,9 @@ import com.android.wm.shell.common.DisplayLayout; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.shared.DesktopModeStatus; import com.android.wm.shell.windowdecor.extension.TaskInfoKt; import com.android.wm.shell.windowdecor.viewholder.DesktopModeAppControlsWindowDecorationViewHolder; import com.android.wm.shell.windowdecor.viewholder.DesktopModeFocusedWindowDecorationViewHolder; import com.android.wm.shell.windowdecor.viewholder.DesktopModeWindowDecorationViewHolder; import com.android.wm.shell.windowdecor.viewholder.AppHandleViewHolder; import com.android.wm.shell.windowdecor.viewholder.AppHeaderViewHolder; import com.android.wm.shell.windowdecor.viewholder.WindowDecorationViewHolder; import kotlin.Unit; Loading @@ -90,7 +90,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin private final Choreographer mChoreographer; private final SyncTransactionQueue mSyncQueue; private DesktopModeWindowDecorationViewHolder mWindowDecorViewHolder; private WindowDecorationViewHolder mWindowDecorViewHolder; private View.OnClickListener mOnCaptionButtonClickListener; private View.OnTouchListener mOnCaptionTouchListener; private View.OnLongClickListener mOnCaptionLongClickListener; Loading Loading @@ -232,16 +232,16 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin } if (oldRootView != mResult.mRootView) { if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_focused_window_decor) { mWindowDecorViewHolder = new DesktopModeFocusedWindowDecorationViewHolder( if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_handle) { mWindowDecorViewHolder = new AppHandleViewHolder( mResult.mRootView, mOnCaptionTouchListener, mOnCaptionButtonClickListener ); } else if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_controls_window_decor) { == R.layout.desktop_mode_app_header) { loadAppInfoIfNeeded(); mWindowDecorViewHolder = new DesktopModeAppControlsWindowDecorationViewHolder( mWindowDecorViewHolder = new AppHeaderViewHolder( mResult.mRootView, mOnCaptionTouchListener, mOnCaptionButtonClickListener, Loading Loading @@ -331,8 +331,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin boolean shouldSetTaskPositionAndCrop) { final int captionLayoutId = getDesktopModeWindowDecorLayoutId(taskInfo.getWindowingMode()); final boolean isAppHeader = captionLayoutId == R.layout.desktop_mode_app_controls_window_decor; final boolean isAppHandle = captionLayoutId == R.layout.desktop_mode_focused_window_decor; captionLayoutId == R.layout.desktop_mode_app_header; final boolean isAppHandle = captionLayoutId == R.layout.desktop_mode_app_handle; relayoutParams.reset(); relayoutParams.mRunningTaskInfo = taskInfo; relayoutParams.mLayoutResId = captionLayoutId; Loading Loading @@ -405,7 +405,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * resource. Otherwise, return ID_NULL and caption width be set to task width. */ private static int getCaptionWidthId(int layoutResId) { if (layoutResId == R.layout.desktop_mode_focused_window_decor) { if (layoutResId == R.layout.desktop_mode_app_handle) { return R.dimen.desktop_mode_fullscreen_decor_caption_width; } return Resources.ID_NULL; Loading Loading @@ -568,7 +568,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin @Override @NonNull Rect calculateValidDragArea() { final int appTextWidth = ((DesktopModeAppControlsWindowDecorationViewHolder) final int appTextWidth = ((AppHeaderViewHolder) mWindowDecorViewHolder).getAppNameTextWidth(); final int leftButtonsWidth = loadDimensionPixelSize(mContext.getResources(), R.dimen.desktop_mode_app_details_width_minus_text) + appTextWidth; Loading Loading @@ -747,7 +747,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin */ boolean checkTouchEventInFocusedCaptionHandle(MotionEvent ev) { if (isHandleMenuActive() || !(mWindowDecorViewHolder instanceof DesktopModeFocusedWindowDecorationViewHolder)) { instanceof AppHandleViewHolder)) { return false; } Loading Loading @@ -836,8 +836,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin private static int getDesktopModeWindowDecorLayoutId(@WindowingMode int windowingMode) { return windowingMode == WINDOWING_MODE_FREEFORM ? R.layout.desktop_mode_app_controls_window_decor : R.layout.desktop_mode_focused_window_decor; ? R.layout.desktop_mode_app_header : R.layout.desktop_mode_app_handle; } private void updatePositionInParent() { Loading Loading @@ -889,20 +889,20 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin } void setAnimatingTaskResize(boolean animatingTaskResize) { if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_focused_window_decor) return; ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder) if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_handle) return; ((AppHeaderViewHolder) mWindowDecorViewHolder) .setAnimatingTaskResize(animatingTaskResize); } /** Called when there is a {@Link ACTION_HOVER_EXIT} on the maximize window button. */ void onMaximizeWindowHoverExit() { ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder) ((AppHeaderViewHolder) mWindowDecorViewHolder) .onMaximizeWindowHoverExit(); } /** Called when there is a {@Link ACTION_HOVER_ENTER} on the maximize window button. */ void onMaximizeWindowHoverEnter() { ((DesktopModeAppControlsWindowDecorationViewHolder) mWindowDecorViewHolder) ((AppHeaderViewHolder) mWindowDecorViewHolder) .onMaximizeWindowHoverEnter(); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.java +1 −2 Original line number Diff line number Diff line Loading @@ -218,8 +218,7 @@ class HandleMenu { final int menuX, menuY; final int captionWidth = mTaskInfo.getConfiguration() .windowConfiguration.getBounds().width(); if (mLayoutResId == R.layout.desktop_mode_app_controls_window_decor) { if (mLayoutResId == R.layout.desktop_mode_app_header) { // Align the handle menu to the left of the caption. menuX = mMarginMenuStart; menuY = mMarginMenuTop; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeFocusedWindowDecorationViewHolder.kt→libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/AppHandleViewHolder.kt +19 −4 Original line number Diff line number Diff line /* * 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. */ package com.android.wm.shell.windowdecor.viewholder import android.animation.ObjectAnimator Loading @@ -12,14 +27,14 @@ import com.android.wm.shell.R import com.android.wm.shell.animation.Interpolators /** * A desktop mode window decoration used when the window is in full "focus" (i.e. fullscreen). It * hosts a simple handle bar from which to initiate a drag motion to enter desktop mode. * A desktop mode window decoration used when the window is in full "focus" (i.e. fullscreen/split). * It hosts a simple handle bar from which to initiate a drag motion to enter desktop mode. */ internal class DesktopModeFocusedWindowDecorationViewHolder( internal class AppHandleViewHolder( rootView: View, onCaptionTouchListener: View.OnTouchListener, onCaptionButtonClickListener: View.OnClickListener ) : DesktopModeWindowDecorationViewHolder(rootView) { ) : WindowDecorationViewHolder(rootView) { companion object { private const val CAPTION_HANDLE_ANIMATION_DURATION: Long = 100 Loading