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

Commit a25b9f5c authored by mattsziklay's avatar mattsziklay
Browse files

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
parent aab4db2c
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -90,12 +90,14 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
    @Override
    @Override
    @NonNull
    @NonNull
    Rect calculateValidDragArea() {
    Rect calculateValidDragArea() {
        final Context displayContext = mDisplayController.getDisplayContext(mTaskInfo.displayId);
        if (displayContext == null) return new Rect();
        final int leftButtonsWidth = loadDimensionPixelSize(mContext.getResources(),
        final int leftButtonsWidth = loadDimensionPixelSize(mContext.getResources(),
                R.dimen.caption_left_buttons_width);
                R.dimen.caption_left_buttons_width);


        // On a smaller screen, don't require as much empty space on screen, as offscreen
        // On a smaller screen, don't require as much empty space on screen, as offscreen
        // drags will be restricted too much.
        // drags will be restricted too much.
        final int requiredEmptySpaceId = mDisplayController.getDisplayContext(mTaskInfo.displayId)
        final int requiredEmptySpaceId = displayContext
                .getResources().getConfiguration().smallestScreenWidthDp >= 600
                .getResources().getConfiguration().smallestScreenWidthDp >= 600
                ? R.dimen.freeform_required_visible_empty_space_in_header :
                ? R.dimen.freeform_required_visible_empty_space_in_header :
                R.dimen.small_screen_required_visible_empty_space_in_header;
                R.dimen.small_screen_required_visible_empty_space_in_header;