修改默认外置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;

}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐