From 0bd8a4b29bf92a901855d889c53186383dd2c5e7 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Mon, 14 Mar 2016 16:21:44 -0700 Subject: [PATCH] Copy/Paste on RemoteInputView Also fixes a bug where the remote input view stays focused when the inline settings open. Also prevents sharing from contexts that are not activities, and prevents text processing when the device is not provisioned. Bug: 27633360 Change-Id: I8b6e7f661bd873d88e7e2460d043c2aa5f849516 --- core/java/android/widget/TextView.java | 15 +- packages/SystemUI/res/layout/remote_input.xml | 1 + .../systemui/statusbar/BaseStatusBar.java | 1 + .../statusbar/ExpandableNotificationRow.java | 5 + .../statusbar/NotificationContentView.java | 26 +- .../statusbar/phone/StatusBarWindowView.java | 361 ++++++++++++++++++ .../statusbar/policy/RemoteInputView.java | 28 ++ .../statusbar/stack/LongPressCancelable.java | 28 ++ .../stack/NotificationStackScrollLayout.java | 7 +- 9 files changed, 459 insertions(+), 13 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/stack/LongPressCancelable.java diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index e971f865bf455..97cdac14ef3cd 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -9642,7 +9642,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } boolean canShare() { - return canCopy() && isDeviceProvisioned(); + if (!getContext().canStartActivityForResult() || !isDeviceProvisioned()) { + return false; + } + return canCopy(); } boolean isDeviceProvisioned() { @@ -9665,16 +9668,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } boolean canProcessText() { - if (!getContext().canStartActivityForResult() || getId() == View.NO_ID - || hasPasswordTransformationMethod()) { + if (getId() == View.NO_ID) { return false; } - - if (mText.length() > 0 && hasSelection() && mEditor != null) { - return true; - } - - return false; + return canShare(); } boolean canSelectAllText() { diff --git a/packages/SystemUI/res/layout/remote_input.xml b/packages/SystemUI/res/layout/remote_input.xml index 75195c4ffbcc4..a95489b330139 100644 --- a/packages/SystemUI/res/layout/remote_input.xml +++ b/packages/SystemUI/res/layout/remote_input.xml @@ -43,6 +43,7 @@ android:singleLine="true" android:ellipsize="start" android:inputType="textShortMessage|textAutoCorrect|textCapSentences" + android:textIsSelectable="true" android:imeOptions="actionSend|flagNoExtractUi" />