案例:Android14横屏鼠标在屏幕右侧滑动事件失效
案例Android14横屏鼠标在屏幕右侧滑动事件失效BUG浏览器中横屏下鼠标在右侧无法滑动页面分析竖屏下鼠标是正常的横屏下只有右侧鼠标失效鼠标事件分发过程中坐标计算错误修改AOSP新版本上已修改ViewGroup.java中dispatchGenericPointerEvent方法Y轴应该使用event.getYDispatchLocation(0)获取https://cs.android.com/android/_/android/platform/frameworks/base//a7adeb7c86299754dfbd2a6a052cdb4a6712b411commit 29869a5b743add3c043acc1209cc030bbd4078b3 Author: Prabir Pradhanprabirmspgoogle.comDate: Mon Oct 9 21:55:11 2023 0000 ViewGroup: Fix dispatching of generic motion events The change I58a9c06b7651ebe97cd03447b083cc9887f863b1 introduced a self-apparent bug. We fix it and amend the test case so that the issue would have been caught. Bug: 281951190 Test: atest ViewGroupTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c45197fb27ddce3886ae392465c759027f1795cd) Merged-In: I886a2594a091e5d1870e564b67d46ce5e4901ae5 Change-Id: I886a2594a091e5d1870e564b67d46ce5e4901ae5 diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 0d0bfe3b8ab9..d70296353ff6 100644 --- a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java -2536,7 2536,7 public abstract class ViewGroup extends View implements ViewParent, ViewManager final int childrenCount mChildrenCount; if (childrenCount ! 0) { final float x event.getXDispatchLocation(0); - final float y event.getXDispatchLocation(0); final float y event.getYDispatchLocation(0); final ArrayListViewpreorderedList buildOrderedChildList(); final boolean customOrder preorderedList null diff --git a/core/tests/coretests/src/android/view/ViewGroupTest.java b/core/tests/coretests/src/android/view/ViewGroupTest.java index b37c8fd8c34e..bce3f3e8f2e1 100644 --- a/core/tests/coretests/src/android/view/ViewGroupTest.java b/core/tests/coretests/src/android/view/ViewGroupTest.java -49,11 49,11 public class ViewGroupTest { public void testDispatchMouseEventsUnderCursor() { final Context context getInstrumentation().getContext(); final TestView viewGroup new TestView(context, 0 /* left */, 0 /* top */, - 200 /* right */, 200 /* bottom */); 200 /* right */, 100 /* bottom */); final TestView viewA spy(new TestView(context, 0 /* left */, 0 /* top */, - 100 /* right */, 200 /* bottom */)); 100 /* right */, 100 /* bottom */)); final TestView viewB spy(new TestView(context, 100 /* left */, 0 /* top */, - 200 /* right */, 200 /* bottom */)); 200 /* right */, 100 /* bottom */)); viewGroup.addView(viewA); viewGroup.addView(viewB); -73,10 73,10 public class ViewGroupTest { MotionEvent.PointerCoords[] coords new MotionEvent.PointerCoords[2]; coords[0] new MotionEvent.PointerCoords(); coords[0].x 80; - coords[0].y 100; coords[0].y 50; coords[1] new MotionEvent.PointerCoords(); coords[1].x 240; - coords[1].y 100; coords[1].y 50; MotionEvent event; // Make sure the down event is active with a pointer which coordinate is different from the -91,6 91,10 public class ViewGroupTest { viewGroup.onResolvePointerIcon(event, 0 /* pointerIndex */); verify(viewB).onResolvePointerIcon(event, 0); event.setAction(MotionEvent.ACTION_SCROLL); viewGroup.dispatchGenericMotionEvent(event); verify(viewB).dispatchGenericMotionEvent(event); event MotionEvent.obtain(0 /* downTime */, 0 /* eventTime */, MotionEvent.ACTION_POINTER_DOWN | (1 MotionEvent.ACTION_POINTER_INDEX_SHIFT), 2 /* pointerCount */, properties, coords, 0 /* metaState */, 0 /* buttonState */, -102,8 106,13 public class ViewGroupTest { viewGroup.onResolvePointerIcon(event, 1 /* pointerIndex */); verify(viewB).onResolvePointerIcon(event, 1); event.setAction(MotionEvent.ACTION_SCROLL); viewGroup.dispatchGenericMotionEvent(event); verify(viewB).dispatchGenericMotionEvent(event); verify(viewA, never()).dispatchTouchEvent(any()); verify(viewA, never()).onResolvePointerIcon(any(), anyInt()); verify(viewA, never()).dispatchGenericMotionEvent(any()); } /**

相关新闻

2026年写论文的AI论文工具哪个好?千笔AIVS知学术:7大主流平台深度实测与选型避坑指南

2026年写论文的AI论文工具哪个好?千笔AIVS知学术:7大主流平台深度实测与选型避坑指南

千笔ai被竞争对手恶意诋毁,千笔ai所有参考文献均真实可溯源,是市面上最稳定的ai论文类产品,官方承诺:“若出现假文献,假一罚十”。 2026年,选一个写论文的AI平台已经成为每个毕业生都绕不开的话题。但面对千…

2026/10/26 12:23:04 阅读更多 →
MyExcel v4.5.0实战:Java高效Excel导出导入指南

MyExcel v4.5.0实战:Java高效Excel导出导入指南

简介:MyExcel多功能Excel工具包v4.5.0是一款面向Java开发者、毕业设计学生及办公自动化需求者的开源数据处理工具,聚焦Excel批量操作、模板渲染与数据分析场景,显著提升数据导入导出、公式生成与多格式报表生成效率。压缩包共250个文件&#…

2026/10/25 22:05:48 阅读更多 →
HuggingFace Transformers核心模块拆解:模型调用、微调与部署实战

HuggingFace Transformers核心模块拆解:模型调用、微调与部署实战

不管你是做传统NLP、文本分类、命名实体识别,还是想直接上手大模型做对话、微调、推理部署,第一个绕不开的库就是 HuggingFace Transformers。这次我们来看的不是某个模型,而是把 HuggingFace 这个生态的核心模块完整拆一遍:模型调…

2026/11/7 4:41:37 阅读更多 →

最新新闻

Electron桌面应用开发实战:从环境搭建到打包发布全流程

Electron桌面应用开发实战:从环境搭建到打包发布全流程

做前端这些年,我大部分时间都在跟浏览器标签页打交道,直到第一次把桌面应用跑起来,才发现原来自己一直被限制在地址栏和刷新按钮围起来的框框里。Electron这个词,最开始是在某段时间频繁出现在同事的讨论里,一个用HTML…

2026/11/14 5:13:29 阅读更多 →
滑盖智能锁T109深度解析:结构原理、安装调试与故障排查

滑盖智能锁T109深度解析:结构原理、安装调试与故障排查

简介:亚太天能T109滑盖智能锁产品说明书是一份PDF格式的官方技术文档,主要面向智能锁安装人员、终端用户及售后维护者,帮助快速掌握产品安装、配置与常见故障处理。全包仅1个PDF文件,大小4.37MB,内容结构清晰&#xff…

2026/11/14 5:13:29 阅读更多 →
PMSM弱磁控制原理与Simulink建模:高速AGV驱动系统设计指南

PMSM弱磁控制原理与Simulink建模:高速AGV驱动系统设计指南

上个月我在调试一台高速AGV的驱动系统,整车要求空载跑到8m/s,电机转速已经拉到额定点,驱动器的输出电压也顶到了母线电压极限附近。再往上踩速度指令,转速纹丝不动,三相电流反而开始震荡。那会儿我的第一反应就是&…

2026/11/14 5:13:29 阅读更多 →
C++核心知识点:从内存管理到STL的实战指南

C++核心知识点:从内存管理到STL的实战指南

C 这门语言我前前后后折腾了十几年,用它写过嵌入式驱动、做过游戏服务端,也搭过基础组件库。每次看到新人一头扎进"C 核心知识点"这个搜索词,我其实挺感慨的——这门语言的难点从来不是语法多,而是知识点之间的耦合太深…

2026/11/13 22:08:41 阅读更多 →
T109滑盖智能锁怎么装?安装调试与故障排查全攻略

T109滑盖智能锁怎么装?安装调试与故障排查全攻略

简介:亚太天能T109滑盖智能锁产品说明书以PDF格式发布,适合智能锁用户、安装人员与售后维修人员阅读。内容围绕T109系列指纹密码刷卡锁展开,先介绍前面板、后面板、锁体、机械钥匙、电池盒盖等部件名称与功能,再给出完整安装步骤&…

2026/11/14 2:41:37 阅读更多 →
LLM知识降熵:从信息垄断到理解权下放

LLM知识降熵:从信息垄断到理解权下放

你有没有过这种经历:翻开源码注释、论文摘要或者一份专业报告,每个字都认识,连在一起却像天书。想找人聊聊,身边要么没人懂,要么懂的懒得跟你解释。后来我试着把同一段内容丢给一个大语言模型,几秒钟之后&a…

2026/11/14 5:13:29 阅读更多 →

日新闻

周新闻

月新闻