summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml1
-rw-r--r--src/com/android/settings/PointerSpeedPreference.java7
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java9
-rw-r--r--src/com/android/settings/inputmethod/KeyboardLayoutPicker.java28
4 files changed, 21 insertions, 24 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index fdd02f8..ae6826b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -54,6 +54,7 @@
<uses-permission android:name="android.permission.STATUS_BAR" />
<uses-permission android:name="android.permission.MANAGE_USB" />
<uses-permission android:name="android.permission.SET_POINTER_SPEED" />
+ <uses-permission android:name="android.permission.SET_KEYBOARD_LAYOUT" />
<application android:label="@string/settings_label"
android:icon="@mipmap/ic_launcher_settings"
diff --git a/src/com/android/settings/PointerSpeedPreference.java b/src/com/android/settings/PointerSpeedPreference.java
index 7679cfb..3f40f9a 100644
--- a/src/com/android/settings/PointerSpeedPreference.java
+++ b/src/com/android/settings/PointerSpeedPreference.java
@@ -69,7 +69,7 @@ public class PointerSpeedPreference extends SeekBarDialogPreference implements
mSeekBar = getSeekBar(view);
mSeekBar.setMax(InputManager.MAX_POINTER_SPEED - InputManager.MIN_POINTER_SPEED);
- mOldSpeed = mIm.getPointerSpeed();
+ mOldSpeed = mIm.getPointerSpeed(getContext());
mSeekBar.setProgress(mOldSpeed - InputManager.MIN_POINTER_SPEED);
mSeekBar.setOnSeekBarChangeListener(this);
}
@@ -90,7 +90,7 @@ public class PointerSpeedPreference extends SeekBarDialogPreference implements
}
private void onSpeedChanged() {
- int speed = mIm.getPointerSpeed();
+ int speed = mIm.getPointerSpeed(getContext());
mSeekBar.setProgress(speed - InputManager.MIN_POINTER_SPEED);
}
@@ -101,7 +101,8 @@ public class PointerSpeedPreference extends SeekBarDialogPreference implements
final ContentResolver resolver = getContext().getContentResolver();
if (positiveResult) {
- mIm.setPointerSpeed(mSeekBar.getProgress() + InputManager.MIN_POINTER_SPEED);
+ mIm.setPointerSpeed(getContext(),
+ mSeekBar.getProgress() + InputManager.MIN_POINTER_SPEED);
} else {
restoreOldState();
}
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index cc2cf0a..ac9a27b 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -31,27 +31,23 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.hardware.input.InputManager;
-import android.hardware.input.InputManager.KeyboardLayout;
+import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
import android.os.Handler;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.provider.Settings.System;
import android.text.TextUtils;
import android.view.InputDevice;
-import android.view.KeyCharacterMap;
-import android.view.KeyCharacterMap.UnavailableException;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import java.util.Set;
@@ -373,11 +369,12 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
for (int i = 0; i < devices.length; i++) {
InputDevice device = InputDevice.getDevice(devices[i]);
if (device != null
+ && !device.isVirtual()
&& (device.getSources() & InputDevice.SOURCE_KEYBOARD) != 0
&& device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
final String inputDeviceDescriptor = device.getDescriptor();
final String keyboardLayoutDescriptor =
- im.getInputDeviceKeyboardLayoutDescriptor(inputDeviceDescriptor);
+ im.getKeyboardLayoutForInputDevice(inputDeviceDescriptor);
final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
im.getKeyboardLayout(keyboardLayoutDescriptor) : null;
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java b/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java
index 472df3a..4cfae56 100644
--- a/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java
+++ b/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java
@@ -24,19 +24,17 @@ import android.content.AsyncTaskLoader;
import android.content.Context;
import android.content.Loader;
import android.hardware.input.InputManager;
-import android.hardware.input.InputManager.KeyboardLayout;
+import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
-import android.widget.ListAdapter;
import android.widget.ListView;
-import java.util.Collections;
-import java.util.List;
+import java.util.Arrays;
public class KeyboardLayoutPicker extends ListFragment
- implements LoaderCallbacks<List<KeyboardLayout>> {
+ implements LoaderCallbacks<KeyboardLayout[]> {
private static final String TAG = "KeyboardLayoutPicker";
private String mInputDeviceDescriptor;
@@ -73,46 +71,46 @@ public class KeyboardLayoutPicker extends ListFragment
if (mInputDeviceDescriptor != null) {
KeyboardLayout c = (KeyboardLayout)l.getItemAtPosition(position);
InputManager im = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE);
- im.setInputDeviceKeyboardLayoutDescriptor(mInputDeviceDescriptor, c.getDescriptor());
+ im.setKeyboardLayoutForInputDevice(mInputDeviceDescriptor, c.getDescriptor());
}
getActivity().finish();
}
@Override
- public Loader<List<KeyboardLayout>> onCreateLoader(int id, Bundle args) {
+ public Loader<KeyboardLayout[]> onCreateLoader(int id, Bundle args) {
return new KeyboardLayoutLoader(getActivity());
}
@Override
- public void onLoadFinished(Loader<List<KeyboardLayout>> loader,
- List<KeyboardLayout> data) {
+ public void onLoadFinished(Loader<KeyboardLayout[]> loader,
+ KeyboardLayout[] data) {
setListAdapter(new KeyboardLayoutAdapter(getActivity(), data));
}
@Override
- public void onLoaderReset(Loader<List<KeyboardLayout>> loader) {
+ public void onLoaderReset(Loader<KeyboardLayout[]> loader) {
setListAdapter(null);
}
private static final class KeyboardLayoutAdapter
extends ArrayAdapter<KeyboardLayout> {
- public KeyboardLayoutAdapter(Context context, List<KeyboardLayout> list) {
+ public KeyboardLayoutAdapter(Context context, KeyboardLayout[] list) {
super(context, android.R.layout.simple_list_item_1, list);
}
}
private static final class KeyboardLayoutLoader
- extends AsyncTaskLoader<List<KeyboardLayout>> {
+ extends AsyncTaskLoader<KeyboardLayout[]> {
public KeyboardLayoutLoader(Context context) {
super(context);
}
@Override
- public List<KeyboardLayout> loadInBackground() {
+ public KeyboardLayout[] loadInBackground() {
InputManager im = (InputManager)getContext().getSystemService(Context.INPUT_SERVICE);
- List<KeyboardLayout> list = im.getKeyboardLayouts();
- Collections.sort(list);
+ KeyboardLayout[] list = im.getKeyboardLayouts();
+ Arrays.sort(list);
return list;
}