diff options
| author | 2018-04-09 11:03:03 +0800 | |
|---|---|---|
| committer | 2018-11-22 01:30:43 +0000 | |
| commit | 5fe382e3492eb0dc239bc6dd46b60ef953d057db (patch) | |
| tree | 524db9b893040b4f0f5a46670bf0373a6bfab2ab | |
| parent | 9166e8937443f891cb20d8821d17ce5af33793ea (diff) | |
Fix ShortcutService handling of locale change during device setup.
On AndroidO MR1 gms pac, change language at WelcomeActivity UI of SetupWizard when first boot,
after boot completed, enter the launcher and then long press some apps's icon, the  shortcuts
show  language resource strings.
Because of ShortcutUser.mKnownLocales not initialized yet, so ShortcutService do nothing when
handling LOCALE_CHANGED broadcast.
Bug: 77759135
Test: 1. make services and do factory reset. All apps can show correct language resource strings
after changing language in WelcomActivity UI of SetupWizard.
2.run com.android.server.pm.ShortcutManagerTest[1-10]:All(1,3-10) pass except 2, the 2 failure is
no matter with this patch.
Change-Id: If235d23d3a4c50f4120674601f853081571c672e
| -rw-r--r-- | services/core/java/com/android/server/pm/ShortcutUser.java | 5 | 
1 files changed, 3 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/pm/ShortcutUser.java b/services/core/java/com/android/server/pm/ShortcutUser.java index 505e4ee60529..1fd9b69e521d 100644 --- a/services/core/java/com/android/server/pm/ShortcutUser.java +++ b/services/core/java/com/android/server/pm/ShortcutUser.java @@ -294,13 +294,14 @@ class ShortcutUser {       */      public void detectLocaleChange() {          final String currentLocales = mService.injectGetLocaleTagsForUser(mUserId); -        if (getKnownLocales().equals(currentLocales)) { +        if (!TextUtils.isEmpty(mKnownLocales) && mKnownLocales.equals(currentLocales)) {              return;          }          if (ShortcutService.DEBUG) { -            Slog.d(TAG, "Locale changed from " + currentLocales + " to " + mKnownLocales +            Slog.d(TAG, "Locale changed from " + mKnownLocales + " to " + currentLocales                      + " for user " + mUserId);          } +          mKnownLocales = currentLocales;          forAllPackages(pkg -> {  |