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

Commit b84d3bea authored by Felix Stern's avatar Felix Stern
Browse files

Return previous visibility in InsetsSourceConsumer if no leash available only for IME

Previously, we returned the previous visibility in applyLocalVisibilityOverride also for other types than the IME, if no leash was available.
This leads to calling notifyInsetsChanged to early. Therefore, returning it only for the IME.

Test: atest CtsViewTestCases:android.view.cts.TextureViewTest#testGetBitmap_SRGB
Flag: android.view.inputmethod.refactor_insets_controller
Fix: 355043292
Change-Id: Iecdf481305bc4a60596f07abfe88493e6887c495
parent cb197a1d
Loading
Loading
Loading
Loading
+15 −24
Original line number Diff line number Diff line
@@ -310,7 +310,6 @@ public class InsetsSourceConsumer {
        }
        final boolean requestedVisible = (mController.getRequestedVisibleTypes() & mType) != 0;

        if (Flags.refactorInsetsController()) {
        // If we don't have control or the leash (in case of the IME), we enforce the
        // visibility to be hidden, as otherwise we would let the app know too early.
        if (mSourceControl == null) {
@@ -322,9 +321,11 @@ public class InsetsSourceConsumer {
                        WindowInsets.Type.toString(mType), requestedVisible));
            }
            return false;
                // TODO(b/323136120) add a flag to the control, to define whether a leash is needed
            } else if (mId != InsetsSource.ID_IME_CAPTION_BAR
                    && mSourceControl.getLeash() == null) {
        }
        if (Flags.refactorInsetsController()) {
            // TODO(b/323136120) add a flag to the control, to define whether a leash is
            //  needed and make it generic for all types
            if (mId == InsetsSource.ID_IME && mSourceControl.getLeash() == null) {
                if (DEBUG) {
                    Log.d(TAG, TextUtils.formatSimple(
                            "applyLocalVisibilityOverride: Set the source visibility to false, as"
@@ -338,16 +339,6 @@ public class InsetsSourceConsumer {
                // changed state
                return wasVisible;
            }
        } else {
            // If we don't have control, we are not able to change the visibility.
            if (mSourceControl == null) {
                if (DEBUG) {
                    Log.d(TAG, "applyLocalVisibilityOverride: No control in "
                            + mController.getHost().getRootViewTitle()
                            + " requestedVisible=" + requestedVisible);
                }
                return false;
            }
        }
        if (source.isVisible() == requestedVisible) {
            return false;