Set preference visible to false when there is no keyboard.
1. Physical keyboard settings should only show up if at least one PK is connected. 2. Update tests. 3. Fix NullPointerException. Bug: 269983475 Bug: 270109384 Bug: 271357910 Test: atest and manual Change-Id: If7798587fb386dbf669fc249cab304d91a26879b
This commit is contained in:
@@ -68,6 +68,9 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
|
||||
}
|
||||
|
||||
private void updateCheckedState() {
|
||||
if (NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier) == null) {
|
||||
return;
|
||||
}
|
||||
PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||
preferenceScreen.removeAll();
|
||||
List<InputMethodInfo> infoList = mImm.getEnabledInputMethodListAsUser(mUserId);
|
||||
@@ -174,8 +177,8 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mIm.registerInputDeviceListener(this, null);
|
||||
final InputDevice inputDevice =
|
||||
mIm.getInputDeviceByDescriptor(mInputDeviceIdentifier.getDescriptor());
|
||||
InputDevice inputDevice =
|
||||
NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier);
|
||||
if (inputDevice == null) {
|
||||
getActivity().finish();
|
||||
return;
|
||||
|
Reference in New Issue
Block a user