OSDN Git Service

Fix non-unique PendingIntent issue with TCImpl.
authorAbodunrinwa Toki <toki@google.com>
Wed, 18 Apr 2018 20:21:27 +0000 (21:21 +0100)
committerPerumaal Shanmugam <perumaal@google.com>
Thu, 19 Apr 2018 18:23:51 +0000 (18:23 +0000)
commit904a931cfc5f2ffd6fd0c0fb03718abca37b5ee5
treea3aadeef1da8200a86a996102007e47df76fa1a0
parentd41e669fca06ad53e1407a439a1c391fcfb7ab29
Fix non-unique PendingIntent issue with TCImpl.

As per the referenced bug, we're running into issues where apps are
being fired with stale intents. The reason is because we need intents we
fire to be unique by Intent.filterEquals. Some of the intents we
generate put unique data in the intent extra which is not considered by
filterEquals. The solution here is to create PendingIntents with unique
request codes (using classifiedText.hashCode()).
See more info about this in
https://developer.android.com/reference/android/app/PendingIntent.html

Bug: 77930684
Test: manually tested broken scenarios. See referenced bug
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: Ib7275f94ca5ada51e4ba191742d4b614df12e1ea
core/java/android/view/textclassifier/TextClassification.java
core/java/android/view/textclassifier/TextClassifierImpl.java
core/java/android/widget/Editor.java