use of android.hardware.input.InputDeviceIdentifier in project android_frameworks_base by DirtyUnicorns.
the class InputManagerService method onShellCommand.
public int onShellCommand(Shell shell, String cmd) {
if (TextUtils.isEmpty(cmd)) {
shell.onHelp();
return 1;
}
if (cmd.equals("setlayout")) {
if (!checkCallingPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT, "onShellCommand()")) {
throw new SecurityException("Requires SET_KEYBOARD_LAYOUT permission");
}
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(shell.getNextArgRequired(), Integer.parseInt(shell.getNextArgRequired()));
String descriptor = shell.getNextArgRequired();
int vid = Integer.decode(shell.getNextArgRequired());
int pid = Integer.decode(shell.getNextArgRequired());
InputDeviceIdentifier id = new InputDeviceIdentifier(descriptor, vid, pid);
setKeyboardLayoutForInputDeviceInner(id, handle, shell.getNextArgRequired());
}
return 0;
}
use of android.hardware.input.InputDeviceIdentifier in project android_frameworks_base by AOSPA.
the class InputManagerService method onShellCommand.
public int onShellCommand(Shell shell, String cmd) {
if (TextUtils.isEmpty(cmd)) {
shell.onHelp();
return 1;
}
if (cmd.equals("setlayout")) {
if (!checkCallingPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT, "onShellCommand()")) {
throw new SecurityException("Requires SET_KEYBOARD_LAYOUT permission");
}
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(shell.getNextArgRequired(), Integer.parseInt(shell.getNextArgRequired()));
String descriptor = shell.getNextArgRequired();
int vid = Integer.decode(shell.getNextArgRequired());
int pid = Integer.decode(shell.getNextArgRequired());
InputDeviceIdentifier id = new InputDeviceIdentifier(descriptor, vid, pid);
setKeyboardLayoutForInputDeviceInner(id, handle, shell.getNextArgRequired());
}
return 0;
}
use of android.hardware.input.InputDeviceIdentifier in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InputMethodAndLanguageSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.language_settings);
final Activity activity = getActivity();
mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mInputMethodSettingValues = InputMethodSettingValuesWrapper.getInstance(activity);
try {
mDefaultInputMethodSelectorVisibility = Integer.valueOf(getString(R.string.input_method_selector_visibility_default_value));
} catch (NumberFormatException e) {
}
if (activity.getAssets().getLocales().length == 1) {
// No "Select language" pref if there's only one system locale available.
getPreferenceScreen().removePreference(findPreference(KEY_PHONE_LANGUAGE));
} else {
mLanguagePref = findPreference(KEY_PHONE_LANGUAGE);
}
if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
mShowInputMethodSelectorPref = (ListPreference) findPreference(KEY_INPUT_METHOD_SELECTOR);
mShowInputMethodSelectorPref.setOnPreferenceChangeListener(this);
// TODO: Update current input method name on summary
updateInputMethodSelectorSummary(loadInputMethodSelectorVisibility());
}
new VoiceInputOutputSettings(this).onCreate();
// Get references to dynamically constructed categories.
mHardKeyboardCategory = (PreferenceCategory) findPreference("hard_keyboard");
mKeyboardSettingsCategory = (PreferenceCategory) findPreference("keyboard_settings_category");
mGameControllerCategory = (PreferenceCategory) findPreference("game_controller_settings_category");
final Intent startingIntent = activity.getIntent();
// Filter out irrelevant features if invoked from IME settings button.
mShowsOnlyFullImeAndKeyboardList = Settings.ACTION_INPUT_METHOD_SETTINGS.equals(startingIntent.getAction());
if (mShowsOnlyFullImeAndKeyboardList) {
getPreferenceScreen().removeAll();
if (mHardKeyboardCategory != null) {
getPreferenceScreen().addPreference(mHardKeyboardCategory);
}
if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
getPreferenceScreen().addPreference(mShowInputMethodSelectorPref);
}
if (mKeyboardSettingsCategory != null) {
mKeyboardSettingsCategory.removeAll();
getPreferenceScreen().addPreference(mKeyboardSettingsCategory);
}
}
// Build hard keyboard and game controller preference categories.
mIm = (InputManager) activity.getSystemService(Context.INPUT_SERVICE);
updateInputDevices();
// Spell Checker
final Preference spellChecker = findPreference(KEY_SPELL_CHECKERS);
if (spellChecker != null) {
// Note: KEY_SPELL_CHECKERS preference is marked as persistent="false" in XML.
InputMethodAndSubtypeUtil.removeUnnecessaryNonPersistentPreference(spellChecker);
final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClass(activity, SubSettings.class);
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, SpellCheckersSettings.class.getName());
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.spellcheckers_settings_title);
spellChecker.setIntent(intent);
}
mHandler = new Handler();
mSettingsObserver = new SettingsObserver(mHandler, activity);
mDpm = (DevicePolicyManager) (getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE));
// If we've launched from the keyboard layout notification, go ahead and just show the
// keyboard layout dialog.
final InputDeviceIdentifier identifier = startingIntent.getParcelableExtra(Settings.EXTRA_INPUT_DEVICE_IDENTIFIER);
if (mShowsOnlyFullImeAndKeyboardList && identifier != null) {
showKeyboardLayoutDialog(identifier);
}
updateCurrentImeName();
}
use of android.hardware.input.InputDeviceIdentifier in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InputMethodAndLanguageSettings method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (mIntentWaitingForResult != null) {
InputDeviceIdentifier inputDeviceIdentifier = mIntentWaitingForResult.getParcelableExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER);
mIntentWaitingForResult = null;
showKeyboardLayoutDialog(inputDeviceIdentifier);
}
}
use of android.hardware.input.InputDeviceIdentifier in project android_frameworks_base by crdroidandroid.
the class InputManagerService method onShellCommand.
public int onShellCommand(Shell shell, String cmd) {
if (TextUtils.isEmpty(cmd)) {
shell.onHelp();
return 1;
}
if (cmd.equals("setlayout")) {
if (!checkCallingPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT, "onShellCommand()")) {
throw new SecurityException("Requires SET_KEYBOARD_LAYOUT permission");
}
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(shell.getNextArgRequired(), Integer.parseInt(shell.getNextArgRequired()));
String descriptor = shell.getNextArgRequired();
int vid = Integer.decode(shell.getNextArgRequired());
int pid = Integer.decode(shell.getNextArgRequired());
InputDeviceIdentifier id = new InputDeviceIdentifier(descriptor, vid, pid);
setKeyboardLayoutForInputDeviceInner(id, handle, shell.getNextArgRequired());
}
return 0;
}
Aggregations