Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +2 −1 Original line number Diff line number Diff line Loading @@ -548,7 +548,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin mResult.mRootView, mOnCaptionTouchListener, mOnCaptionButtonClickListener, mWindowManagerWrapper mWindowManagerWrapper, mHandler ); } else if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_header) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/AppHandleViewHolder.kt +25 −15 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.res.ColorStateList import android.graphics.Color import android.graphics.Point import android.hardware.input.InputManager import android.os.Handler import android.view.MotionEvent.ACTION_DOWN import android.view.SurfaceControl import android.view.View Loading @@ -44,7 +45,8 @@ internal class AppHandleViewHolder( rootView: View, onCaptionTouchListener: View.OnTouchListener, onCaptionButtonClickListener: OnClickListener, private val windowManagerWrapper: WindowManagerWrapper private val windowManagerWrapper: WindowManagerWrapper, private val handler: Handler ) : WindowDecorationViewHolder(rootView) { companion object { Loading @@ -54,6 +56,7 @@ internal class AppHandleViewHolder( private val captionView: View = rootView.requireViewById(R.id.desktop_mode_caption) private val captionHandle: ImageButton = rootView.requireViewById(R.id.caption_handle) private val inputManager = context.getSystemService(InputManager::class.java) private var statusBarInputLayerExists = false // An invisible View that takes up the same coordinates as captionHandle but is layered // above the status bar. The purpose of this View is to receive input intended for Loading @@ -78,14 +81,18 @@ internal class AppHandleViewHolder( // If handle is not in status bar region(i.e., bottom stage in vertical split), // do not create an input layer if (position.y >= SystemBarUtils.getStatusBarHeight(context)) return if (!isCaptionVisible && hasStatusBarInputLayer() ) { if (!isCaptionVisible && statusBarInputLayerExists) { disposeStatusBarInputLayer() return } if (hasStatusBarInputLayer()) { updateStatusBarInputLayer(position) // Input layer view creation / modification takes a significant amount of time; // post them so we don't hold up DesktopModeWindowDecoration#relayout. if (statusBarInputLayerExists) { handler.post { updateStatusBarInputLayer(position) } } else { createStatusBarInputLayer(position, width, height) // Input layer is created on a delay; prevent multiple from being created. statusBarInputLayerExists = true handler.post { createStatusBarInputLayer(position, width, height) } } } Loading @@ -103,7 +110,8 @@ internal class AppHandleViewHolder( if (!Flags.enableHandleInputFix()) return statusBarInputLayer = AdditionalSystemViewContainer(context, windowManagerWrapper, taskInfo.taskId, handlePosition.x, handlePosition.y, handleWidth, handleHeight, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE ) val view = statusBarInputLayer?.view ?: error("Unable to find statusBarInputLayer View") val lp = statusBarInputLayer?.lp ?: error("Unable to find statusBarInputLayer " + "LayoutParams") Loading @@ -130,12 +138,11 @@ internal class AppHandleViewHolder( } private fun updateStatusBarInputLayer(globalPosition: Point) { statusBarInputLayer?.setPosition(SurfaceControl.Transaction(), globalPosition.x.toFloat(), globalPosition.y.toFloat()) ?: return } private fun hasStatusBarInputLayer(): Boolean { return statusBarInputLayer != null statusBarInputLayer?.setPosition( SurfaceControl.Transaction(), globalPosition.x.toFloat(), globalPosition.y.toFloat() ) ?: return } /** Loading @@ -143,9 +150,12 @@ internal class AppHandleViewHolder( * is not visible. */ fun disposeStatusBarInputLayer() { statusBarInputLayerExists = false handler.post { statusBarInputLayer?.releaseView() statusBarInputLayer = null } } private fun getCaptionHandleBarColor(taskInfo: RunningTaskInfo): Int { return if (shouldUseLightCaptionColors(taskInfo)) { Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java +0 −1 Original line number Diff line number Diff line Loading @@ -839,7 +839,6 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { } private void verifyHandleMenuCreated(@Nullable Uri uri) { verify(mMockHandleMenuFactory).create(any(), any(), anyInt(), any(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean(), eq(uri), anyInt(), anyInt(), anyInt()); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +2 −1 Original line number Diff line number Diff line Loading @@ -548,7 +548,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin mResult.mRootView, mOnCaptionTouchListener, mOnCaptionButtonClickListener, mWindowManagerWrapper mWindowManagerWrapper, mHandler ); } else if (mRelayoutParams.mLayoutResId == R.layout.desktop_mode_app_header) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/AppHandleViewHolder.kt +25 −15 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.res.ColorStateList import android.graphics.Color import android.graphics.Point import android.hardware.input.InputManager import android.os.Handler import android.view.MotionEvent.ACTION_DOWN import android.view.SurfaceControl import android.view.View Loading @@ -44,7 +45,8 @@ internal class AppHandleViewHolder( rootView: View, onCaptionTouchListener: View.OnTouchListener, onCaptionButtonClickListener: OnClickListener, private val windowManagerWrapper: WindowManagerWrapper private val windowManagerWrapper: WindowManagerWrapper, private val handler: Handler ) : WindowDecorationViewHolder(rootView) { companion object { Loading @@ -54,6 +56,7 @@ internal class AppHandleViewHolder( private val captionView: View = rootView.requireViewById(R.id.desktop_mode_caption) private val captionHandle: ImageButton = rootView.requireViewById(R.id.caption_handle) private val inputManager = context.getSystemService(InputManager::class.java) private var statusBarInputLayerExists = false // An invisible View that takes up the same coordinates as captionHandle but is layered // above the status bar. The purpose of this View is to receive input intended for Loading @@ -78,14 +81,18 @@ internal class AppHandleViewHolder( // If handle is not in status bar region(i.e., bottom stage in vertical split), // do not create an input layer if (position.y >= SystemBarUtils.getStatusBarHeight(context)) return if (!isCaptionVisible && hasStatusBarInputLayer() ) { if (!isCaptionVisible && statusBarInputLayerExists) { disposeStatusBarInputLayer() return } if (hasStatusBarInputLayer()) { updateStatusBarInputLayer(position) // Input layer view creation / modification takes a significant amount of time; // post them so we don't hold up DesktopModeWindowDecoration#relayout. if (statusBarInputLayerExists) { handler.post { updateStatusBarInputLayer(position) } } else { createStatusBarInputLayer(position, width, height) // Input layer is created on a delay; prevent multiple from being created. statusBarInputLayerExists = true handler.post { createStatusBarInputLayer(position, width, height) } } } Loading @@ -103,7 +110,8 @@ internal class AppHandleViewHolder( if (!Flags.enableHandleInputFix()) return statusBarInputLayer = AdditionalSystemViewContainer(context, windowManagerWrapper, taskInfo.taskId, handlePosition.x, handlePosition.y, handleWidth, handleHeight, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE ) val view = statusBarInputLayer?.view ?: error("Unable to find statusBarInputLayer View") val lp = statusBarInputLayer?.lp ?: error("Unable to find statusBarInputLayer " + "LayoutParams") Loading @@ -130,12 +138,11 @@ internal class AppHandleViewHolder( } private fun updateStatusBarInputLayer(globalPosition: Point) { statusBarInputLayer?.setPosition(SurfaceControl.Transaction(), globalPosition.x.toFloat(), globalPosition.y.toFloat()) ?: return } private fun hasStatusBarInputLayer(): Boolean { return statusBarInputLayer != null statusBarInputLayer?.setPosition( SurfaceControl.Transaction(), globalPosition.x.toFloat(), globalPosition.y.toFloat() ) ?: return } /** Loading @@ -143,9 +150,12 @@ internal class AppHandleViewHolder( * is not visible. */ fun disposeStatusBarInputLayer() { statusBarInputLayerExists = false handler.post { statusBarInputLayer?.releaseView() statusBarInputLayer = null } } private fun getCaptionHandleBarColor(taskInfo: RunningTaskInfo): Int { return if (shouldUseLightCaptionColors(taskInfo)) { Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java +0 −1 Original line number Diff line number Diff line Loading @@ -839,7 +839,6 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { } private void verifyHandleMenuCreated(@Nullable Uri uri) { verify(mMockHandleMenuFactory).create(any(), any(), anyInt(), any(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean(), eq(uri), anyInt(), anyInt(), anyInt()); Loading