新闻详情

新闻详情

首页 / 资讯中心 / 详情

案例:Android14横屏鼠标在屏幕右侧滑动事件失效

发布时间:2026/8/31 14:29:57来源:尧图网络
案例: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()); } /**
网站建设高端定制企业官网
RELATED

相关资讯

更多精彩内容,欢迎继续阅读

较早相关资讯

最新相关资讯

性能小钢炮二手淘机攻略:从iQOO Z12 turbo看验机与选购 2026/8/31 15:05:07

性能小钢炮二手淘机攻略:从iQOO Z12 turbo看验机与选购

最近刷二手手机圈的时候,经常能看到类似“来不及逗 iQOO Z11 turbo 了,迎面向你走来的是下半年性能小钢炮 iQOO Z12 turbo”的说法,再配上“拍机堂淘机”“淘机认准极光”“二手机”这些标签,基本可以还原出一位典型淘机用户的画像…

阅读更多 →
CodeBuddy用户规则:让AI成为懂你项目的编码协作者 2026/8/31 15:05:07

CodeBuddy用户规则:让AI成为懂你项目的编码协作者

第一次用 CodeBuddy 跑一个前端改造任务,我的感受是:它确实能干活,但干出来的活儿不像我这个团队的人干的。函数命名方式不同,组件拆分粒度不同,注释风格不同,甚至连错误处理的位置,都跟我们平时…

阅读更多 →
技术博客撰写指南:从工程实践到编程学习的高效输出 2026/8/31 15:05:07

技术博客撰写指南:从工程实践到编程学习的高效输出

抱歉,我无法处理这一内容。请提供技术开发、工程实践或编程学习相关的主题材料,我可以帮你生成适合发布的技术博客正文。

阅读更多 →
Grok 4.6全面上线:从网页版到API的完整落地指南 2026/8/31 15:05:07

Grok 4.6全面上线:从网页版到API的完整落地指南

Grok 4.6 这波“全面上线”的消息,很多人的第一反应是:又一个模型更新,跟我有什么关系?但这次不太一样。从网上讨论的分布能看出来,大家关心的不只是聊天体验,还有它能不能在网页版免费入口里直接用到&…

阅读更多 →
C#上位机集成YOLO-World:OpenVINO加载ONNX开放词汇检测全流程 2026/8/31 15:05:07

C#上位机集成YOLO-World:OpenVINO加载ONNX开放词汇检测全流程

简介:本资源是一套面向C#开发者与计算机视觉初学者的OpenVINO跨平台部署实践方案,聚焦于在.NET Framework环境下实现实时开放词汇对象检测(OVD)。它完整封装了YOLO-World模型的ONNX格式推理流程,涵盖模型加载、预处理、…

阅读更多 →
Effective C++ 学习笔记 条款45 运用成员函数模板接受所有兼容类型 2026/8/31 15:00:07

Effective C++ 学习笔记 条款45 运用成员函数模板接受所有兼容类型

智能指针是行为很像指针但提供了指针所不具备之功能的对象。例如,条款13解释了标准库中的 auto_ptr 和 tr1::shared_ptr 如何能在适当的时机自动删除堆上分配的资源。STL 容器的迭代器几乎都是智能指针;你当然不能指望通过“”将一个内置指针从链表的一个…

阅读更多 →

今日资讯

本周资讯

本月资讯

看完文章仍有疑问?

联系尧图顾问,获取一对一建站咨询

立即免费咨询 📞 400-888-8888
📞