summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Miranda Kephart <mkephart@google.com> 2023-03-20 16:45:11 -0400
committer Miranda Kephart <mkephart@google.com> 2023-03-20 16:45:11 -0400
commitc32dc80a907ebe33a946b7bb9e56baa3d7778281 (patch)
treecb57fa5a391db684098ff064150f5199f01a0068
parent0f351cb629dc5654954957875868b7e9edb80206 (diff)
Register clipboard toast callback correctly
If something is copied to the clipboard before user setup is complete, we just show a toast instead of the full UI, to prevent the user from being able to access intents they shouldn't be able to. In this case, we have a callback to reset the internal variable when the toast is hidden, but we never actually register the callback. This has very little effect in practice, since a) all of this code is only run if user setup is incomplete (or if the copied data is null, which shouldn't happen) and b) the incorrect state, where we should show the toast and don't, will only occur if we somehow get the second, post-text-classification clipboard update without getting the initial update. That said, this should still be fixed for clarity and correctness. This change registers the callback so that we reset the clipboard toast to null once it's hidden. Bug: 272035606 Test: manual Change-Id: I4bcc3bd85f6242ff4815c21d5a6a7f9d24045cd5
-rw-r--r--packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardToast.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardToast.java b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardToast.java
index 0ed7d2711c62..e9daa462c022 100644
--- a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardToast.java
+++ b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardToast.java
@@ -41,6 +41,7 @@ class ClipboardToast extends Toast.Callback {
}
mCopiedToast = Toast.makeText(mContext,
R.string.clipboard_overlay_text_copied, Toast.LENGTH_SHORT);
+ mCopiedToast.addCallback(this);
mCopiedToast.show();
}