Flag to configure model parameters

The objective is to allow us to push model parameters by using a settings flag,
without the need of pushing a new model file.

Settings.Global#TEXT_CLASSIFIER_ACTION_MODEL_PARAMS stores a comma
separated string that contains these three fields:
1. required_model_version
2. required_locales
3. serialized_preconditions

To ensure serialized_preconditions is applied to the target model file,
TextClassifierImpl only applies the serialized_preconditions when
required_model_version and required_locales are both met.

Test: atest frameworks/base/core/tests/coretests/src/android/view/textclassifier/
Test: adb shell settings put global text_classifier_action_model_params 'required_model_version=0,required_locales=en,serialized_preconditions=FAAAAAAADgAIAAAAAAAAAAAABAAOAAAAAAAAAA=='
      Observe that the flag is actually applied in the model.
Test: Ensure that finalize is called when the activity is dead.

BUG: 123616497

Change-Id: Ie42dcfeee705c83bbb693a5c1a0fedd0821df5e7
5 files changed