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

Commit 7725b0e9 authored by Evan Rosky's avatar Evan Rosky
Browse files

Use a more-specific heuristic to detect mirrored/virtual inset providers

The previous heuristic was too broad and effected remote control
targets that do control insets (like split-screen).

Bug: 158447971
Bug: 159364385
Test: Open 2 split apps, open/close ime in secondary and observe no
      popping. Open IME in a bubble and see that insets still apply.
      Go through fingerprint setup in SUW and observe no inset pop.
Change-Id: I87f742fbbb2c468090c899d4b3d2a927b809f998
parent b01bd6a5
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -5797,11 +5797,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                Slog.w(TAG, "Failed to deliver showInsets", e);
            }
        }

        @Override
        public boolean isClientControlled() {
            return false;
        }
    }

    /**
+0 −7
Original line number Diff line number Diff line
@@ -62,11 +62,4 @@ interface InsetsControlTarget {
        return false;
    }

    /**
     * Returns {@code true} if the object controlling the insets is on client.
     */
    default boolean isClientControlled() {
        return true;
    }

}
+17 −3
Original line number Diff line number Diff line
@@ -351,14 +351,28 @@ class InsetsSourceProvider {
    }

    private void updateVisibility() {
        final boolean isClientControlled = mControlTarget != null
                && mControlTarget.isClientControlled();
        mSource.setVisible(mServerVisible && (!isClientControlled || mClientVisible));
        mSource.setVisible(mServerVisible && (isMirroredSource() || mClientVisible));
        ProtoLog.d(WM_DEBUG_IME,
                "InsetsSource updateVisibility serverVisible: %s clientVisible: %s",
                mServerVisible, mClientVisible);
    }

    private boolean isMirroredSource() {
        if (mWin == null) {
            return false;
        }
        final int[] provides = mWin.mAttrs.providesInsetsTypes;
        if (provides == null) {
            return false;
        }
        for (int i = 0; i < provides.length; i++) {
            if (provides[i] == ITYPE_IME) {
                return true;
            }
        }
        return false;
    }

    InsetsSourceControl getControl(InsetsControlTarget target) {
        if (target == mControlTarget) {
            if (!mIsLeashReadyForDispatching && mControl != null) {