[Physical Keyboard Setting] Add log and null check

update getParcelable api usage, add null check and logging.

Bug: 317416208
Test: Verified on device
Change-Id: I125a6c9cdb5c86be7582ad5102257efb1fa6a1a4
This commit is contained in:
shaoweishen
2024-01-08 08:33:01 +00:00
committed by Shaowei Shen
parent 2a1051cbab
commit ff74d9db0b
2 changed files with 13 additions and 4 deletions

View File

@@ -151,7 +151,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
mKeyboardA11yCategory.removePreference(mAccessibilityStickyKeys);
}
InputDeviceIdentifier inputDeviceIdentifier = activity.getIntent().getParcelableExtra(
KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER);
KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
InputDeviceIdentifier.class);
int intentFromWhere =
activity.getIntent().getIntExtra(android.provider.Settings.EXTRA_ENTRYPOINT, -1);
if (intentFromWhere != -1) {
@@ -168,7 +169,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
}
private static boolean isAutoSelection(Bundle bundle, InputDeviceIdentifier identifier) {
if (bundle != null && bundle.getParcelable(EXTRA_AUTO_SELECTION) != null) {
if (bundle != null && bundle.getParcelable(EXTRA_AUTO_SELECTION,
InputDeviceIdentifier.class) != null) {
return false;
}
return identifier != null;
@@ -446,7 +448,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
if (mIntentWaitingForResult != null) {
InputDeviceIdentifier inputDeviceIdentifier = mIntentWaitingForResult
.getParcelableExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER);
.getParcelableExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
InputDeviceIdentifier.class);
mIntentWaitingForResult = null;
showKeyboardLayoutDialog(inputDeviceIdentifier);
}