问题背景
滑动测试,单手握持测试机,大拇指在测试机桌面做左右滑屏操作,偶现滑屏不成功。
问题分析步骤
(1)首先根据“视频”或者“log中关于问题现象的关键log”确定“问题发生的大致时间段”和“问题发生时的具体操作”大致方法如下:
问题发生时间:09-16 10:16:41.834249 到 09-16 10:16:53.891858
问题现象:6组左右划操作,第3次左划和第6次左划不成功
手机按下和抬起操作的main_log关键字:[MotionEvent] ViewRootImpl windowName
(2)根据测试的实际操作和相关流程(这里是在桌面左右滑动)的差异去判断问题出现的原因;
报点报线正常,说明系统接收到了滑动事件,从视频和log分析可知,是由于滑动长度未满足 workspace 的条件,所以Input未下发 "切换workspace" 的请求,属于正常现象;(Launcher.Workspace:在手机桌面左右滑动时的几个界面,用于放置桌面的app图标)
main_log分析如下,截取了复现问题的main_log:
//Input检测到用户在桌面滑动了3次
09-16 10:16:49.777847 2195 2195 D Input: [MotionEvent] ViewRootImpl windowName 'com.ui.home/com.ui.home.launcher.Launcher', { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=208167702, downTime=208167702, phoneEventTime=10:16:49.775 } moveCount:009-16 10:16:49.893512 2195 2195 D Input: [MotionEvent] ViewRootImpl windowName 'com.ui.home/com.ui.home.launcher.Launcher', { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=208167818, downTime=208167702, phoneEventTime=10:16:49.892 } moveCount:509-16 10:16:50.344652 2195 2195 D Input: [MotionEvent] ViewRootImpl windowName 'com.ui.home/com.ui.home.launcher.Launcher', { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=208168269, downTime=208168269, phoneEventTime=10:16:50.343 } moveCount:009-16 10:16:50.442332 2195 2195 D Input: [MotionEvent] ViewRootImpl windowName 'com.ui.home/com.ui.home.launcher.Launcher', { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=208168367, downTime=208168269, phoneEventTime=10:16:50.440 } moveCount:409-16 10:16:50.894127 2195 2195 D Input: [MotionEvent] ViewRootImpl windowName 'com.ui.home/com.ui.home.launcher.Launcher', { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=208168818, downTime=208168818, phoneEventTime=10:16:50.891 } moveCount:009-16 10:16:51.027145 2195 2195 D Input: [MotionEvent] ViewRootImpl windowName 'com.ui.home/com.ui.home.launcher.Launcher', { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=208168951, downTime=208168818, phoneEventTime=10:16:51.024 } moveCount:7
//桌面workspace切换了3次,1表示切换到第1页,0表示切换到第0页
09-16 10:16:50.206216 2195 2195 D ScreenView_Workspace: setCurrentScreenInner:109-16 10:16:50.722712 2195 2195 D ScreenView_Workspace: setCurrentScreenInner:009-16 10:16:51.372863 2195 2195 D ScreenView_Workspace: setCurrentScreenInner:0
上述log第3次切换,是从第0页切换到第0页,说明Workspace有切换的操作,只是因为滑动的长度较短,系统判定成了本页内滑动。
log关键字
【main_log关键字】
ScreenView_Workspace: onIntercept ViewGroup是否拦截下发的滑动事件;
ScreenView_Workspace: not intercept 不拦截
ScreenView_Workspace: on touch up 触摸事件结束
ScreenView_Workspace: snapByVelocity 根据速度切换桌面
ScreenView_Workspace: startScroll 滑动操作起点的X坐标
ScreenView_Workspace: setCurrentScreenInner:1 设置桌面当前工作空间
【控制页面滑动的主要类】
PagedView.java:/packages/apps/Launcher3/src/com/android/launcher3/PagedView.java
参考文档
Android滑屏介绍:
https://blog.csdn.net/qinjuning/article/details/7247126
http://t.zoukankan.com/seven1979-p-4371555.html
launcher3源码流程解析(系列文章):
https://blog.csdn.net/picasso_l/article/details/69568486
https://blog.csdn.net/Picasso_L/article/details/69949132
https://blog.csdn.net/Picasso_L/article/details/70140694
关于View的学习点:
https://blog.csdn.net/subaohao/article/details/44355849
桌面滑动代码流程解析:https://blog.csdn.net/baidu_nod/article/details/38443499
laucher之workspace滑动:https://blog.csdn.net/u013899706/article/details/77940572
workspace详细代码功能解析:https://www.bbsmax.com/A/B0zqMvaXzv/