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

Commit 5389a177 authored by Adrian Roos's avatar Adrian Roos
Browse files

Fix inline reply clobbering when narrowly missing send button

The RemoteInputView leaked through unhandled touches. To prevent this,
we now make sure the send button covers the entire area, and we catch
any touches that did not go to either the send button or the text box.

Bug: 27357771
Change-Id: Idc08d98dc7970b99c735f80088ea1eec0ec2d831
parent 6ed4e35e
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@
        android:theme="@style/systemui_theme_remote_input"
        android:id="@+id/remote_input"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:paddingEnd="12dp">
        android:layout_width="match_parent">

    <view class="com.android.systemui.statusbar.policy.RemoteInputView$RemoteEditText"
            android:id="@+id/remote_input_text"
@@ -48,19 +47,17 @@

    <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:paddingTop="2dp"
            android:paddingBottom="4dp">
            android:layout_height="match_parent"
            android:layout_gravity="center_vertical">

        <ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:paddingStart="12dp"
                android:paddingEnd="12dp"
                android:paddingTop="12dp"
                android:paddingBottom="12dp"
                android:paddingEnd="24dp"
                android:paddingTop="16dp"
                android:paddingBottom="16dp"
                android:id="@+id/remote_input_send"
                android:src="@drawable/ic_send"
                android:contentDescription="@*android:string/ime_action_send"
@@ -72,6 +69,7 @@
                android:id="@+id/remote_input_progress"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginEnd="6dp"
                android:layout_gravity="center"
                android:visibility="invisible"
                android:indeterminate="true"
+9 −6
Original line number Diff line number Diff line
@@ -105,7 +105,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
                return false;
            }
        });
        mEditText.setOnClickListener(this);
        mEditText.addTextChangedListener(this);
        mEditText.setInnerFocusable(false);
        mEditText.mRemoteInputView = this;
@@ -148,15 +147,19 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene

    @Override
    public void onClick(View v) {
        if (v == mEditText) {
            if (!mEditText.isFocusable()) {
                focus();
            }
        } else if (v == mSendButton) {
        if (v == mSendButton) {
            sendRemoteInput();
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);

        // We never want for a touch to escape to an outer view or one we covered.
        return true;
    }

    public void onDefocus() {
        mController.removeRemoteInput(mEntry);
        mEntry.remoteInputText = mEditText.getText();