OSDN Git Service

Refresh TCM settings when they change
authorAbodunrinwa Toki <toki@google.com>
Tue, 1 May 2018 20:36:48 +0000 (21:36 +0100)
committerAbodunrinwa Toki <toki@google.com>
Thu, 17 May 2018 10:29:29 +0000 (11:29 +0100)
commitc2449b8361d8ab382e69244399352948125c9dc8
tree80c873fa276a75f037c2b4b1d6851f407c6b0c89
parent5a36c134b736cc587fcd05b6d5cf94f3bbb62377
Refresh TCM settings when they change

Approach here is to register a content observer that invalidates the
TC settings whenever updates to the settings happen.

This CL also ensures that the TC is invalidated when a settings
update happens. This is because the settings may change what
TC the system returns.

TextView's SelectionActionModeHelper has been updated to not cache
the settings and get them directly from TCM (which caches the settings).

NOTE that we expect TC settings to rarely change.

Bug: 77539576
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: manual - Made changes to TC settings and observed logs / app behaviour

Change-Id: I88bbb6f951708b17323fac1a72385fe808d270a5
core/java/android/view/textclassifier/TextClassificationManager.java
core/java/android/widget/SelectionActionModeHelper.java