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

Commit b2fecc4e authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Always use system config insets types for insets frame

When the half-way insets configuration decoupled solution was
introduced, an arg to indicate that the legacy value should be used was
introduced. This is no longer needed as the default value will always be
fully decoupled or coupled. When the default value is fully decoupled,
the method will not be called when calculating orientation, where we
need the legacy value.

Remove the arg is a choice and can reduce the complexity of that method.

Test: Check outStableBounds value
Test: DisplayPolicyInsetsTests
Test: DisplayPolicyTests
Bug: 327313645
Change-Id: Ia7cc14b5ee147fb3fedc70282e4cfb10eba3c92e
parent 89d30ec2
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -8940,8 +8940,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                : mDisplayContent.getDisplayInfo();
        final Task task = getTask();
        task.calculateInsetFrames(mTmpBounds /* outNonDecorBounds */,
                outStableBounds /* outStableBounds */, parentBounds /* bounds */, di,
                true /* useLegacyInsetsForStableBounds */);
                outStableBounds /* outStableBounds */, parentBounds /* bounds */, di);
        final int orientationWithInsets = outStableBounds.height() >= outStableBounds.width()
                ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE;
        // If orientation does not match the orientation with insets applied, then a
+3 −10
Original line number Diff line number Diff line
@@ -2331,8 +2331,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
                // area, i.e. the screen area without the system bars.
                // The non decor inset are areas that could never be removed in Honeycomb. See
                // {@link WindowManagerPolicy#getNonDecorInsetsLw}.
                calculateInsetFrames(mTmpNonDecorBounds, mTmpStableBounds, mTmpFullBounds, di,
                        false /* useLegacyInsetsForStableBounds */);
                calculateInsetFrames(mTmpNonDecorBounds, mTmpStableBounds, mTmpFullBounds, di);
            } else {
                // Apply the given non-decor and stable insets to calculate the corresponding bounds
                // for screen size of configuration.
@@ -2430,11 +2429,9 @@ class TaskFragment extends WindowContainer<WindowContainer> {
     * @param outNonDecorBounds where to place bounds with non-decor insets applied.
     * @param outStableBounds where to place bounds with stable insets applied.
     * @param bounds the bounds to inset.
     * @param useLegacyInsetsForStableBounds {@code true} if we need to use the legacy insets frame
     *                for apps targeting U or before when calculating stable bounds.
     */
    void calculateInsetFrames(Rect outNonDecorBounds, Rect outStableBounds, Rect bounds,
            DisplayInfo displayInfo, boolean useLegacyInsetsForStableBounds) {
            DisplayInfo displayInfo) {
        outNonDecorBounds.set(bounds);
        outStableBounds.set(bounds);
        if (mDisplayContent == null) {
@@ -2446,11 +2443,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        final DisplayPolicy.DecorInsets.Info info = policy.getDecorInsetsInfo(
                displayInfo.rotation, displayInfo.logicalWidth, displayInfo.logicalHeight);
        intersectWithInsetsIfFits(outNonDecorBounds, mTmpBounds, info.mNonDecorInsets);
        if (!useLegacyInsetsForStableBounds) {
        intersectWithInsetsIfFits(outStableBounds, mTmpBounds, info.mConfigInsets);
        } else {
            intersectWithInsetsIfFits(outStableBounds, mTmpBounds, info.mOverrideConfigInsets);
        }
    }

    /**