Fixes crashes by making native library thread-safe, makes Annotate calls much faster by
re-using tokens, fixes default values in enums in FlatBuffer schema.

Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest

Bug: 74193987
Bug: 68239358
Change-Id: Ic5ca42b628280bece59d31203748072084ac452c
(cherry picked from commit 2191547d7109587d73077f9d4818c691f7d7dafb)
Merged-In: Ic5ca42b628280bece59d31203748072084ac452c
diff --git a/cached-features.h b/cached-features.h
index 86b700f..0224d86 100644
--- a/cached-features.h
+++ b/cached-features.h
@@ -32,12 +32,9 @@
  public:
   static std::unique_ptr<CachedFeatures> Create(
       const TokenSpan& extraction_span,
-      const std::vector<std::vector<int>>& sparse_features,
-      const std::vector<std::vector<float>>& dense_features,
-      const std::vector<int>& padding_sparse_features,
-      const std::vector<float>& padding_dense_features,
-      const FeatureProcessorOptions* options,
-      EmbeddingExecutor* embedding_executor, int feature_vector_size);
+      std::unique_ptr<std::vector<float>> features,
+      std::unique_ptr<std::vector<float>> padding_features,
+      const FeatureProcessorOptions* options, int feature_vector_size);
 
   // Appends the click context features for the given click position to
   // 'output_features'.
@@ -77,8 +74,8 @@
   TokenSpan extraction_span_;
   const FeatureProcessorOptions* options_;
   int output_features_size_;
-  std::vector<float> features_;
-  std::vector<float> padding_features_;
+  std::unique_ptr<std::vector<float>> features_;
+  std::unique_ptr<std::vector<float>> padding_features_;
 };
 
 }  // namespace libtextclassifier2