summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorChad Brubaker <cbrubaker@google.com>2018-06-25 12:50:01 -0700
committerChad Brubaker <cbrubaker@google.com>2018-08-17 10:56:28 -0700
commita6b2d5caafd4a95c1029f2b16cded734c59ed38a (patch)
tree1dd563b0347c8ce85e425371cdb3198fa6aca874 /core/java/android
parent2c1bf6354bd431e12b97e2cd8054f7615f38bd60 (diff)
Limit clipboard access to the default IME or current focused app.
Test: atest ClipboardManagerTest.java Bug: 6229949 Change-Id: I450ba3d3c2d0f1c4a6a4c24f50539c68ac844c26
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/ClipboardManager.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/content/ClipboardManager.java b/core/java/android/content/ClipboardManager.java
index 3b6c8c148dcb..3fe17840488e 100644
--- a/core/java/android/content/ClipboardManager.java
+++ b/core/java/android/content/ClipboardManager.java
@@ -95,6 +95,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
* Sets the current primary clip on the clipboard. This is the clip that
* is involved in normal cut and paste operations.
*
+ * <em>If the application is not the default IME or does not have input focus this will have
+ * no effect.</em>
+ *
* @param clip The clipped data item to set.
* @see #getPrimaryClip()
* @see #clearPrimaryClip()
@@ -112,6 +115,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
/**
* Clears any current primary clip on the clipboard.
*
+ * <em>If the application is not the default IME or does not have input focus this will have
+ * no effect.</em>
+ *
* @see #setPrimaryClip(ClipData)
*/
public void clearPrimaryClip() {
@@ -125,6 +131,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
/**
* Returns the current primary clip on the clipboard.
*
+ * <em>If the application is not the default IME or does not have input focus this return
+ * {@code null}.</em>
+ *
* @see #setPrimaryClip(ClipData)
*/
public @Nullable ClipData getPrimaryClip() {
@@ -139,6 +148,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
* Returns a description of the current primary clip on the clipboard
* but not a copy of its data.
*
+ * <em>If the application is not the default IME or does not have input focus this return
+ * {@code null}.</em>
+ *
* @see #setPrimaryClip(ClipData)
*/
public @Nullable ClipDescription getPrimaryClipDescription() {
@@ -151,6 +163,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
/**
* Returns true if there is currently a primary clip on the clipboard.
+ *
+ * <em>If the application is not the default IME or the does not have input focus this will
+ * return {@code false}.</em>
*/
public boolean hasPrimaryClip() {
try {