修改默认外置USB键盘为法语键盘
--- a/services/core/java/com/android/server/input/PersistentDataStore.java
+++ b/services/core/java/com/android/server/input/PersistentDataStore.java
@@ -110,7 +110,10 @@ final class PersistentDataStore {
public String getCurrentKeyboardLayout(String inputDeviceDescriptor) {
InputDeviceState state = getInputDeviceState(inputDeviceDescriptor, false);
- return state != null ? state.getCurrentKeyboardLayout() : null;
+ return state != null ? state.getCurrentKeyboardLayout() : "com.android.inputdevices/com.android.inputdevices.InputDeviceReceiver/keyboard_layout_french";
+
}
public boolean setCurrentKeyboardLayout(String inputDeviceDescriptor,
@@ -183,6 +186,29 @@ final class PersistentDataStore {
mInputDevices.put(inputDeviceDescriptor, state);
setDirty();
}
+
+ // rance add here for really fix
+ if (state == null) {
+ Slog.w(InputManagerService.TAG, " setKeyboardLayouts 1 ");
+ if (true != false) {
+ Slog.w(InputManagerService.TAG, " setKeyboardLayouts 2 ");
+ String keyboardLayoutDescriptor1 = "com.android.inputdevices/com.android.inputdevices.InputDeviceReceiver/keyboard_layout_english_us";
+ String keyboardLayoutDescriptor0 = "com.android.inputdevices/com.android.inputdevices.InputDeviceReceiver/keyboard_layout_french";
+
+ if(setCurrentKeyboardLayout(inputDeviceDescriptor,
+ keyboardLayoutDescriptor1)){
+ Slog.w(InputManagerService.TAG, " setCurrentKeyboardLayout k1 ");
+ //success
+ }
+ if(setCurrentKeyboardLayout(inputDeviceDescriptor,
+ keyboardLayoutDescriptor0)){
+ Slog.w(InputManagerService.TAG, " setCurrentKeyboardLayout k0 ");
+ //success
+ }
+ save();
+ load();
+ }
+ }
return state;
}
--- a/services/core/java/com/android/server/input/PersistentDataStore.java
+++ b/services/core/java/com/android/server/input/PersistentDataStore.java
@@ -110,7 +110,10 @@ final class PersistentDataStore {
public String getCurrentKeyboardLayout(String inputDeviceDescriptor) {
InputDeviceState state = getInputDeviceState(inputDeviceDescriptor, false);
- return state != null ? state.getCurrentKeyboardLayout() : null;
+ return state != null ? state.getCurrentKeyboardLayout() : "com.android.inputdevices/com.android.inputdevices.InputDeviceReceiver/keyboard_layout_french";
+
}
public boolean setCurrentKeyboardLayout(String inputDeviceDescriptor,
@@ -183,6 +186,29 @@ final class PersistentDataStore {
mInputDevices.put(inputDeviceDescriptor, state);
setDirty();
}
+
+ // rance add here for really fix
+ if (state == null) {
+ Slog.w(InputManagerService.TAG, " setKeyboardLayouts 1 ");
+ if (true != false) {
+ Slog.w(InputManagerService.TAG, " setKeyboardLayouts 2 ");
+ String keyboardLayoutDescriptor1 = "com.android.inputdevices/com.android.inputdevices.InputDeviceReceiver/keyboard_layout_english_us";
+ String keyboardLayoutDescriptor0 = "com.android.inputdevices/com.android.inputdevices.InputDeviceReceiver/keyboard_layout_french";
+
+ if(setCurrentKeyboardLayout(inputDeviceDescriptor,
+ keyboardLayoutDescriptor1)){
+ Slog.w(InputManagerService.TAG, " setCurrentKeyboardLayout k1 ");
+ //success
+ }
+ if(setCurrentKeyboardLayout(inputDeviceDescriptor,
+ keyboardLayoutDescriptor0)){
+ Slog.w(InputManagerService.TAG, " setCurrentKeyboardLayout k0 ");
+ //success
+ }
+ save();
+ load();
+ }
+ }
return state;
}