Support loading keyboard layout overlays from resources.
Added the concept of a keyboard layout overlay, which is
a key character map file that has "type OVERLAY".
Added support for loading keyboard layout overlays from
resources dynamically. The layouts are reloaded whenever they
are changed in the Settings application or an application
is installed. This is somewhat more aggressive than necessary
so we might want to optimize it later.
Before system-ready, the input system uses just the generic
keyboard layouts that are included on the device system image.
After system-ready, it considers the user's selected keyboard
layout overlay and attempts to load it as necessary. We need to
wait until system-ready before doing this because we need to
be in a state where it is safe to start applications or access
their resources.
Bug: 6110399
Change-Id: Iae0886d3356649b0d2440aa00910a888cedd8323
diff --git a/services/input/EventHub.h b/services/input/EventHub.h
index 51d2bac..f885f4d 100644
--- a/services/input/EventHub.h
+++ b/services/input/EventHub.h
@@ -221,6 +221,7 @@
Vector<VirtualKeyDefinition>& outVirtualKeys) const = 0;
virtual sp<KeyCharacterMap> getKeyCharacterMap(int32_t deviceId) const = 0;
+ virtual bool setKeyboardLayoutOverlay(int32_t deviceId, const sp<KeyCharacterMap>& map) = 0;
/* Control the vibrator. */
virtual void vibrate(int32_t deviceId, nsecs_t duration) = 0;
@@ -283,6 +284,7 @@
Vector<VirtualKeyDefinition>& outVirtualKeys) const;
virtual sp<KeyCharacterMap> getKeyCharacterMap(int32_t deviceId) const;
+ virtual bool setKeyboardLayoutOverlay(int32_t deviceId, const sp<KeyCharacterMap>& map);
virtual void vibrate(int32_t deviceId, nsecs_t duration);
virtual void cancelVibrate(int32_t deviceId);
@@ -321,6 +323,9 @@
VirtualKeyMap* virtualKeyMap;
KeyMap keyMap;
+ sp<KeyCharacterMap> overlayKeyMap;
+ sp<KeyCharacterMap> combinedKeyMap;
+
bool ffEffectPlaying;
int16_t ffEffectId; // initially -1