Roll forward (ag/3652360): Adds a few boundary-condition checks, and updates the default model not to contain regexes that cause the ICU regex interpreter to hang.
- the core problem was wrong version of the model
- this went through because I was unaware of the difference between coretests and cts (so should this arise next time, it should be caught at my machine locally, and latest in presubmit robot that now runs the right tests cr/187097855)
Bugs: 73758981
Bugs: 73849149
Test: Tested on device. CTS and core tests pass.
bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Change-Id: I82f7aeaa7fbe3af6c043ec055686efae0d2e9383
diff --git a/text-classifier.cc b/text-classifier.cc
index ef83688..303afee 100644
--- a/text-classifier.cc
+++ b/text-classifier.cc
@@ -284,9 +284,8 @@
TC_LOG(ERROR) << "Not initialized";
return click_indices;
}
-
- const UnicodeText context_unicode =
- UTF8ToUnicodeText(context, /*do_copy=*/false);
+ const UnicodeText context_unicode = UTF8ToUnicodeText(context,
+ /*do_copy=*/false);
const int context_codepoint_size = context_unicode.size_codepoints();
if (click_indices.first < 0 || click_indices.second < 0 ||