Make IMMS#updateStatusIcon() multi-user aware
It turns out that
InputMethodManagerService#updateStatusIcon()
still uses PakcageManager for user 0 when loading the IME application
label. This CL fixes such a user mismatch.
Note that the code in question was originally added [1] before
multi-user support was added into InputMethodManagerService. We just
forgot to update the code when making IMMS multi-user aware [2].
[1]: I1c1bd123d828fb10911bca92130e9a05c1f020b3
6179ea3196
[2]: Ib23849d352db33f0747aa9d5a178f00ac726c13b
4e1ab15b30
Fix: 250716279
Test: presubmit
Change-Id: I37106c3c82950d4f6f3a7b149b21579b0314a287
This commit is contained in:
@@ -2960,19 +2960,17 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
hideStatusBarIconLocked();
|
||||
} else if (packageName != null) {
|
||||
if (DEBUG) Slog.d(TAG, "show a small icon for the input method");
|
||||
CharSequence contentDescription = null;
|
||||
final PackageManager userAwarePackageManager =
|
||||
getPackageManagerForUser(mContext, mSettings.getCurrentUserId());
|
||||
ApplicationInfo applicationInfo = null;
|
||||
try {
|
||||
// Use PackageManager to load label
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
final ApplicationInfo applicationInfo = mIPackageManager
|
||||
.getApplicationInfo(packageName, 0, mSettings.getCurrentUserId());
|
||||
if (applicationInfo != null) {
|
||||
contentDescription = packageManager
|
||||
.getApplicationLabel(applicationInfo);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
/* ignore */
|
||||
applicationInfo = userAwarePackageManager.getApplicationInfo(packageName,
|
||||
PackageManager.ApplicationInfoFlags.of(0));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
}
|
||||
final CharSequence contentDescription = applicationInfo != null
|
||||
? userAwarePackageManager.getApplicationLabel(applicationInfo)
|
||||
: null;
|
||||
if (mStatusBar != null) {
|
||||
mStatusBar.setIcon(mSlotIme, packageName, iconId, 0,
|
||||
contentDescription != null
|
||||
|
||||
Reference in New Issue
Block a user