summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author mattsziklay <mattsziklay@google.com> 2024-03-26 16:08:44 -0700
committer mattsziklay <mattsziklay@google.com> 2024-03-27 11:20:29 -0700
commita25b9f5cc63e0a50e75449f7b012ef8445bc890e (patch)
treea1cd937ef9d0b4b2befb8125190b6acc5e94fb56
parentaab4db2c4144a4bbaeb84920e7bcca7666137777 (diff)
Do not calculate drag area with no valid display context.
If the search for display context returns null, return an empty Rect for valid drag area; this will be interpretted as no drag restriction. Bug: 328635149 Test: m Change-Id: I8d4face72d758541eb2106582f64143683863a1f
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java
index 9a48922fd238..beead6a19355 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java
@@ -90,12 +90,14 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
@Override
@NonNull
Rect calculateValidDragArea() {
+ final Context displayContext = mDisplayController.getDisplayContext(mTaskInfo.displayId);
+ if (displayContext == null) return new Rect();
final int leftButtonsWidth = loadDimensionPixelSize(mContext.getResources(),
R.dimen.caption_left_buttons_width);
// On a smaller screen, don't require as much empty space on screen, as offscreen
// drags will be restricted too much.
- final int requiredEmptySpaceId = mDisplayController.getDisplayContext(mTaskInfo.displayId)
+ final int requiredEmptySpaceId = displayContext
.getResources().getConfiguration().smallestScreenWidthDp >= 600
? R.dimen.freeform_required_visible_empty_space_in_header :
R.dimen.small_screen_required_visible_empty_space_in_header;