SystemUI 上滑解锁困难容易失败的分析与解决方案

不积跬步无以至千里

一.前摘

         我们玩手机的经常的一个行为就是亮屏,向上滑动屏幕然后到解锁界面输入密码然后解锁,而今天我们遇到的这个问题就是向上尝试滑动了好几次都没有到锁屏解锁界面,这个问题会让用户非常苦恼,这不是耽误我的时间吗?因此这个问题对用户的产品体验影响还是很大的。因此我们今天就要解决这个问题。

二.分析

          这里滑动解锁的逻辑在哪呢?通过寻找代码逻辑发现代码逻辑在此处。(如果不想看分析,可以直接看最后的答案☺)

1.代码路径如下:

app/src/com/android/systemui/statusbar/phone/PanelView.java

private void endMotionEvent(MotionEvent event, float x, float y, boolean forceCancel) {
        mTrackingPointer = -1;
        if ((mTracking && mTouchSlopExceeded)
                || Math.abs(x - mInitialTouchX) > mTouchSlop
                || Math.abs(y - mInitialTouchY) > mTouchSlop
                || event.getActionMasked() == MotionEvent.ACTION_CANCEL
                || forceCancel) {
            mVelocityTracker.computeCurrentVelocity(1000);
            float vel = mVelocityTracker.getYVelocity();
            float vectorVel = (float) Math.hypot(
  

猜你喜欢

转载自blog.csdn.net/WDYShowTime/article/details/105226694