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

Commit 594ab1b0 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Automerger Merge Worker
Browse files

Merge "Implement InputConnectionWrapper#takeSnapshot()" into udc-dev am: 45d3fa60

parents f4a947d0 45d3fa60
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -412,4 +412,32 @@ public class InputConnectionWrapper implements InputConnection {
    public boolean setImeConsumesInput(boolean imeConsumesInput) {
        return mTarget.setImeConsumesInput(imeConsumesInput);
    }

    /**
     * Called by the system when it needs to take a snapshot of multiple text-related data in an
     * atomic manner.
     *
     * <p><strong>Editor authors</strong>: Supporting this method is strongly encouraged. Atomically
     * taken {@link TextSnapshot} is going to be really helpful for the system when optimizing IPCs
     * in a safe and deterministic manner.  Return {@code null} if an atomically taken
     * {@link TextSnapshot} is unavailable.  The system continues supporting such a scenario
     * gracefully.</p>
     *
     * <p><strong>IME authors</strong>: Currently IMEs cannot call this method directly and always
     * receive {@code null} as the result.</p>
     *
     * <p>Beware that there is a bug that this method was not overridden in
     * {@link InputConnectionWrapper}, which ended up always returning {@code null} when gets
     * called even if the wrapped {@link InputConnection} implements this method.  The bug was
     * fixed in {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}.</p>
     *
     * @return {@code null} if {@link TextSnapshot} is unavailable and/or this API is called from
     *         IMEs. Beware the bug in older devices mentioned above.
     * @throws NullPointerException if the target is {@code null}.
     */
    @Nullable
    @Override
    public TextSnapshot takeSnapshot() {
        return mTarget.takeSnapshot();
    }
}