Loading core/java/android/hardware/input/IInputManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.view.InputDevice; import android.view.InputEvent; import android.view.InputMonitor; import android.view.PointerIcon; import android.view.KeyCharacterMap; import android.view.VerifiedInputEvent; /** @hide */ Loading @@ -63,6 +64,8 @@ interface IInputManager { // active keyboard layout. int getKeyCodeForKeyLocation(int deviceId, in int locationKeyCode); KeyCharacterMap getKeyCharacterMap(String layoutDescriptor); // Temporarily changes the pointer speed. void tryPointerSpeed(int speed); Loading core/java/android/hardware/input/InputManager.java +28 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware.input; import static com.android.hardware.input.Flags.keyboardLayoutPreviewFlag; import android.Manifest; import android.annotation.FloatRange; import android.annotation.IntDef; Loading @@ -31,6 +33,7 @@ import android.app.ActivityThread; import android.compat.annotation.ChangeId; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.graphics.drawable.Drawable; import android.hardware.BatteryState; import android.os.Build; import android.os.Handler; Loading Loading @@ -930,6 +933,31 @@ public final class InputManager { return mGlobal.getKeyCodeForKeyLocation(deviceId, locationKeyCode); } /** * Provides a Keyboard layout preview of a particular dimension. * * @param keyboardLayout Layout whose preview is requested. If null, will return preview of * the default Keyboard layout defined by {@code Generic.kl}. * @param width Expected width of the drawable * @param height Expected height of the drawable * * NOTE: Width and height will auto-adjust to the width and height of the ImageView that * shows the drawable but this allows the caller to provide an intrinsic width and height of * the drawable allowing the ImageView to properly wrap the drawable content. * * @hide */ @Nullable public Drawable getKeyboardLayoutPreview(@Nullable KeyboardLayout keyboardLayout, int width, int height) { if (!keyboardLayoutPreviewFlag()) { return null; } PhysicalKeyLayout keyLayout = new PhysicalKeyLayout( mGlobal.getKeyCharacterMap(keyboardLayout), keyboardLayout); return new KeyboardLayoutPreviewDrawable(mContext, keyLayout, width, height); } /** * Injects an input event into the event system, targeting windows owned by the provided uid. * Loading core/java/android/hardware/input/InputManagerGlobal.java +16 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.view.Display; import android.view.InputDevice; import android.view.InputEvent; import android.view.InputMonitor; import android.view.KeyCharacterMap; import android.view.PointerIcon; import com.android.internal.annotations.GuardedBy; Loading Loading @@ -1205,6 +1206,21 @@ public final class InputManagerGlobal { } } /** * Returns KeyCharacterMap for the provided Keyboard layout. If provided layout is null it will * return KeyCharacter map for the default layout {@code Generic.kl}. */ public KeyCharacterMap getKeyCharacterMap(@Nullable KeyboardLayout keyboardLayout) { if (keyboardLayout == null) { return KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); } try { return mIm.getKeyCharacterMap(keyboardLayout.getDescriptor()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * @see InputManager#injectInputEvent(InputEvent, int, int) */ Loading core/java/android/hardware/input/KeyboardLayout.java +28 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.os.Parcel; import android.os.Parcelable; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Objects; Loading Loading @@ -230,6 +231,33 @@ public final class KeyboardLayout implements Parcelable, Comparable<KeyboardLayo return mProductId; } /** * Returns if the Keyboard layout follows the ANSI Physical key layout. */ public boolean isAnsiLayout() { for (int i = 0; i < mLocales.size(); i++) { Locale locale = mLocales.get(i); if (locale != null && locale.getCountry().equalsIgnoreCase("us") && mLayoutType != LayoutType.EXTENDED) { return true; } } return false; } /** * Returns if the Keyboard layout follows the JIS Physical key layout. */ public boolean isJisLayout() { for (int i = 0; i < mLocales.size(); i++) { Locale locale = mLocales.get(i); if (locale != null && locale.getCountry().equalsIgnoreCase("jp")) { return true; } } return false; } @Override public int describeContents() { return 0; Loading core/java/android/hardware/input/KeyboardLayoutPreviewDrawable.java 0 → 100644 +504 −0 File added.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/hardware/input/IInputManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.view.InputDevice; import android.view.InputEvent; import android.view.InputMonitor; import android.view.PointerIcon; import android.view.KeyCharacterMap; import android.view.VerifiedInputEvent; /** @hide */ Loading @@ -63,6 +64,8 @@ interface IInputManager { // active keyboard layout. int getKeyCodeForKeyLocation(int deviceId, in int locationKeyCode); KeyCharacterMap getKeyCharacterMap(String layoutDescriptor); // Temporarily changes the pointer speed. void tryPointerSpeed(int speed); Loading
core/java/android/hardware/input/InputManager.java +28 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware.input; import static com.android.hardware.input.Flags.keyboardLayoutPreviewFlag; import android.Manifest; import android.annotation.FloatRange; import android.annotation.IntDef; Loading @@ -31,6 +33,7 @@ import android.app.ActivityThread; import android.compat.annotation.ChangeId; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.graphics.drawable.Drawable; import android.hardware.BatteryState; import android.os.Build; import android.os.Handler; Loading Loading @@ -930,6 +933,31 @@ public final class InputManager { return mGlobal.getKeyCodeForKeyLocation(deviceId, locationKeyCode); } /** * Provides a Keyboard layout preview of a particular dimension. * * @param keyboardLayout Layout whose preview is requested. If null, will return preview of * the default Keyboard layout defined by {@code Generic.kl}. * @param width Expected width of the drawable * @param height Expected height of the drawable * * NOTE: Width and height will auto-adjust to the width and height of the ImageView that * shows the drawable but this allows the caller to provide an intrinsic width and height of * the drawable allowing the ImageView to properly wrap the drawable content. * * @hide */ @Nullable public Drawable getKeyboardLayoutPreview(@Nullable KeyboardLayout keyboardLayout, int width, int height) { if (!keyboardLayoutPreviewFlag()) { return null; } PhysicalKeyLayout keyLayout = new PhysicalKeyLayout( mGlobal.getKeyCharacterMap(keyboardLayout), keyboardLayout); return new KeyboardLayoutPreviewDrawable(mContext, keyLayout, width, height); } /** * Injects an input event into the event system, targeting windows owned by the provided uid. * Loading
core/java/android/hardware/input/InputManagerGlobal.java +16 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.view.Display; import android.view.InputDevice; import android.view.InputEvent; import android.view.InputMonitor; import android.view.KeyCharacterMap; import android.view.PointerIcon; import com.android.internal.annotations.GuardedBy; Loading Loading @@ -1205,6 +1206,21 @@ public final class InputManagerGlobal { } } /** * Returns KeyCharacterMap for the provided Keyboard layout. If provided layout is null it will * return KeyCharacter map for the default layout {@code Generic.kl}. */ public KeyCharacterMap getKeyCharacterMap(@Nullable KeyboardLayout keyboardLayout) { if (keyboardLayout == null) { return KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); } try { return mIm.getKeyCharacterMap(keyboardLayout.getDescriptor()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * @see InputManager#injectInputEvent(InputEvent, int, int) */ Loading
core/java/android/hardware/input/KeyboardLayout.java +28 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.os.Parcel; import android.os.Parcelable; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Objects; Loading Loading @@ -230,6 +231,33 @@ public final class KeyboardLayout implements Parcelable, Comparable<KeyboardLayo return mProductId; } /** * Returns if the Keyboard layout follows the ANSI Physical key layout. */ public boolean isAnsiLayout() { for (int i = 0; i < mLocales.size(); i++) { Locale locale = mLocales.get(i); if (locale != null && locale.getCountry().equalsIgnoreCase("us") && mLayoutType != LayoutType.EXTENDED) { return true; } } return false; } /** * Returns if the Keyboard layout follows the JIS Physical key layout. */ public boolean isJisLayout() { for (int i = 0; i < mLocales.size(); i++) { Locale locale = mLocales.get(i); if (locale != null && locale.getCountry().equalsIgnoreCase("jp")) { return true; } } return false; } @Override public int describeContents() { return 0; Loading
core/java/android/hardware/input/KeyboardLayoutPreviewDrawable.java 0 → 100644 +504 −0 File added.Preview size limit exceeded, changes collapsed. Show changes