summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Zoey Chen <zoeychen@google.com> 2024-03-13 07:45:13 +0000
committer Zoey Chen <zoeychen@google.com> 2024-03-13 07:45:13 +0000
commit559d64241892899fc8e848a3942b62ff14da3a0e (patch)
tree562c9e353a59a0d2d6b1bf3c68add173fbc527fe
parent8d6525ff39c5c97f0521c85324b7acf3a1678554 (diff)
[ToA] Update configuration when the file is loaded after reboot
Bug: 329370457 Test: manual + Presubmit Test: atest GrammaticalInflectionManagerTest Test: atest WmTests:ActivityStarterTests Test: atest WmTests:WindowProcessControllerTests Change-Id: Icdf4758e0a90bfdb15f5d948d6cc5790c126d16c
-rw-r--r--services/core/java/com/android/server/grammaticalinflection/GrammaticalInflectionService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/grammaticalinflection/GrammaticalInflectionService.java b/services/core/java/com/android/server/grammaticalinflection/GrammaticalInflectionService.java
index e6bf2c968350..3fafca8ed377 100644
--- a/services/core/java/com/android/server/grammaticalinflection/GrammaticalInflectionService.java
+++ b/services/core/java/com/android/server/grammaticalinflection/GrammaticalInflectionService.java
@@ -266,7 +266,11 @@ public class GrammaticalInflectionService extends SystemService {
throw new RuntimeException(e);
}
}
+ updateConfiguration(grammaticalGender, userId);
+ Trace.endSection();
+ }
+ private void updateConfiguration(int grammaticalGender, int userId) {
try {
Configuration config = new Configuration();
int preValue = config.getGrammaticalGender();
@@ -280,7 +284,6 @@ public class GrammaticalInflectionService extends SystemService {
} catch (RemoteException e) {
Log.w(TAG, "Can not update configuration", e);
}
- Trace.endSection();
}
public int getSystemGrammaticalGender(AttributionSource attributionSource, int userId) {
@@ -372,7 +375,9 @@ public class GrammaticalInflectionService extends SystemService {
if (mGrammaticalGenderCache.indexOfKey(userId) < 0) {
try (FileInputStream in = new FileInputStream(file)) {
final TypedXmlPullParser parser = Xml.resolvePullParser(in);
- mGrammaticalGenderCache.put(userId, getGrammaticalGenderFromXml(parser));
+ int grammaticalGender = getGrammaticalGenderFromXml(parser);
+ mGrammaticalGenderCache.put(userId, grammaticalGender);
+ updateConfiguration(grammaticalGender, userId);
} catch (IOException | XmlPullParserException e) {
Log.e(TAG, "Failed to parse XML configuration from " + file, e);
}