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

Commit 5425193b authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Android (Google) Code Review
Browse files

Merge "Remove getSourceConsumer special case for IME" into main

parents 066cebf8 8f56e5be
Loading
Loading
Loading
Loading
+7 −15
Original line number Diff line number Diff line
@@ -1816,13 +1816,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                cancelAnimation(runner, true /* invokeCallback */);
            }
        }
        if (type == ime()) {
            abortPendingImeControlRequest();
        }
        if (consumer.getType() != ime()) {
        if (type != ime()) {
            // IME consumer should always be there since we need to communicate with
            // InputMethodManager no matter we have the control or not.
            // InputMethodManager no matter if we have the control or not.
            mSourceConsumers.remove(consumer.getId());
        } else {
            abortPendingImeControlRequest();
        }
    }

@@ -1901,20 +1900,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
    }

    @VisibleForTesting
    public @NonNull InsetsSourceConsumer getSourceConsumer(int id, int type) {
    @NonNull
    public final InsetsSourceConsumer getSourceConsumer(int id, @InsetsType int type) {
        InsetsSourceConsumer consumer = mSourceConsumers.get(id);
        if (consumer != null) {
            return consumer;
        }
        // ImeSourceConsumer is created using getSourceConsumer, so it is initially null here.
        if (type == ime() && mImeSourceConsumer != null) {
            // WindowInsets.Type.ime() should be only provided by one source.
            mSourceConsumers.remove(mImeSourceConsumer.getId());
            consumer = mImeSourceConsumer;
            consumer.setId(id);
        } else {
        consumer = mConsumerCreator.apply(this, id, type);
        }
        mSourceConsumers.put(id, consumer);
        return consumer;
    }
+1 −5
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ public class InsetsSourceConsumer {

    protected final InsetsController mController;
    protected final InsetsState mState;
    private int mId;
    private final int mId;
    @InsetsType
    private final int mType;

@@ -235,10 +235,6 @@ public class InsetsSourceConsumer {
        return mId;
    }

    void setId(int id) {
        mId = id;
    }

    @InsetsType int getType() {
        return mType;
    }