Open the settings page for a specific physical keyboard

1. Check open from a notification
2. Check open from Bluetooth entry
3. If the inputDeviceIdentifier is not null, open the next page
   directly.
4. Add extra to record the class of sender for the future metrics.

Demo: http://screencast/cast/NDU4MTYxOTIzMTg4MzI2NHxiYTQ0ODE5Ny02YQ

Bug: 269212353
Test: manual, atest
[Pass] atest KeyboardSettingsPreferenceControllerTest
[Pass] atest PhysicalKeyboardPreferenceControllerTest

Change-Id: Ie874003260896bbb949806623913e70486e4731d
This commit is contained in:
danielwbhuang
2023-03-24 19:11:53 +08:00
committed by Daniel Huang
parent 9a40a296cc
commit cc749159df
9 changed files with 99 additions and 42 deletions

View File

@@ -17,8 +17,10 @@
package com.android.settings.inputmethod;
import android.content.Context;
import android.content.Intent;
import android.hardware.input.InputManager;
import android.icu.text.ListFormatter;
import android.provider.Settings;
import androidx.preference.Preference;
@@ -58,6 +60,19 @@ public class PhysicalKeyboardPreferenceController extends AbstractPreferenceCont
&& mContext.getResources().getBoolean(R.bool.config_show_physical_keyboard_pref);
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (!getPreferenceKey().equals(preference.getKey())) {
return false;
}
Intent intent = new Intent(Settings.ACTION_HARD_KEYBOARD_SETTINGS);
intent.putExtra(
NewKeyboardSettingsUtils.EXTRA_INTENT_FROM,
"com.android.settings.inputmethod.PhysicalKeyboardPreferenceController");
mContext.startActivity(intent);
return true;
}
@Override
public void updateState(Preference preference) {
mPreference = preference;