【Android TV】 遥控器Enter键无法调出软键盘

在Android TV 9.0系统中,开机向导连接WiFi时,按下遥控器的Enter键无法弹出软键盘。问题源于遥控器被识别为外部实体键盘。解决方法包括让厂商修改驱动配置或在Android层设置config,但后者可能引发插入USB键盘时也显示软键盘的副作用。

问题描述:

Android TV开机向导,进入连接wifi界面,按遥控器Enter键无法调出软键盘(Android 9.0)

分析过程:

1、getevent可读取到按键值——正常

2、dumpsys input ,dumpsys input_method发现:

4: Xiaomi RC
 Classes:0x80000023
 Path:/dev/input/event3
 Enabled: true
 Descriptor: 2e1c360bd32e2d03aa7681aaa7c
 Location:
 Controllernumber: 0
 Uniqueld: c4: ff: bc: 90: e9: 37
 Identifier: bus=0x0005, vendor=0x2717, product=0x32b9, version=0x0000
 Keylayoutfile: /system/usr/keylayout/Generic. KI
 Keycharactermapfile: /system/usr/keychars/Generic.kcm
 Configurationfile:
 Havekeyboard Layoutoverlay: false

通过http://androidxref.com/9.0.0_r3/xref/frameworks/native/services/inputflinger/EventHub.h,查看该rc device被识别成的类型,0x80000023对应的是外部实体键盘,问题就出现在这里了,遥控器被识别成usb键盘了,导致按Enter键没有弹出软键盘

/*
99 * Input device classes.
100 */
101enum {
102    /* The input device is a keyboard or has buttons. */
103    INPUT_DEVICE_CLASS_KEYBOARD      = 0x00000001,
104
105    /* The input device is an alpha-numeric keyboard (not just a dial pad). */
106    INPUT_DEVICE_CLASS_ALPHAKEY      = 0x00000002,
107
108    /* The input device is a touchscreen or a touchpad (either single-touch or multi-touch). */
109    INPUT_DEVICE_CLASS_TOUCH         = 0x00000004,
110
111    /* The input device is a cursor device such as a trackball or mouse. */
112    INPUT_DEVICE_CLASS_CURSOR        = 0x00000008,
113
114    /* The input device is a multi-touch touchscreen. */
115    INPUT_DEVICE_CLASS_TOUCH_MT      = 0x00000010,
116
117    /* The input device is a directional pad (implies keyboard, has DPAD keys). */
118    INPUT_DEVICE_CLASS_DPAD          = 0x00000020,
119
120    /* The input device is a gamepad (implies keyboard, has BUTTON keys). */
121    INPUT_DEVICE_CLASS_GAMEPAD       = 0x00000040,
122
123    /* The input device has switches. */
124    INPUT_DEVICE_CLASS_SWITCH        = 0x00000080,
125
126    /* The input device is a joystick (implies gamepad, has joystick absolute axes). */
127    INPUT_DEVICE_CLASS_JOYSTICK      = 0x00000100,
128
129    /* The input device has a vibrator (supports FF_RUMBLE). */
130    INPUT_DEVICE_CLASS_VIBRATOR      = 0x00000200,
131
132    /* The input device has a microphone. */
133    INPUT_DEVICE_CLASS_MIC           = 0x00000400,
134
135    /* The input device is an external stylus (has data we want to fuse with touch data). */
136    INPUT_DEVICE_CLASS_EXTERNAL_STYLUS = 0x00000800,
137
138    /* The input device has a rotary encoder */
139    INPUT_DEVICE_CLASS_ROTARY_ENCODER = 0x00001000,
140
141    /* The input device is virtual (not a real device, not part of UI configuration). */
142    INPUT_DEVICE_CLASS_VIRTUAL       = 0x40000000,
143
144    /* The input device is external (not built-in). */
145    INPUT_DEVICE_CLASS_EXTERNAL      = 0x80000000,
146};

Root Cause

RC被识别成hardware keyboard,此类型是由RC的driver自身config的

可以试下输入settings put secure show_ime_with_hard_keyboard 1看是否能调出软键盘

Solution

1、从根源上解决:让RC的厂商自行修改driver config,使其不被识别成hardware keyboard(最优解

2、android层解决:在对应的device的overlay下设置以下config,但是,会有副作用:插入usb keyboard时也会显示IME(软键盘)

      <!-- Default for Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD -->
       132    <bool name="def_show_ime_with_hard_keyboard">true</bool>

 

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值