Merge "Integrate UI with APIs for physical keyboard settgins."

This commit is contained in:
TreeHugger Robot
2023-02-02 08:12:37 +00:00
committed by Android (Google) Code Review
8 changed files with 289 additions and 101 deletions

View File

@@ -20,64 +20,124 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
import android.os.UserHandle;
import android.view.InputDevice;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.inputmethod.NewKeyboardSettingsUtils.KeyboardInfo;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
implements InputManager.InputDeviceListener {
private static final String TAG = "NewKeyboardLayoutEnabledLocalesFragment";
private static final String PREF_KEY_ENABLED_LOCALES = "enabled_locales_keyboard_layout";
static final String EXTRA_KEYBOARD_DEVICE_NAME = "extra_keyboard_device_name";
private InputManager mIm;
private InputMethodManager mImm;
private InputDeviceIdentifier mInputDeviceIdentifier;
private int mUserId;
private int mInputDeviceId;
private Context mContext;
private Map<String, KeyboardInfo> mKeyboardLanguageLayouts = new HashMap<>();
@Override
public void onActivityCreated(final Bundle icicle) {
super.onActivityCreated(icicle);
Bundle arguments = getArguments();
final String title = arguments.getString(EXTRA_KEYBOARD_DEVICE_NAME);
mInputDeviceIdentifier = arguments.getParcelable(
KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER);
final String title =
arguments.getString(NewKeyboardSettingsUtils.EXTRA_KEYBOARD_DEVICE_NAME);
mInputDeviceIdentifier =
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER);
getActivity().setTitle(title);
final PreferenceCategory category = findPreference(PREF_KEY_ENABLED_LOCALES);
updateCheckedState();
}
// TODO(b/252816846): Need APIs to get the available keyboards from Inputmanager.
// For example: InputMethodManager.getEnabledInputMethodLocales()
// InputManager.getKeyboardLayoutForLocale()
// Hardcode the default value for demo purpose
String[] keyboardLanguages = {"English (US)", "German (Germany)", "Spanish (Spain)"};
String[] keyboardLayouts = {"English (US)", "German", "Spanish"};
for (int i = 0; i < keyboardLanguages.length; i++) {
private void updateCheckedState() {
PreferenceScreen preferenceScreen = getPreferenceScreen();
preferenceScreen.removeAll();
List<InputMethodInfo> infoList = mImm.getEnabledInputMethodListAsUser(mUserId);
for (InputMethodInfo info : infoList) {
mKeyboardLanguageLayouts.clear();
List<InputMethodSubtype> subtypes =
mImm.getEnabledInputMethodSubtypeList(info, true);
for (InputMethodSubtype subtype : subtypes) {
if (subtype.isSuitableForPhysicalKeyboardLayoutMapping()) {
mapLanguageWithLayout(info, subtype);
}
}
updatePreferenceLayout(preferenceScreen, info);
}
}
private void mapLanguageWithLayout(InputMethodInfo info, InputMethodSubtype subtype) {
KeyboardLayout[] keyboardLayouts = getKeyboardLayouts(info, subtype);
String layout = getKeyboardLayout(info, subtype);
String language = getLanguage(info, subtype);
if (layout != null) {
for (int i = 0; i < keyboardLayouts.length; i++) {
if (keyboardLayouts[i].getDescriptor().equals(layout)) {
KeyboardInfo keyboardInfo = new KeyboardInfo(
language,
keyboardLayouts[i].getLabel(),
info,
subtype);
mKeyboardLanguageLayouts.put(subtype.getLanguageTag(), keyboardInfo);
break;
}
}
} else {
// if there is no auto-selected layout, we should show "Default"
KeyboardInfo keyboardInfo = new KeyboardInfo(
language,
mContext.getString(R.string.keyboard_default_layout),
info,
subtype);
mKeyboardLanguageLayouts.put(subtype.getLanguageTag(), keyboardInfo);
}
}
private void updatePreferenceLayout(PreferenceScreen preferenceScreen, InputMethodInfo info) {
if (mKeyboardLanguageLayouts.isEmpty()) {
return;
}
PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
preferenceCategory.setTitle(info.loadLabel(mContext.getPackageManager()).toString());
preferenceCategory.setKey(info.getPackageName());
preferenceScreen.addPreference(preferenceCategory);
for (Map.Entry<String, KeyboardInfo> entry : mKeyboardLanguageLayouts.entrySet()) {
final Preference pref = new Preference(mContext);
String key = "keyboard_language_label_" + String.valueOf(i);
String keyboardLanguageTitle = keyboardLanguages[i];
String keyboardLanguageSummary = keyboardLayouts[i];
// TODO: Waiting for new API to use a prefix with special number to setKey
String key = "keyboard_language_" + entry.getKey();
NewKeyboardSettingsUtils.KeyboardInfo keyboardInfo = entry.getValue();
pref.setKey(key);
pref.setTitle(keyboardLanguageTitle);
pref.setSummary(keyboardLanguageSummary);
pref.setTitle(keyboardInfo.getLanguage());
pref.setSummary(keyboardInfo.getLayout());
pref.setOnPreferenceClickListener(
preference -> {
showKeyboardLayoutPicker(
keyboardLanguageTitle,
keyboardLanguageSummary,
mInputDeviceIdentifier);
keyboardInfo.getLanguage(),
keyboardInfo.getLayout(),
mInputDeviceIdentifier,
mUserId,
keyboardInfo.getInputMethodInfo(),
keyboardInfo.getInputMethodSubtype());
return true;
});
category.addPreference(pref);
preferenceCategory.addPreference(pref);
}
}
@@ -96,7 +156,7 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
@Override
public void onInputDeviceChanged(int deviceId) {
if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
// TODO(b/252816846): Need APIs to update the available keyboards.
updateCheckedState();
}
}
@@ -105,7 +165,9 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
super.onCreate(savedInstanceState);
mContext = getContext();
mIm = mContext.getSystemService(InputManager.class);
mImm = mContext.getSystemService(InputMethodManager.class);
mInputDeviceId = -1;
mUserId = UserHandle.myUserId();
}
@Override
@@ -131,7 +193,7 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
@Override
public void onResume() {
super.onResume();
// TODO(b/252816846): Need APIs to get the available keyboards from Inputmanager.
updateCheckedState();
}
@Override
@@ -149,17 +211,50 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
return R.xml.keyboard_settings_enabled_locales_list;
}
private void showKeyboardLayoutPicker(String language, String layout,
InputDeviceIdentifier inputDeviceIdentifier) {
private void showKeyboardLayoutPicker(
String language,
String layout,
InputDeviceIdentifier inputDeviceIdentifier,
int userId,
InputMethodInfo inputMethodInfo,
InputMethodSubtype inputMethodSubtype) {
Bundle arguments = new Bundle();
arguments.putParcelable(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
inputDeviceIdentifier);
arguments.putString(NewKeyboardLayoutPickerFragment.EXTRA_TITLE, language);
arguments.putString(NewKeyboardLayoutPickerFragment.EXTRA_KEYBOARD_LAYOUT, layout);
arguments.putParcelable(
NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER, inputDeviceIdentifier);
arguments.putParcelable(
NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_INFO, inputMethodInfo);
arguments.putParcelable(
NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_SUBTYPE, inputMethodSubtype);
arguments.putInt(NewKeyboardSettingsUtils.EXTRA_USER_ID, userId);
arguments.putString(NewKeyboardSettingsUtils.EXTRA_TITLE, language);
arguments.putString(NewKeyboardSettingsUtils.EXTRA_KEYBOARD_LAYOUT, layout);
new SubSettingLauncher(mContext)
.setSourceMetricsCategory(getMetricsCategory())
.setDestination(NewKeyboardLayoutPickerFragment.class.getName())
.setArguments(arguments)
.launch();
}
private KeyboardLayout[] getKeyboardLayouts(InputMethodInfo info, InputMethodSubtype subtype) {
return mIm.getKeyboardLayoutListForInputDevice(
mInputDeviceIdentifier, mUserId, info, subtype);
}
private String getKeyboardLayout(InputMethodInfo info, InputMethodSubtype subtype) {
return mIm.getKeyboardLayoutForInputDevice(
mInputDeviceIdentifier, mUserId, info, subtype);
}
private String getLanguage(InputMethodInfo info, InputMethodSubtype subtype) {
String language;
if (subtype.getLanguageTag().isEmpty()) {
language = subtype.getDisplayName(
mContext,
info.getPackageName(),
info.getServiceInfo().applicationInfo).toString();
} else {
language = Locale.forLanguageTag(subtype.getLanguageTag()).getDisplayName();
}
return language;
}
}

View File

@@ -20,6 +20,8 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.hardware.input.InputDeviceIdentifier;
import android.os.Bundle;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -28,31 +30,28 @@ public class NewKeyboardLayoutPickerContent extends DashboardFragment {
private static final String TAG = "KeyboardLayoutPicker";
static final String EXTRA_TITLE = "keyboard_layout_picker_title";
static final String EXTRA_KEYBOARD_LAYOUT = "keyboard_layout";
/**
* Intent extra: The input device descriptor of the keyboard whose keyboard
* layout is to be changed.
*/
public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
@Override
public void onAttach(Context context) {
super.onAttach(context);
Bundle arguments = getArguments();
final String title = arguments.getString(EXTRA_TITLE);
final String layout = arguments.getString(EXTRA_KEYBOARD_LAYOUT);
final String title = arguments.getString(NewKeyboardSettingsUtils.EXTRA_TITLE);
final String layout = arguments.getString(NewKeyboardSettingsUtils.EXTRA_KEYBOARD_LAYOUT);
final int userId = arguments.getInt(NewKeyboardSettingsUtils.EXTRA_USER_ID);
final InputDeviceIdentifier inputDeviceIdentifier =
arguments.getParcelable(EXTRA_INPUT_DEVICE_IDENTIFIER);
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER);
final InputMethodInfo inputMethodInfo =
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_INFO);
final InputMethodSubtype inputMethodSubtype =
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_SUBTYPE);
if (inputDeviceIdentifier == null) {
getActivity().finish();
}
getActivity().setTitle(title);
use(NewKeyboardLayoutPickerController.class).initialize(this /*parent*/,
inputDeviceIdentifier, layout);
use(NewKeyboardLayoutPickerController.class).initialize(this /*parent*/, userId,
inputDeviceIdentifier, inputMethodInfo, inputMethodSubtype, layout);
}
@Override

View File

@@ -21,6 +21,8 @@ import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
import android.hardware.input.KeyboardLayout;
import android.view.InputDevice;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
@@ -31,7 +33,6 @@ import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -42,7 +43,11 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
private Fragment mParent;
private int mInputDeviceId;
private int mUserId;
private InputDeviceIdentifier mInputDeviceIdentifier;
private InputMethodInfo mInputMethodInfo;
private InputMethodSubtype mInputMethodSubtype;
private KeyboardLayout[] mKeyboardLayouts;
private PreferenceScreen mScreen;
private String mPreviousSelection;
@@ -55,13 +60,16 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
mPreferenceMap = new HashMap<>();
}
public void initialize(Fragment parent, InputDeviceIdentifier inputDeviceIdentifier,
String layout) {
mLayout = layout;
public void initialize(Fragment parent, int userId, InputDeviceIdentifier inputDeviceIdentifier,
InputMethodInfo imeInfo, InputMethodSubtype imeSubtype, String layout) {
mParent = parent;
mUserId = userId;
mInputDeviceIdentifier = inputDeviceIdentifier;
mKeyboardLayouts = mIm.getKeyboardLayoutsForInputDevice(mInputDeviceIdentifier);
Arrays.sort(mKeyboardLayouts);
mInputMethodInfo = imeInfo;
mInputMethodSubtype = imeSubtype;
mLayout = layout;
mKeyboardLayouts = mIm.getKeyboardLayoutListForInputDevice(
inputDeviceIdentifier, userId, imeInfo, imeSubtype);
}
@Override
@@ -102,15 +110,12 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
}
final KeyboardLayoutPreference pref = (KeyboardLayoutPreference) preference;
// TODO(b/259530132): Need APIs to update the available keyboards for input device.
// For example:
// inputManager.setCurrentKeyboardLayoutForInputDevice(
// InputDevice..., Userid..., ImeSubType ..., String keyboardLayoutDescriptor)
pref.setCheckMark(true);
if (mPreviousSelection != null && !mPreviousSelection.equals(preference.getKey())) {
KeyboardLayoutPreference preSelectedPref = mScreen.findPreference(mPreviousSelection);
pref.setCheckMark(true);
preSelectedPref.setCheckMark(false);
}
setLayout(pref);
mPreviousSelection = preference.getKey();
return true;
}
@@ -129,13 +134,7 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
@Override
public void onInputDeviceChanged(int deviceId) {
if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
updateCheckedState();
}
}
private void updateCheckedState() {
// TODO(b/259530132): Need API to update the keyboard language layout list.
// Do nothing.
}
private void createPreferenceHierarchy() {
@@ -143,14 +142,22 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
final KeyboardLayoutPreference pref;
if (mLayout.equals(layout.getLabel())) {
pref = new KeyboardLayoutPreference(mScreen.getContext(), layout.getLabel(), true);
mPreviousSelection = layout.getLabel();
mPreviousSelection = layout.getDescriptor();
} else {
pref = new KeyboardLayoutPreference(mScreen.getContext(), layout.getLabel(), false);
}
// TODO: Waiting for new API to use a prefix with special number to setKey
pref.setKey(layout.getLabel());
pref.setKey(layout.getDescriptor());
mScreen.addPreference(pref);
mPreferenceMap.put(pref, layout);
}
}
private void setLayout(KeyboardLayoutPreference preference) {
mIm.setKeyboardLayoutForInputDevice(
mInputDeviceIdentifier,
mUserId,
mInputMethodInfo,
mInputMethodSubtype,
mPreferenceMap.get(preference).getDescriptor());
}
}

View File

@@ -27,15 +27,6 @@ import com.android.settings.R;
public class NewKeyboardLayoutPickerFragment extends Fragment {
static final String EXTRA_TITLE = "keyboard_layout_picker_title";
static final String EXTRA_KEYBOARD_LAYOUT = "keyboard_layout";
/**
* Intent extra: The input device descriptor of the keyboard whose keyboard
* layout is to be changed.
*/
public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
private ViewGroup mFragmentView;
@Override

View File

@@ -0,0 +1,104 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.inputmethod;
import android.content.Context;
import android.provider.Settings;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import java.util.ArrayList;
import java.util.List;
/**
* Utilities of keyboard settings
*/
public class NewKeyboardSettingsUtils {
static final String EXTRA_KEYBOARD_DEVICE_NAME = "extra_keyboard_device_name";
static final String EXTRA_TITLE = "keyboard_layout_picker_title";
static final String EXTRA_KEYBOARD_LAYOUT = "keyboard_layout";
static final String EXTRA_USER_ID = "user_id";
static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
static final String EXTRA_INPUT_METHOD_INFO = "input_method_info";
static final String EXTRA_INPUT_METHOD_SUBTYPE = "input_method_subtype";
static InputMethodInfo getActiveIme(Context context, InputMethodManager imm) {
InputMethodInfo activeIme = null;
List<InputMethodInfo> infoList = imm.getEnabledInputMethodList();
String imeId = Settings.Secure.getStringForUser(context.getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD, context.getUserId());
for (InputMethodInfo method : infoList) {
if (method.getId().equals(imeId)) {
activeIme = method;
}
}
return activeIme;
}
static List<String> getSuitableImeLabels(Context context, InputMethodManager imm, int userId) {
List<String> suitableInputMethodInfoLabels = new ArrayList<>();
List<InputMethodInfo> infoList = imm.getEnabledInputMethodListAsUser(userId);
for (InputMethodInfo info : infoList) {
List<InputMethodSubtype> subtypes =
imm.getEnabledInputMethodSubtypeList(info, true);
for (InputMethodSubtype subtype : subtypes) {
if (subtype.isSuitableForPhysicalKeyboardLayoutMapping()) {
suitableInputMethodInfoLabels.add(
info.loadLabel(context.getPackageManager()).toString());
break;
}
}
}
return suitableInputMethodInfoLabels;
}
static class KeyboardInfo {
String mLanguage;
String mLayout;
InputMethodInfo mInputMethodInfo;
InputMethodSubtype mInputMethodSubtype;
KeyboardInfo(
String language,
String layout,
InputMethodInfo inputMethodInfo,
InputMethodSubtype inputMethodSubtype) {
mLanguage = language;
mLayout = layout;
mInputMethodInfo = inputMethodInfo;
mInputMethodSubtype = inputMethodSubtype;
}
String getLanguage() {
return mLanguage;
}
String getLayout() {
return mLayout;
}
InputMethodInfo getInputMethodInfo() {
return mInputMethodInfo;
}
InputMethodSubtype getInputMethodSubtype() {
return mInputMethodSubtype;
}
}
}

View File

@@ -35,6 +35,7 @@ import android.provider.Settings.Secure;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.view.InputDevice;
import android.view.inputmethod.InputMethodManager;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
@@ -54,9 +55,7 @@ import com.android.settingslib.utils.ThreadUtils;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@SearchIndexable
@@ -73,6 +72,7 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
private final ArrayList<HardKeyboardDeviceInfo> mLastHardKeyboards = new ArrayList<>();
private InputManager mIm;
private InputMethodManager mImm;
@NonNull
private PreferenceCategory mKeyboardAssistanceCategory;
@NonNull
@@ -90,6 +90,7 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
mBluetoothAddress = activity.getIntent().getStringExtra(EXTRA_BT_ADDRESS);
addPreferencesFromResource(R.xml.physical_keyboard_settings);
mIm = Preconditions.checkNotNull(activity.getSystemService(InputManager.class));
mImm = Preconditions.checkNotNull(activity.getSystemService(InputMethodManager.class));
mKeyboardAssistanceCategory = Preconditions.checkNotNull(
(PreferenceCategory) findPreference(KEYBOARD_OPTIONS_CATEGORY));
mShowVirtualKeyboardSwitch = Preconditions.checkNotNull(
@@ -194,21 +195,15 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
final Preference pref = new Preference(getPrefContext());
pref.setTitle(hardKeyboardDeviceInfo.mDeviceName);
if (mIsNewKeyboardSettings) {
// TODO(b/252816846): Need InputMethodManager to provide the enabled locales.
// Hardcode Languages for demo until inputMethodManager provides the latest API.
// For example: InputMethodManager.getEnabledInputMethodLocales();
String[] keyboardLanguages =
{"English (US)", "German (Germany)", "Spanish (Spain)"};
String[] keyboardLayouts = {"English (US)", "German", "Spanish"};
Map<String, String> keyboardMap = new HashMap<>();
for (int i = 0; i < keyboardLanguages.length; i++) {
keyboardMap.put(keyboardLanguages[i], keyboardLayouts[i]);
}
if (!keyboardMap.isEmpty()) {
String summary = keyboardMap.get(keyboardLanguages[0]);
List<String> suitableImes = new ArrayList<>();
suitableImes.addAll(
NewKeyboardSettingsUtils.getSuitableImeLabels(
getContext(), mImm, UserHandle.myUserId()));
if (!suitableImes.isEmpty()) {
String summary = suitableImes.get(0);
StringBuilder result = new StringBuilder(summary);
for (int i = 1; i < keyboardLanguages.length; i++) {
result.append(", ").append(keyboardMap.get(keyboardLanguages[i]));
for (int i = 1; i < suitableImes.size(); i++) {
result.append(", ").append(suitableImes.get(i));
}
pref.setSummary(result.toString());
} else {
@@ -245,12 +240,10 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
private void showEnabledLocalesKeyboardLayoutList(String keyboardName,
InputDeviceIdentifier inputDeviceIdentifier) {
// TODO(b/252816846: Need to get enabled locales.
Bundle arguments = new Bundle();
arguments.putParcelable(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
arguments.putParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER,
inputDeviceIdentifier);
arguments.putString(NewKeyboardLayoutEnabledLocalesFragment.EXTRA_KEYBOARD_DEVICE_NAME,
keyboardName);
arguments.putString(NewKeyboardSettingsUtils.EXTRA_KEYBOARD_DEVICE_NAME, keyboardName);
new SubSettingLauncher(getContext())
.setSourceMetricsCategory(getMetricsCategory())
.setDestination(NewKeyboardLayoutEnabledLocalesFragment.class.getName())