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

Commit 6f8725ac authored by Adrian Roos's avatar Adrian Roos
Browse files

SoftInputWindow: Remove clamping logic

With current IMEs this has no effect because the DecorView always extends to the full bounds (unlike before Lollipop, where the IME did not extend under the navigation bar by default).

The only effect this had in practice was to throw away the raw coordinates and history, when dispatching touch events from the very bottom of the screen.

Fixes: 265611882
Test: n/a (deletes special casing)
Change-Id: I914c2347f60246d40e0db3a77cbae13b77d88958
parent e1859f9c
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -16,14 +16,12 @@

package android.inputmethodservice;

import static android.inputmethodservice.SoftInputWindowProto.BOUNDS;
import static android.inputmethodservice.SoftInputWindowProto.WINDOW_STATE;

import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.annotation.IntDef;
import android.app.Dialog;
import android.graphics.Rect;
import android.os.Debug;
import android.os.IBinder;
import android.util.Log;
@@ -45,7 +43,6 @@ final class SoftInputWindow extends Dialog {
    private static final String TAG = "SoftInputWindow";

    private final KeyEvent.DispatcherState mDispatcherState;
    private final Rect mBounds = new Rect();
    private final InputMethodService mService;

    @Retention(SOURCE)
@@ -149,22 +146,6 @@ final class SoftInputWindow extends Dialog {
        mDispatcherState.reset();
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        getWindow().getDecorView().getHitRect(mBounds);

        if (ev.isWithinBoundsNoHistory(mBounds.left, mBounds.top,
                mBounds.right - 1, mBounds.bottom - 1)) {
            return super.dispatchTouchEvent(ev);
        } else {
            MotionEvent temp = ev.clampNoHistory(mBounds.left, mBounds.top,
                    mBounds.right - 1, mBounds.bottom - 1);
            boolean handled = super.dispatchTouchEvent(temp);
            temp.recycle();
            return handled;
        }
    }

    @Override
    public void show() {
        switch (mWindowState) {
@@ -273,7 +254,6 @@ final class SoftInputWindow extends Dialog {

    void dumpDebug(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        mBounds.dumpDebug(proto, BOUNDS);
        proto.write(WINDOW_STATE, mWindowState);
        proto.end(token);
    }
+1 −1
Original line number Diff line number Diff line
@@ -27,6 +27,6 @@ message SoftInputWindowProto {
    reserved 2;  // window_type
    reserved 3;  // gravity
    reserved 4;  // takes_focus
    optional .android.graphics.RectProto bounds = 5;
    reserved 5;  // bounds
    optional int32 window_state = 6;
}
 No newline at end of file