(用华为P30带你看安卓)
简介:华为P30,Android 9.0(API 28)
如果你在从事安卓的开发,如果你苦于看不懂android 的输入逻辑,如果你想找到更好Android 调试工具,那么强烈建议你看完本文。如果你那么做了,你会了解dumpsys input ,你会了解 input事件的派发逻辑,你会对Android 更感兴趣;

HWELE:/ $ dumpsys inputINPUT MANAGER (dumpsys input)Input Manager State:  Interactive: true//该值会随着powerManager的唤醒状态而改变;开机使能,关机不使能  System UI Visibility: 0x8008//系统UI的可见性  Pointer Speed: 0//指针速度  Pointer Gestures Enabled: true//如果为真,指针手势启用,  Show Touches: false//Show touches feature enable/disable.开发者选项->显示触摸操作(可设置)  Pointer Capture Enabled: falseEvent Hub State:  BuiltInKeyboardId: 5//内置键盘: 不存在为-2 ,存在为 真实(fingerprint)的Id 号  Devices:    -1: Virtual//虚拟键盘设备属于合成输入设备,其 ID 为 -1,见KeyCharacterMap.VIRTUAL_KEYBOARD,      Classes: 0x40000023//类型,virtual(0x40000000)/implies keyboard, has DPAD keys(0x00000020)/(0x00000001|0x00000002)等特征      Path: //路径      Enabled: true//是否有效      Descriptor: a718a782d34bc767f4689c232d64d527998ea7fd  //该值通过sha1函数获取的唯一标识, SHA1一般指SHA-1。SHA-1(英语:Secure Hash Algorithm 1,中文名:安全散列算法1)是一种密码散列函数;标识唯一      Location:      ControllerNumber: 0      UniqueId:       Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000     /**  *1. 按键布局文件(.kl 文件)将 Linux 按键代码和坐标轴代码映射到 Android 按键代码和坐标轴代码,并指定相关的策略标记  * a. 对具有按键(包括音量、电源和耳机媒体按键等特殊按键)的内部(内置)输入设备而言是必要文件。  * b. 对其他输入设备而言是可选文件,而对特殊用途的键盘和操纵杆而言则是推荐文件。  * c. 如果没有可用的设备专属按键布局文件,则系统将改选默认文件。  *2. 按键布局文件: 将input event报的键值转换成具体键盘对应的按键供android上层使用,时通过键盘布局文件(*.kl)完成转换的。      */  KeyLayoutFile: /system/usr/keylayout/Generic.kl       /**  *1.按键字符映射文件: 按键字符映射文件(.kcm 文件)负责将 Android 按键代码与修饰符的组合映射到 Unicode 字符。系统会提供一个名为 Virtual.kcm 的特殊内置按键字符映射文件,供虚拟键盘设备使用。  *  a.如果只是告诉系统该设备仅用于特殊用途(非全键盘),那么对于具有按键的所有内部(内置)输入设备,特定于设备的按键布局文件必不可少。  * b.对于外部键盘,特定于设备的按键布局文件为可选项,并且通常根本不需要。系统会提供适用于许多外部键盘的通用按键字符映射。  *  c.如果没有提供特定于设备的按键布局文件,系统将选择默认按键布局文件。  **/KeyCharacterMapFile: /system/usr/keychars/Virtual.kcm      ConfigurationFile:      HaveKeyboardLayoutOverlay: false//有键盘布局叠加    1: minibugreport_key//设备名称      Classes: 0x00000001// 输入设备是一个键盘或有按钮。      Path: /dev/input/event3//对应的设备文件, InputReader读取数据的位置      Enabled: true      Descriptor: eb10f7ba25ce47c71082081ca1c09748fdc6fb11      Location:      ControllerNumber: 0      UniqueId:      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000      KeyLayoutFile: /system/usr/keylayout/Generic.kl      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm  //系统会提供一个名为 Generic.kcm 的特殊内置按键字符映射文件。此按键字符映射旨在支持各种标准外部键盘。      ConfigurationFile:      HaveKeyboardLayoutOverlay: false    2: soundtrigger_input_dev      Classes: 0x00000001      Path: /dev/input/event0      Enabled: true      Descriptor: 1cc715cbd334804aa45aa5df0419a5338477dc2b      Location:      ControllerNumber: 0      UniqueId:      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000      KeyLayoutFile: /system/usr/keylayout/Generic.kl      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm      ConfigurationFile:      HaveKeyboardLayoutOverlay: false    3: input_mt_wrapper      Classes: 0x00000015      Path: /dev/input/event5      Enabled: true      Descriptor: a988c03908bee014d81671ffdd909090304130b5      Location:      ControllerNumber: 0      UniqueId:      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000      KeyLayoutFile: /system/usr/keylayout/Generic.kl      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm      ConfigurationFile:      HaveKeyboardLayoutOverlay: false    4: hisi_on      Classes: 0x00000001      Path: /dev/input/event2      Enabled: true      Descriptor: 0b8880f3bfb9b8911feb1902fa64f3914ea4e084      Location: hisi_on/input0      ControllerNumber: 0      UniqueId:      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000      KeyLayoutFile: /system/usr/keylayout/Generic.kl      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm      ConfigurationFile:      HaveKeyboardLayoutOverlay: false    5: fingerprint (aka device 0 - built-in keyboard)      Classes: 0x00000001      Path: /dev/input/event4      Enabled: true      Descriptor: 94605cc6d11050165b0e47ce7d8b3046d370abd5      Location:      ControllerNumber: 0      UniqueId:      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000      KeyLayoutFile: /system/usr/keylayout/fingerprint.kl      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm      ConfigurationFile: /system/usr/idc/fingerprint.idc      HaveKeyboardLayoutOverlay: false    7: hisi_gpio_key      Classes: 0x00000001      Path: /dev/input/event1      Enabled: true      Descriptor: 2ffdd6a1bf8a4cbe7b5de5f4d03609f3340c4c76      Location:      ControllerNumber: 0      UniqueId:      Identifier: bus=0x0019, vendor=0x0000, product=0x0000, version=0x0000      KeyLayoutFile: /system/usr/keylayout/Generic.kl      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm      ConfigurationFile:      HaveKeyboardLayoutOverlay: false    16777222: hi3xxx_hi6405_card Headset Jack      Classes: 0x00000081      Path: /dev/input/event6      Enabled: true      Descriptor: 668df2f6c2189282c84c109d8682c797ca11b41c      Location: ALSA      ControllerNumber: 0      UniqueId:      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000      KeyLayoutFile: /system/usr/keylayout/Generic.kl      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm      ConfigurationFile:      HaveKeyboardLayoutOverlay: falseInput Reader State:  Device -1: Virtual    Generation: 2    IsExternal: false//一般情况为false    HasMic:     false//有麦克风:false    Sources: 0x00000301//AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_DPAD (keyboard | dpad)    KeyboardType: 2//带字母的键盘    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: false//无相关显示        OrientationAware: false  //偏向:false        HandlesKeyRepeat: false  //处理键重复: false      KeyboardType: 2      Orientation: 0//显示偏向0度,正常显示(四种情况,0度,90度,180度 270度)      KeyDowns: 0 keys currently down//该输入设备当前没有任何按键输入      MetaState: 0x0//当前是否有组合键特殊按键      DownTime: 0  Device 0: fingerprint//指纹识别设备    Generation: 8    IsExternal: false    HasMic:     false    Sources: 0x00000101//属于带按键的设备    KeyboardType: 1//不带字母的按键键盘    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: true//存在相关显示        OrientationAware: true//偏向识别:true        HandlesKeyRepeat: false      KeyboardType: 1//不带字母的按键      Orientation: 0      KeyDowns: 0 keys currently down      MetaState: 0x0      DownTime: 0  Device 1: minibugreport_key//某种特殊的按键设备    Generation: 16    IsExternal: false    HasMic:     false    Sources: 0x00000101//带按键    KeyboardType: 1//不带字母的按键    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: false        OrientationAware: false        HandlesKeyRepeat: false      KeyboardType: 1      Orientation: 0      KeyDowns: 0 keys currently down      MetaState: 0x0      DownTime: 0  Device 2: soundtrigger_input_dev    Generation: 14    IsExternal: false    HasMic:     false    Sources: 0x00000101    KeyboardType: 1    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: false        OrientationAware: false        HandlesKeyRepeat: false      KeyboardType: 1      Orientation: 0      KeyDowns: 0 keys currently down      MetaState: 0x0      DownTime: 0  Device 3: input_mt_wrapper  //触屏设备:    Generation: 317    IsExternal: false    HasMic:     false    Sources: 0x00001103(AINPUT_SOURCE_TOUCHSCREEN:0x00001002 | AINPUT_SOURCE_KEYBOARD: 0x00000101)  触屏加按键,按键可以理解屏幕底部的: 返回键,主页建和运行软件后台程序    KeyboardType: 1 //不带字母按键    Motion Ranges:      X: source=0x00001002, min=0.000, max=1079.000, flat=0.000, fuzz=0.000, resolution=0.000      Y: source=0x00001002, min=0.000, max=2339.000, flat=0.000, fuzz=0.000, resolution=0.000      PRESSURE: source=0x00001002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000      SIZE: source=0x00001002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000      TOUCH_MAJOR: source=0x00001002, min=0.000, max=2577.208, flat=0.000, fuzz=0.000, resolution=0.000      TOUCH_MINOR: source=0x00001002, min=0.000, max=2577.208, flat=0.000, fuzz=0.000, resolution=0.000      TOOL_MAJOR: source=0x00001002, min=0.000, max=2577.208, flat=0.000, fuzz=0.000, resolution=0.000      TOOL_MINOR: source=0x00001002, min=0.000, max=2577.208, flat=0.000, fuzz=0.000, resolution=0.000      ORIENTATION: source=0x00001002, min=-1.571, max=1.571, flat=0.000, fuzz=0.000, resolution=0.000   //min=-1.571, max=1.571 代表(-180,180);    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: false        OrientationAware: false        HandlesKeyRepeat: false      KeyboardType: 1//不带字母按键      Orientation: 0//无偏向      KeyDowns: 0 keys currently down      MetaState: 0x0      DownTime: 163303500601000    Touch Input Mapper (mode - direct):      Parameters:        GestureMode: multi-touch//支持多点触摸手势        DeviceType: touchScreen//触屏        AssociatedDisplay: hasAssociatedDisplay=true, isExternal=false, displayId=''        OrientationAware: true     //有偏向识别;      Raw Touch Axes://原始 触摸点坐标        X: min=0, max=1079, flat=0, fuzz=0, resolution=0        Y: min=0, max=2339, flat=0, fuzz=0, resolution=0        Pressure: min=0, max=100, flat=0, fuzz=0, resolution=0        TouchMajor: min=0, max=1, flat=0, fuzz=0, resolution=0        TouchMinor: min=0, max=1, flat=0, fuzz=0, resolution=0        ToolMajor: unknown range        ToolMinor: unknown range        Orientation: min=-90, max=90, flat=0, fuzz=0, resolution=0  //偏向正负90度        Distance: unknown range        TiltX: unknown range        TiltY: unknown range        TrackingId: min=0, max=9, flat=0, fuzz=0, resolution=0        Slot: unknown range      Calibration://校准        touch.size.calibration: geometric//几何规则        touch.pressure.calibration: physical//物理规则        touch.orientation.calibration: interpolated        touch.distance.calibration: none        touch.coverage.calibration: none      Affine Transformation:        X scale: 1.000//倍数:当前1倍        X ymix: 0.000        X offset: 0.000        Y xmix: 0.000        Y scale: 1.000//倍数:当前1倍        Y offset: 0.000      Viewport: displayId=0, orientation=0, logicalFrame=[0, 0, 1080, 2340], physicalFrame=[0, 0, 1080, 2340], deviceSize=[1080, 2340]      SurfaceWidth: 1080px      SurfaceHeight: 2340px      SurfaceLeft: 0      SurfaceTop: 0      SurfaceOrientation: 0      Translation and Scaling Factors://平移和缩放因子        XTranslate: 0.000        YTranslate: 0.000        XScale: 1.000//缩放比例1        YScale: 1.000//缩放比例1        XPrecision: 1.000//精度1.000        YPrecision: 1.000//精度1.000        GeometricScale: 1.000//几何比例1.000        PressureScale: 0.010//物理压力比例 0.010        SizeScale: 1.000        OrientationScale: 0.017//偏向比例 0.017 ,        DistanceScale: 0.000        HaveTilt: false//有倾斜,常用应用无人机;        TiltXCenter: 0.000        TiltXScale: 0.000        TiltYCenter: 0.000        TiltYScale: 0.000      Last Raw Button State: 0x00000000//无触摸      Last Raw Touch: pointerCount=0//无手指触屏      Last Cooked Button State: 0x00000000      Last Cooked Touch: pointerCount=0      Stylus Fusion://外设类似于鼠标等;        ExternalStylusConnected: false        External Stylus ID: -1        External Stylus Data Timeout: 9223372036854775807      External Stylus State:        When: 9223372036854775807        Pressure: 0.000000        Button State: 0x00000000        Tool Type: 0  Device 4: hisi_on    Generation: 10    IsExternal: false    HasMic:     false    Sources: 0x00000101    KeyboardType: 1    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: false        OrientationAware: false        HandlesKeyRepeat: false      KeyboardType: 1      Orientation: 0      KeyDowns: 0 keys currently down      MetaState: 0x0      DownTime: 163278810698000  Device 7: hisi_gpio_key    Generation: 4    IsExternal: false    HasMic:     false    Sources: 0x00000101//keyboard : AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON;    KeyboardType: 1    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: false        OrientationAware: false        HandlesKeyRepeat: false      KeyboardType: 1      Orientation: 0      KeyDowns: 0 keys currently down      MetaState: 0x0      DownTime: 162412796451000  Device 16777222: hi3xxx_hi6405_card Headset Jack    Generation: 6    IsExternal: false    HasMic:     false    Sources: 0x80000101    KeyboardType: 1    Switch Input Mapper:      SwitchValues: 0    Keyboard Input Mapper:      Parameters:        HasAssociatedDisplay: false        OrientationAware: false        HandlesKeyRepeat: false      KeyboardType: 1      Orientation: 0      KeyDowns: 0 keys currently down      MetaState: 0x0      DownTime: 0  Configuration:    ExcludedDeviceNames: []    VirtualKeyQuietTime: 0.0ms    PointerVelocityControlParameters: scale=1.000, lowThreshold=500.000, highThreshold=3000.000, acceleration=3.000    WheelVelocityControlParameters: scale=1.000, lowThreshold=15.000, highThreshold=50.000, acceleration=4.000    PointerGesture:      Enabled: true      QuietInterval: 100.0ms      DragMinSwitchSpeed: 50.0px/s      TapInterval: 150.0ms      TapDragInterval: 300.0ms      TapSlop: 20.0px      MultitouchSettleInterval: 100.0ms      MultitouchMinDistance: 15.0px      SwipeTransitionAngleCosine: 0.3      SwipeMaxWidthRatio: 0.2      MovementSpeedRatio: 0.8      ZoomSpeedRatio: 0.3      Viewports:        ViewportInternal:          Viewport: displayId=0, orientation=0, uniqueId='', logicalFrame=[0, 0, 1080, 2340], physicalFrame=[0, 0, 1080, 2340], deviceSize=[1080, 2340]        ViewportExternal:          Viewport: displayId=0, orientation=0, uniqueId='', logicalFrame=[0, 0, 1080, 2340], physicalFrame=[0, 0, 1080, 2340], deviceSize=[1080, 2340]        ViewportVirtual:Input Dispatcher State:  DispatchEnabled: 1   //按键派发使能  DispatchFrozen: 0   //派发阻塞,冻结状态: 无阻塞  FocusedApplication: name='AppWindowToken{34839f1 token=Token{24fbd98 ActivityRecord{bcffb7b u0 com.huawei.himovie/com.huawei.video.content.impl.explore.main.activity.MainActivity t1380}}}', dispatchingTimeout=5000.000ms  FocusedWindow: name='Window{5135838 u0 StatusBar}'  FocusedWindow InputChannel Name: 5135838 StatusBar (server) fd = 502  TouchStates:   Windows:    0: name='Window{7b69c30 u0 InputMethod}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81800108, type=0x000007db, layer=0, frame=[0,75][1080,2340], scale=1.000000, touchableRegion=[0,674][1080,1509], inputFeatures=0x00000000, ownerPid=4421, ownerUid=10060, dispatchingTimeout=5000.000ms    1: name='Window{287abb5 u0 NavigationBar}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x21840048, type=0x000007e3, layer=0, frame=[0,2214][1080,2340], scale=1.000000, touchableRegion=[0,2214][1080,2340], inputFeatures=0x00000000, ownerPid=1977, ownerUid=10033, dispatchingTimeout=5000.000ms    2: name='Window{5135838 u0 StatusBar}', displayId=0, paused=false, hasFocus=true, hasWallpaper=false, visible=true, canReceiveKeys=true, flags=0x81860040, type=0x000007d0, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000004, ownerPid=1977, ownerUid=10033, dispatchingTimeout=5000.000ms    3: name='Window{56833ab u0 AssistPreviewPanel}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x01000118, type=0x000007f1, layer=0, frame=[0,2340][1080,2340], scale=1.000000, touchableRegion=, inputFeatures=0x00000000, ownerPid=1977, ownerUid=10033, dispatchingTimeout=5000.000ms    4: name='Window{b3f6bae u0 DockedStackDivider}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x21840028, type=0x000007f2, layer=0, frame=[0,273][1080,381], scale=1.000000, touchableRegion=[396,273][684,315]|[0,315][1080,339]|[396,339][684,381], inputFeatures=0x00000000, ownerPid=1977, ownerUid=10033, dispatchingTimeout=5000.000ms    5: name='Window{21d7188 u0 com.huawei.himovie/com.huawei.video.content.impl.explore.main.activity.MainActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=4695, ownerUid=10028, dispatchingTimeout=5000.000ms    6: name='Window{cb7c58b u0 com.huawei.intelligent.Workspace}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81000208, type=0x00000002, layer=0, frame=[-1080,0][0,2340], scale=1.000000, touchableRegion=, inputFeatures=0x00000000, ownerPid=5398, ownerUid=10031, dispatchingTimeout=5000.000ms    7: name='Window{d21e1ff u0 com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81910120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=2204, ownerUid=10069, dispatchingTimeout=5000.000ms    8: name='Window{bdaf386 u0 com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.splash.SplashActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x818101a0, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=18723, ownerUid=10155, dispatchingTimeout=5000.000ms    9: name='Window{83be676 u0 com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=20217, ownerUid=10164, dispatchingTimeout=5000.000ms    10: name='Window{ace6d61 u0 com.tencent.mm/com.tencent.mm.plugin.profile.ui.ContactInfoUI}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=13318, ownerUid=10157, dispatchingTimeout=5000.000ms    11: name='Window{3c8f5ab u0 com.tencent.mm/com.tencent.mm.plugin.sns.ui.SnsTimeLineUI}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=13318, ownerUid=10157, dispatchingTimeout=5000.000ms    12: name='Window{c709481 u0 com.tencent.mm/com.tencent.mm.ui.LauncherUI}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=13318, ownerUid=10157, dispatchingTimeout=5000.000ms    13: name='Window{545a4d0 u0 com.huawei.browser/com.huawei.browser.BrowserMainActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=17677, ownerUid=10112, dispatchingTimeout=5000.000ms    14: name='Window{c8d134d u0 com.huawei.camera/com.huawei.camera}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810520, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=7186, ownerUid=10109, dispatchingTimeout=5000.000ms    15: name='Window{bc449fc u0 com.tencent.wework/com.tencent.wework.msg.controller.MessageListActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=7543, ownerUid=10158, dispatchingTimeout=5000.000ms    16: name='Window{b18d699 u0 com.tencent.wework/com.tencent.wework.launch.WwMainActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1080,2340], scale=1.000000, touchableRegion=[0,0][1080,2340], inputFeatures=0x00000000, ownerPid=7543, ownerUid=10158, dispatchingTimeout=5000.000ms    17: name='Window{3477dc3 u0 com.android.systemui.HwImageWallpaper}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x00010318, type=0x000007dd, layer=0, frame=[0,0][2340,2340], scale=1.000000, touchableRegion=[0,0][2340,2340], inputFeatures=0x00000000, ownerPid=1977, ownerUid=10033, dispatchingTimeout=5000.000ms  MonitoringChannels://接收所有输入事件副本的输入通道。    0: 'WindowManager (server)'    1: 'ExternalPCChannel (server)'  RecentQueue: length=10    MotionEvent(deviceId=3, source=0x00001002, action=DOWN, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, displayId=0, pointers=[0: (611.0, 1750.0)]), policyFlags=0x66000000, age=27839.4ms    MotionEvent(deviceId=3, source=0x00001002, action=MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, displayId=0, pointers=[0: (611.0, 1750.0)]), policyFlags=0x66000000, age=27812.5ms    MotionEvent(deviceId=3, source=0x00001002, action=MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, displayId=0, pointers=[0: (611.0, 1750.0)]), policyFlags=0x66000000, age=27803.5ms    MotionEvent(deviceId=3, source=0x00001002, action=MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, displayId=0, pointers=[0: (611.0, 1750.0)]), policyFlags=0x66000000, age=27777.4ms    MotionEvent(deviceId=3, source=0x00001002, action=MOVE, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, displayId=0, pointers=[0: (611.0, 1750.0)]), policyFlags=0x66000000, age=27768.4ms    MotionEvent(deviceId=3, source=0x00001002, action=UP, actionButton=0x00000000, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, displayId=0, pointers=[0: (611.0, 1750.0)]), policyFlags=0x66000000, age=27759.2ms    KeyEvent(deviceId=4, source=0x00000101, action=DOWN, flags=0x00000008, keyCode=26, scanCode=116, metaState=0x00000000, repeatCount=0), policyFlags=0x26000000, age=26683.8ms    KeyEvent(deviceId=4, source=0x00000101, action=UP, flags=0x00000008, keyCode=26, scanCode=116, metaState=0x00000000, repeatCount=0), policyFlags=0x26000000, age=26512.8ms    KeyEvent(deviceId=3, source=0x00000101, action=DOWN, flags=0x00000008, keyCode=131, scanCode=59, metaState=0x00000000, repeatCount=0), policyFlags=0x06000000, age=1993.9ms    KeyEvent(deviceId=3, source=0x00000101, action=UP, flags=0x00000008, keyCode=131, scanCode=59, metaState=0x00000000, repeatCount=0), policyFlags=0x66000000, age=1993.8ms  PendingEvent:   InboundQueue:   ReplacedKeys:   Connections:    0: channelName='WindowManager (server)', windowName='monitor', status=NORMAL, monitor=true, inputPublisherBlocked=false      OutboundQueue: 目标APP的OutboundQueue事件队列      WaitQueue: mWaitQueue 等待目标窗口的回复    1: channelName='ExternalPCChannel (server)', windowName='monitor', status=NORMAL, monitor=true, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     2: channelName='7b69c30 InputMethod (server)', windowName='Window{7b69c30 u0 InputMethod}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     3: channelName='b3f6bae DockedStackDivider (server)', windowName='Window{b3f6bae u0 DockedStackDivider}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     4: channelName='3477dc3 com.android.systemui.HwImageWallpaper (server)', windowName='Window{3477dc3 u0 com.android.systemui.HwImageWallpaper}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     5: channelName='ace6d61 com.tencent.mm/com.tencent.mm.plugin.profile.ui.ContactInfoUI (server)', windowName='Window{ace6d61 u0 com.tencent.mm/com.tencent.mm.plugin.profile.ui.ContactInfoUI}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     6: channelName='d21e1ff com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher (server)', windowName='Window{d21e1ff u0 com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     7: channelName='287abb5 NavigationBar (server)', windowName='Window{287abb5 u0 NavigationBar}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     8: channelName='56833ab AssistPreviewPanel (server)', windowName='Window{56833ab u0 AssistPreviewPanel}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     9: channelName='5135838 StatusBar (server)', windowName='Window{5135838 u0 StatusBar}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     10: channelName='pip_input_consumer (server)', windowName='?', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     11: channelName='b18d699 com.tencent.wework/com.tencent.wework.launch.WwMainActivity (server)', windowName='Window{b18d699 u0 com.tencent.wework/com.tencent.wework.launch.WwMainActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     12: channelName='cb7c58b com.huawei.intelligent.Workspace (server)', windowName='Window{cb7c58b u0 com.huawei.intelligent.Workspace}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     13: channelName='bc449fc com.tencent.wework/com.tencent.wework.msg.controller.MessageListActivity (server)', windowName='Window{bc449fc u0 com.tencent.wework/com.tencent.wework.msg.controller.MessageListActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     14: channelName='3c8f5ab com.tencent.mm/com.tencent.mm.plugin.sns.ui.SnsTimeLineUI (server)', windowName='Window{3c8f5ab u0 com.tencent.mm/com.tencent.mm.plugin.sns.ui.SnsTimeLineUI}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     15: channelName='545a4d0 com.huawei.browser/com.huawei.browser.BrowserMainActivity (server)', windowName='Window{545a4d0 u0 com.huawei.browser/com.huawei.browser.BrowserMainActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     16: channelName='83be676 com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity (server)', windowName='Window{83be676 u0 com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     17: channelName='21d7188 com.huawei.himovie/com.huawei.video.content.impl.explore.main.activity.MainActivity (server)', windowName='Window{21d7188 u0 com.huawei.himovie/com.huawei.video.content.impl.explore.main.activity.MainActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     18: channelName='c8d134d com.huawei.camera/com.huawei.camera (server)', windowName='Window{c8d134d u0 com.huawei.camera/com.huawei.camera}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     19: channelName='c709481 com.tencent.mm/com.tencent.mm.ui.LauncherUI (server)', windowName='Window{c709481 u0 com.tencent.mm/com.tencent.mm.ui.LauncherUI}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:     20: channelName='bdaf386 com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.splash.SplashActivity (server)', windowName='Window{bdaf386 u0 com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.splash.SplashActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false      OutboundQueue:       WaitQueue:   AppSwitch: not pending   Configuration:    KeyRepeatDelay: 50.0ms//密钥重复密钥间延迟,重复按键时延 50.ms;    KeyRepeatTimeout: 500.0ms//该键重复初始超时;构造重复按键超时;

基础知识:

  1. Input device classes. 列表
enum {    /* The input device is a keyboard or has buttons. */    INPUT_DEVICE_CLASS_KEYBOARD      = 0x00000001,    /* The input device is an alpha-numeric keyboard (not just a dial pad). */    INPUT_DEVICE_CLASS_ALPHAKEY      = 0x00000002,    /* The input device is a touchscreen or a touchpad (either single-touch or multi-touch). */    INPUT_DEVICE_CLASS_TOUCH         = 0x00000004,    /* The input device is a cursor device such as a trackball or mouse. */    INPUT_DEVICE_CLASS_CURSOR        = 0x00000008,    /* The input device is a multi-touch touchscreen. */    INPUT_DEVICE_CLASS_TOUCH_MT      = 0x00000010,    /* The input device is a directional pad (implies keyboard, has DPAD keys). */    INPUT_DEVICE_CLASS_DPAD          = 0x00000020,    /* The input device is a gamepad (implies keyboard, has BUTTON keys). */    INPUT_DEVICE_CLASS_GAMEPAD       = 0x00000040,    /* The input device has switches. */    INPUT_DEVICE_CLASS_SWITCH        = 0x00000080,    /* The input device is a joystick (implies gamepad, has joystick absolute axes). */    INPUT_DEVICE_CLASS_JOYSTICK      = 0x00000100,    /* The input device has a vibrator (supports FF_RUMBLE). */    INPUT_DEVICE_CLASS_VIBRATOR      = 0x00000200,    /* The input device has a microphone. */    INPUT_DEVICE_CLASS_MIC           = 0x00000400,    /* The input device is an external stylus (has data we want to fuse with touch data). */    INPUT_DEVICE_CLASS_EXTERNAL_STYLUS = 0x00000800,    /* The input device has a rotary encoder */    INPUT_DEVICE_CLASS_ROTARY_ENCODER = 0x00001000,    /* The input device is virtual (not a real device, not part of UI configuration). */    INPUT_DEVICE_CLASS_VIRTUAL       = 0x40000000,    /* The input device is external (not built-in). */    INPUT_DEVICE_CLASS_EXTERNAL      = 0x80000000,};
  1. 按键字符映射文件是由键盘类型声明和一组按键声明组成的纯文本文件。
    https://source.android.google.cn/devices/input/key-character-map-files?hl=zh-cn
    将识别以下键盘类型:
    NUMERIC:数字(12 键)键盘。
    PREDICTIVE:一种具有所有字母的键盘,但每个键有多个字母。
    ALPHA:一种具有所有字母的键盘,并且可能还带有一些数字。
    FULL:一种 PC 式全键盘。
    SPECIAL_FUNCTION:一种仅用于执行系统控制功能(而非打字)的键盘。
    ==>Generic.kcm 和 Virtual.kcm 按键字符映射都是 FULL 键盘。

  2. sha1 - 生成sha1散列值 生成唯一标识来标识设备
    #include
    int SHA1_Init(SHA_CTX * c);
    int SHA1_Update(SHA_CTX * c, const void * data,unsigned long len);
    int SHA1_Final(unsigned char * md,SHA_CTX * c);

  3. KeyLayoutFile条目中看到加载的按键映射文件,都是根据厂商ID和产品ID匹配对应文件的,例如
    vendor为0x3697,product 为0x0001,那么对应的配置文件为/system/usr/keylayout/Vendor_3697_Product_0001.kl (注:华为手机并未使用其他外设input)

  4. Input SourceS 列表

/** * Input source masks. * * Refer to the documentation on android.view.InputDevice for more details about input sources * and their correct interpretation. */enum {    /** mask */    AINPUT_SOURCE_CLASS_MASK = 0x000000ff,    /** none */    AINPUT_SOURCE_CLASS_NONE = 0x00000000,    /** button */    AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,    /** pointer */    AINPUT_SOURCE_CLASS_POINTER = 0x00000002,    /** navigation */    AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,    /** position */    AINPUT_SOURCE_CLASS_POSITION = 0x00000008,    /** joystick */    AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010,};/** * Input sources. */enum {    /** unknown */    AINPUT_SOURCE_UNKNOWN = 0x00000000,    /** keyboard */    AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON,    /** dpad */    AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON,    /** gamepad */    AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON,    /** touchscreen */    AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER,    /** mouse */    AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,    /** stylus */    AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER,    /** bluetooth stylus */    AINPUT_SOURCE_BLUETOOTH_STYLUS = 0x00008000 | AINPUT_SOURCE_STYLUS,    /** trackball */    AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,    /** touchpad */    AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,    /** navigation */    AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | AINPUT_SOURCE_CLASS_NONE,    /** joystick */    AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK,    /** rotary encoder */    AINPUT_SOURCE_ROTARY_ENCODER = 0x00400000 | AINPUT_SOURCE_CLASS_NONE,    /** any */    AINPUT_SOURCE_ANY = 0xffffff00,};
  1. Keyboard types 列表
/** * Keyboard types. * * Refer to the documentation on android.view.InputDevice for more details. */enum {    /** none */    AINPUT_KEYBOARD_TYPE_NONE = 0,    /** non alphabetic */    AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,    /** alphabetic */    AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2,};
  1. 显示的画面偏向角度的列表
/* Display orientations as defined in Surface.java and ISurfaceComposer.h. */enum {    DISPLAY_ORIENTATION_0 = 0,    DISPLAY_ORIENTATION_90 = 1,    DISPLAY_ORIENTATION_180 = 2,    DISPLAY_ORIENTATION_270 = 3};

8.主要是组合键的功能:

/** * Meta key / modifer state. */enum {    /** No meta keys are pressed. */    AMETA_NONE = 0,    /** This mask is used to check whether one of the ALT meta keys is pressed. */    AMETA_ALT_ON = 0x02,    /** This mask is used to check whether the left ALT meta key is pressed. */    AMETA_ALT_LEFT_ON = 0x10,    /** This mask is used to check whether the right ALT meta key is pressed. */    AMETA_ALT_RIGHT_ON = 0x20,    /** This mask is used to check whether one of the SHIFT meta keys is pressed. */    AMETA_SHIFT_ON = 0x01,    /** This mask is used to check whether the left SHIFT meta key is pressed. */    AMETA_SHIFT_LEFT_ON = 0x40,    /** This mask is used to check whether the right SHIFT meta key is pressed. */    AMETA_SHIFT_RIGHT_ON = 0x80,    /** This mask is used to check whether the SYM meta key is pressed. */    AMETA_SYM_ON = 0x04,    /** This mask is used to check whether the FUNCTION meta key is pressed. */    AMETA_FUNCTION_ON = 0x08,    /** This mask is used to check whether one of the CTRL meta keys is pressed. */    AMETA_CTRL_ON = 0x1000,    /** This mask is used to check whether the left CTRL meta key is pressed. */    AMETA_CTRL_LEFT_ON = 0x2000,    /** This mask is used to check whether the right CTRL meta key is pressed. */    AMETA_CTRL_RIGHT_ON = 0x4000,    /** This mask is used to check whether one of the META meta keys is pressed. */    AMETA_META_ON = 0x10000,    /** This mask is used to check whether the left META meta key is pressed. */    AMETA_META_LEFT_ON = 0x20000,    /** This mask is used to check whether the right META meta key is pressed. */    AMETA_META_RIGHT_ON = 0x40000,    /** This mask is used to check whether the CAPS LOCK meta key is on. */    AMETA_CAPS_LOCK_ON = 0x100000,    /** This mask is used to check whether the NUM LOCK meta key is on. */    AMETA_NUM_LOCK_ON = 0x200000,    /** This mask is used to check whether the SCROLL LOCK meta key is on. */    AMETA_SCROLL_LOCK_ON = 0x400000,};

更多相关文章

  1. Android(安卓)SDK中tools详解
  2. Android的国际化
  3. 重新解压打包android 根文件系统 ramdisk.img
  4. Android(安卓)XMl文件中tools前缀
  5. Android(安卓)Studio3.0新特性及安装详解
  6. android上传图片至服务器
  7. Android导出Kml
  8. Android编译过程详解(二)
  9. Android(安卓)Activity 设置全屏

随机推荐

  1. 过去三十年, RCT, DID, RDD, LE, ML, DSG
  2. 空间双重差分法(spatial DID)最新实证pap
  3. 忽略交互效应后果很严重,审稿人很生气!
  4. 妇女能顶半边天, 关于“中国女性”最新研
  5. grid实现12列栅格布局的组件并且实例圣杯
  6. unity常用方法库 持续跟新
  7. 【无偿分享】史上最全Python学习大礼包
  8. 适合财务人员的财务报表分析软件有哪些?
  9. Gateway网关过滤之后获取不到 HttpServle
  10. 干货丨DolphinDB通用计算教程