From 67d234d726a7101d48faa379cd4b02b1cde98574 Mon Sep 17 00:00:00 2001 From: Jan Althaus Date: Fri, 26 Jan 2018 17:53:31 +0100 Subject: [PATCH] Updating the text classifier model path The lib2 implementation of libtextclassifier is incompatible with models for lib1. To avoid trying to load a lib1 model and failing (which happens when devices are upgraded from O to P), we need a new update model path. Using this opportunity to remove smartselection from the filename, which isn't appropriate any more given what the model is used for. Test: Ran core framework tests Change-Id: I79a80d10d920019f5091fe9884f370149d39fe88 --- core/java/android/view/textclassifier/TextClassifierImpl.java | 2 +- .../android/server/updates/SmartSelectionInstallReceiver.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/java/android/view/textclassifier/TextClassifierImpl.java b/core/java/android/view/textclassifier/TextClassifierImpl.java index 6a44fb38ee13c..9128d9765a04e 100644 --- a/core/java/android/view/textclassifier/TextClassifierImpl.java +++ b/core/java/android/view/textclassifier/TextClassifierImpl.java @@ -72,7 +72,7 @@ final class TextClassifierImpl implements TextClassifier { private static final String MODEL_DIR = "/etc/textclassifier/"; private static final String MODEL_FILE_REGEX = "textclassifier\\.smartselection\\.(.*)\\.model"; private static final String UPDATED_MODEL_FILE_PATH = - "/data/misc/textclassifier/textclassifier.smartselection.model"; + "/data/misc/textclassifier/textclassifier.model"; private static final List ENTITY_TYPES_ALL = Collections.unmodifiableList(Arrays.asList( TextClassifier.TYPE_ADDRESS, diff --git a/services/core/java/com/android/server/updates/SmartSelectionInstallReceiver.java b/services/core/java/com/android/server/updates/SmartSelectionInstallReceiver.java index 1457366a17a31..eff9a9a5b5038 100644 --- a/services/core/java/com/android/server/updates/SmartSelectionInstallReceiver.java +++ b/services/core/java/com/android/server/updates/SmartSelectionInstallReceiver.java @@ -21,8 +21,8 @@ public class SmartSelectionInstallReceiver extends ConfigUpdateInstallReceiver { public SmartSelectionInstallReceiver() { super( "/data/misc/textclassifier/", - "textclassifier.smartselection.model", - "metadata/smartselection", + "textclassifier.model", + "metadata/classification", "version"); }