Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +14 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene private final UiEventLogger mUiEventLogger; private NotificationEntry mEntry; private boolean mRemoved; private boolean mSending; private NotificationViewWrapper mWrapper; // TODO(b/193539698): remove this; views shouldn't have access to their controller, and places Loading Loading @@ -251,6 +252,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene contentView.setBackground(mContentBackground); mEditText = findViewById(R.id.remote_input_text); mEditText.setInnerFocusable(false); // TextView initializes the spell checked when the view is attached to a window. // This causes a couple of IPCs that can jank, especially during animations. // By default the text view should be disabled, to avoid the unnecessary initialization. mEditText.setEnabled(false); mEditText.setWindowInsetsAnimationCallback( new WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) { @NonNull Loading Loading @@ -336,6 +341,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene /** Show the "sending in-progress" UI. */ public void startSending() { mEditText.setEnabled(false); mSending = true; mSendButton.setVisibility(INVISIBLE); mProgressBar.setVisibility(VISIBLE); mEditText.mShowImeOnInputConnection = false; Loading Loading @@ -444,6 +450,12 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene mController.removeSpinning(mEntry.getKey(), mToken); } @Override public void onVisibilityAggregated(boolean isVisible) { super.onVisibilityAggregated(isVisible); mEditText.setEnabled(isVisible && !mSending); } public void setHintText(CharSequence hintText) { mEditText.setHint(hintText); } Loading Loading @@ -508,10 +520,11 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene private void reset() { mResetting = true; mSending = false; mEntry.remoteInputTextWhenReset = SpannedString.valueOf(mEditText.getText()); mEditText.getText().clear(); mEditText.setEnabled(true); mEditText.setEnabled(isAggregatedVisible()); mSendButton.setVisibility(VISIBLE); mProgressBar.setVisibility(INVISIBLE); mController.removeSpinning(mEntry.getKey(), mToken); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.policy; import static android.view.ContentInfo.SOURCE_CLIPBOARD; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; Loading Loading @@ -174,12 +176,15 @@ public class RemoteInputViewTest extends SysuiTestCase { toUser); RemoteInputView view = RemoteInputView.inflate(mContext, null, row.getEntry(), mController); RemoteInputViewController controller = bindController(view, row.getEntry()); EditText editText = view.findViewById(R.id.remote_input_text); setTestPendingIntent(controller); assertThat(editText.isEnabled()).isFalse(); view.onVisibilityAggregated(true); assertThat(editText.isEnabled()).isTrue(); view.focus(); EditText editText = view.findViewById(R.id.remote_input_text); EditorInfo editorInfo = new EditorInfo(); editorInfo.packageName = DUMMY_MESSAGE_APP_PKG; editorInfo.fieldId = editText.getId(); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +14 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene private final UiEventLogger mUiEventLogger; private NotificationEntry mEntry; private boolean mRemoved; private boolean mSending; private NotificationViewWrapper mWrapper; // TODO(b/193539698): remove this; views shouldn't have access to their controller, and places Loading Loading @@ -251,6 +252,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene contentView.setBackground(mContentBackground); mEditText = findViewById(R.id.remote_input_text); mEditText.setInnerFocusable(false); // TextView initializes the spell checked when the view is attached to a window. // This causes a couple of IPCs that can jank, especially during animations. // By default the text view should be disabled, to avoid the unnecessary initialization. mEditText.setEnabled(false); mEditText.setWindowInsetsAnimationCallback( new WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) { @NonNull Loading Loading @@ -336,6 +341,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene /** Show the "sending in-progress" UI. */ public void startSending() { mEditText.setEnabled(false); mSending = true; mSendButton.setVisibility(INVISIBLE); mProgressBar.setVisibility(VISIBLE); mEditText.mShowImeOnInputConnection = false; Loading Loading @@ -444,6 +450,12 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene mController.removeSpinning(mEntry.getKey(), mToken); } @Override public void onVisibilityAggregated(boolean isVisible) { super.onVisibilityAggregated(isVisible); mEditText.setEnabled(isVisible && !mSending); } public void setHintText(CharSequence hintText) { mEditText.setHint(hintText); } Loading Loading @@ -508,10 +520,11 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene private void reset() { mResetting = true; mSending = false; mEntry.remoteInputTextWhenReset = SpannedString.valueOf(mEditText.getText()); mEditText.getText().clear(); mEditText.setEnabled(true); mEditText.setEnabled(isAggregatedVisible()); mSendButton.setVisibility(VISIBLE); mProgressBar.setVisibility(INVISIBLE); mController.removeSpinning(mEntry.getKey(), mToken); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.policy; import static android.view.ContentInfo.SOURCE_CLIPBOARD; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; Loading Loading @@ -174,12 +176,15 @@ public class RemoteInputViewTest extends SysuiTestCase { toUser); RemoteInputView view = RemoteInputView.inflate(mContext, null, row.getEntry(), mController); RemoteInputViewController controller = bindController(view, row.getEntry()); EditText editText = view.findViewById(R.id.remote_input_text); setTestPendingIntent(controller); assertThat(editText.isEnabled()).isFalse(); view.onVisibilityAggregated(true); assertThat(editText.isEnabled()).isTrue(); view.focus(); EditText editText = view.findViewById(R.id.remote_input_text); EditorInfo editorInfo = new EditorInfo(); editorInfo.packageName = DUMMY_MESSAGE_APP_PKG; editorInfo.fieldId = editText.getId(); Loading