Loading services/core/java/com/android/server/input/KeyboardLayoutManager.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -464,7 +464,7 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { return LocaleList.forLanguageTags(languageTags.replace('|', ',')); return LocaleList.forLanguageTags(languageTags.replace('|', ',')); } } private static String getLayoutDescriptor(@NonNull InputDeviceIdentifier identifier) { private String getLayoutDescriptor(@NonNull InputDeviceIdentifier identifier) { Objects.requireNonNull(identifier, "identifier must not be null"); Objects.requireNonNull(identifier, "identifier must not be null"); Objects.requireNonNull(identifier.getDescriptor(), "descriptor must not be null"); Objects.requireNonNull(identifier.getDescriptor(), "descriptor must not be null"); Loading @@ -474,7 +474,21 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { // If vendor id and product id is available, use it as keys. This allows us to have the // If vendor id and product id is available, use it as keys. This allows us to have the // same setup for all keyboards with same product and vendor id. i.e. User can swap 2 // same setup for all keyboards with same product and vendor id. i.e. User can swap 2 // identical keyboards and still get the same setup. // identical keyboards and still get the same setup. return "vendor:" + identifier.getVendorId() + ",product:" + identifier.getProductId(); StringBuilder key = new StringBuilder(); key.append("vendor:").append(identifier.getVendorId()).append(",product:").append( identifier.getProductId()); InputDevice inputDevice = getInputDevice(identifier); Objects.requireNonNull(inputDevice, "Input device must not be null"); // Some keyboards can have same product ID and vendor ID but different Keyboard info like // language tag and layout type. if (!TextUtils.isEmpty(inputDevice.getKeyboardLanguageTag())) { key.append(",languageTag:").append(inputDevice.getKeyboardLanguageTag()); } if (!TextUtils.isEmpty(inputDevice.getKeyboardLayoutType())) { key.append(",layoutType:").append(inputDevice.getKeyboardLanguageTag()); } return key.toString(); } } @Nullable @Nullable Loading Loading @@ -1075,7 +1089,7 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { identifier.getDescriptor()) : null; identifier.getDescriptor()) : null; } } private static String createLayoutKey(InputDeviceIdentifier identifier, int userId, private String createLayoutKey(InputDeviceIdentifier identifier, int userId, @NonNull InputMethodSubtypeHandle subtypeHandle) { @NonNull InputMethodSubtypeHandle subtypeHandle) { Objects.requireNonNull(subtypeHandle, "subtypeHandle must not be null"); Objects.requireNonNull(subtypeHandle, "subtypeHandle must not be null"); return "layoutDescriptor:" + getLayoutDescriptor(identifier) + ",userId:" + userId return "layoutDescriptor:" + getLayoutDescriptor(identifier) + ",userId:" + userId Loading Loading
services/core/java/com/android/server/input/KeyboardLayoutManager.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -464,7 +464,7 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { return LocaleList.forLanguageTags(languageTags.replace('|', ',')); return LocaleList.forLanguageTags(languageTags.replace('|', ',')); } } private static String getLayoutDescriptor(@NonNull InputDeviceIdentifier identifier) { private String getLayoutDescriptor(@NonNull InputDeviceIdentifier identifier) { Objects.requireNonNull(identifier, "identifier must not be null"); Objects.requireNonNull(identifier, "identifier must not be null"); Objects.requireNonNull(identifier.getDescriptor(), "descriptor must not be null"); Objects.requireNonNull(identifier.getDescriptor(), "descriptor must not be null"); Loading @@ -474,7 +474,21 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { // If vendor id and product id is available, use it as keys. This allows us to have the // If vendor id and product id is available, use it as keys. This allows us to have the // same setup for all keyboards with same product and vendor id. i.e. User can swap 2 // same setup for all keyboards with same product and vendor id. i.e. User can swap 2 // identical keyboards and still get the same setup. // identical keyboards and still get the same setup. return "vendor:" + identifier.getVendorId() + ",product:" + identifier.getProductId(); StringBuilder key = new StringBuilder(); key.append("vendor:").append(identifier.getVendorId()).append(",product:").append( identifier.getProductId()); InputDevice inputDevice = getInputDevice(identifier); Objects.requireNonNull(inputDevice, "Input device must not be null"); // Some keyboards can have same product ID and vendor ID but different Keyboard info like // language tag and layout type. if (!TextUtils.isEmpty(inputDevice.getKeyboardLanguageTag())) { key.append(",languageTag:").append(inputDevice.getKeyboardLanguageTag()); } if (!TextUtils.isEmpty(inputDevice.getKeyboardLayoutType())) { key.append(",layoutType:").append(inputDevice.getKeyboardLanguageTag()); } return key.toString(); } } @Nullable @Nullable Loading Loading @@ -1075,7 +1089,7 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { identifier.getDescriptor()) : null; identifier.getDescriptor()) : null; } } private static String createLayoutKey(InputDeviceIdentifier identifier, int userId, private String createLayoutKey(InputDeviceIdentifier identifier, int userId, @NonNull InputMethodSubtypeHandle subtypeHandle) { @NonNull InputMethodSubtypeHandle subtypeHandle) { Objects.requireNonNull(subtypeHandle, "subtypeHandle must not be null"); Objects.requireNonNull(subtypeHandle, "subtypeHandle must not be null"); return "layoutDescriptor:" + getLayoutDescriptor(identifier) + ",userId:" + userId return "layoutDescriptor:" + getLayoutDescriptor(identifier) + ",userId:" + userId Loading