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

Commit a8b27153 authored by Shawn Lin's avatar Shawn Lin
Browse files

The rounded corners from getCurrentMetrics should account for taskbar

Bug: 233218376
Test: call getCurrentMetrics when taskbar is visible/invisible and see
      if the returned rounded corner values are correct.
Change-Id: I655b9b7c8ae1f1e135b3800c3a55cb18c8641325
parent dfc5118d
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ class InsetsPolicy {
            state = originalState;
        }
        state = adjustVisibilityForIme(target, state, state == originalState);
        return adjustInsetsForRoundedCorners(target, state, state == originalState);
        return adjustInsetsForRoundedCorners(target.mToken, state, state == originalState);
    }

    InsetsState adjustInsetsForWindow(WindowState target, InsetsState originalState) {
@@ -290,7 +290,8 @@ class InsetsPolicy {
        final InsetsState originalState = mDisplayContent.getInsetsPolicy()
                .enforceInsetsPolicyForTarget(type, WINDOWING_MODE_FULLSCREEN, alwaysOnTop,
                        mStateController.getRawInsetsState());
        return adjustVisibilityForTransientTypes(originalState);
        InsetsState state = adjustVisibilityForTransientTypes(originalState);
        return adjustInsetsForRoundedCorners(token, state, state == originalState);
    }

    /**
@@ -465,16 +466,20 @@ class InsetsPolicy {
        return originalState;
    }

    private InsetsState adjustInsetsForRoundedCorners(WindowState w, InsetsState originalState,
    private InsetsState adjustInsetsForRoundedCorners(WindowToken token, InsetsState originalState,
            boolean copyState) {
        final Task task = w.getTask();
        if (token != null) {
            final ActivityRecord activityRecord = token.asActivityRecord();
            final Task task = activityRecord != null ? activityRecord.getTask() : null;
            if (task != null && !task.getWindowConfiguration().tasksAreFloating()) {
                // Use task bounds to calculating rounded corners if the task is not floating.
                final Rect roundedCornerFrame = new Rect(task.getBounds());
            final InsetsState state = copyState ? new InsetsState(originalState) : originalState;
                final InsetsState state = copyState ? new InsetsState(originalState)
                        : originalState;
                state.setRoundedCornerFrame(roundedCornerFrame);
                return state;
            }
        }
        return originalState;
    }