Use user-aware context when calling getImeAndSubtypeDisplayName
Ensure we get the corresponding PackageManager instance from the user
context to load the text resources of the IME package and the subType.
Fix: 223418203
Test: manual as steps
0) Pair a physical keyboard or use
"adb shell setprop qemu.hw.mainkeys 1` to disable navigation bar
0-1) Restart device with "adb shell am restart"
0-2) After the system restarted, add a new user from Settings >
System > Multiple users
0-3) Switch to the new user to setup and install some IME apps.
1) Switch to the owner user from Status bar -> Select user icon
2) Tap the editor from the google search box to show soft-keyboard
3) After the soft-keyboard displayed, verify "Choose input method"
notification has popuped on the notification shade, and check
the current IME subType display name & the IME package label
are displyed correctly.
4) Repeat step 1-3 for the new user again.
Change-Id: I58421143bee25be459f4f744688b37614a750051
This commit is contained in:
@@ -3202,8 +3202,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
// Used to load label
|
||||
final CharSequence title = mRes.getText(
|
||||
com.android.internal.R.string.select_input_method);
|
||||
final int currentUserId = mSettings.getCurrentUserId();
|
||||
final Context userAwareContext = mContext.getUserId() == currentUserId
|
||||
? mContext
|
||||
: mContext.createContextAsUser(UserHandle.of(currentUserId), 0 /* flags */);
|
||||
final CharSequence summary = InputMethodUtils.getImeAndSubtypeDisplayName(
|
||||
mContext, imi, mCurrentSubtype);
|
||||
userAwareContext, imi, mCurrentSubtype);
|
||||
mImeSwitcherNotification.setContentTitle(title)
|
||||
.setContentText(summary)
|
||||
.setContentIntent(mImeSwitchPendingIntent);
|
||||
|
||||
Reference in New Issue
Block a user