Remove text spans from clipboard EditTextActivity display

Casts text from clipboard to a string before displaying it in the
clipboard text editor. Some apps use colored text spans to adjust
the color of text, which is retained in the clipboard. This will
cause us to show text in the wrong color (e.g. black-on-black); in
general we don't expect users to want to retain this metadata, so
just remove it for editing.

Bug: 278826009
Fix: 278826009
Test: manual (visual change)
Change-Id: I792f3116d3e0719874132ccb848262fa7c2d62af
This commit is contained in:
Miranda Kephart
2023-04-20 12:28:49 -04:00
parent 836d8edaf4
commit 40e9950ddd

View File

@@ -72,7 +72,7 @@ public class EditTextActivity extends Activity
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Package not found: " + mClipboardManager.getPrimaryClipSource(), e);
}
mEditText.setText(clip.getItemAt(0).getText());
mEditText.setText(clip.getItemAt(0).getText().toString());
mEditText.requestFocus();
mEditText.setSelection(0);
mSensitive = clip.getDescription().getExtras() != null