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

Commit f8513c20 authored by Matt Sziklay's avatar Matt Sziklay Committed by Android (Google) Code Review
Browse files

Merge "Do not calculate drag area with no valid display context." into main

parents ddbcdfef a25b9f5c
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;