From c6ce56069086601db389db9afad0b204d55a3370 Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Mon, 4 Apr 2022 15:19:46 -0400 Subject: [PATCH] Cast copied text to string before sending share intent EditText#getText returns an Editable (editable buffer), not a string. This is serializable, so it can be put into the intent without error, but trying to retrieve it with intent.getStringExtra(Intent.EXTRA_TEXT) returns null. Casting to a string fixes this problem and allows destination apps to correctly read the copied (and edited) text. Bug: 227107111 Fix: 227107111 Test: verified that sharing to e.g. Chat copies the text into the send box (prior to change it would open the app but copy no text). Change-Id: I3052677ae65556949351e9d112e81d38dc209bc9 --- .../com/android/systemui/clipboardoverlay/EditTextActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/EditTextActivity.java b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/EditTextActivity.java index f710d01540606..0d8987988f0a8 100644 --- a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/EditTextActivity.java +++ b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/EditTextActivity.java @@ -95,7 +95,7 @@ public class EditTextActivity extends Activity private void share() { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); - sendIntent.putExtra(Intent.EXTRA_TEXT, mEditText.getText()); + sendIntent.putExtra(Intent.EXTRA_TEXT, mEditText.getText().toString()); sendIntent.setType("text/plain"); Intent shareIntent = Intent.createChooser(sendIntent, null);