Hong
Hong

Reputation: 18511

Crash only from Android 14 "[libinput.so] android::VelocityTracker::addMovement(long, int, int, float)"

The following crash occurs only on Android 14 devices according to the Google Play Console

[libinput.so] android::VelocityTracker::addMovement(long, int, int, float)
SIGSEGV
backtrace:
  #00  pc 0x000000000006fa64  /system/lib64/libinput.so (android::VelocityTracker::addMovement(long, int, int, float)+444)
  #01  pc 0x000000000007052c  /system/lib64/libinput.so (android::VelocityTracker::addMovement(android::MotionEvent const*)+1284)
  #02  pc 0x000000000020abd4  /system/framework/arm64/boot-framework.oat (art_jni_trampoline+132)
  #03  pc 0x0000000000715084  /system/framework/arm64/boot-framework.oat (android.view.VelocityTracker.addMovement+68)
  #04  pc 0x0000000000707754  /system/framework/arm64/boot-framework.oat (android.view.GestureDetector.onTouchEvent+660)

[![enter image description here][1]][1]

Could anyone offer a clue about the possible causes?

Update [2023-12-10]

The app uses ScaleGestureDetector. The following is relevant code. All code is in try-catch blocks that I omitted here fore brevity:

scaleGestureDetector = new ScaleGestureDetector(activity, new ScaleListener());


private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
    @Override
    public boolean onScale(@NonNull ScaleGestureDetector detector) {
        try {
            float fScaleCurrent = detector.getScaleFactor();
            if ((detector.getCurrentSpan() > (getResources().getDisplayMetrics().widthPixels + getResources().getDisplayMetrics().heightPixels))
                    && (Math.abs(fScaleCurrent - 1) < 0.03)) {

            } else {
                _fScaleFactor *= fScaleCurrent;
            }
        } catch (Exception ex) {
        }
        return true;
    }
}


_relativeLayoutCell.setOnTouchListener((v, event) -> {
MotionEvent eventCopy= MotionEvent.obtain(event);
gestureDetector.onTouchEvent(eventCopy);
                            return false;
                        });

Update 2024-01-01:

This crash remains the most frequent one even though Android 14 devices are not even among the top 5 APIs for app installations. All crashes are from Samsung devices: [![enter image description here][2]][2]

Update [2024-01-09]

I have finally seen this crash report from an OPPO model and a OnePlus model. However, the vast majority of the crashes are reported from Samsung devices. Again, only Android 14 devices have this crash. [![enter image description here][3]][3]

Update [2024-07-08] The user-perceived crash rate (the percentage of daily active users who experience at least one user-perceived crash) on Android 14 reached as high as 3.4%, more than thrice the bad behavior threshold (1.09%).

I finally found a remedy to eliminate this - - removing the code to detect double-tap using GestureDetector.

I thought the following removed code to detect double-tap was textbook standard:

final GestureDetector gestureDetector = new GestureDetector(getActivity(), new GestureDetector.SimpleOnGestureListener() {
    @Override
    public boolean onDoubleTap(@NonNull MotionEvent e) {
        try {
            //handle double-tap;
        } catch (Exception ex) {

        }
        return true;
    }
});

_relativeLayoutCell.setOnTouchListener((v, event) -> {
    final MotionEvent eventCopy = MotionEvent.obtain(event);
    executorService.execute(()->{
        gestureDetector.onTouchEvent(eventCopy);
        eventCopy.recycle();
    });
    return false;
});

Though the problem has been completely solved by avoiding detecting double-tap in this way, I am very curious why this double-tap detection code caused such an extraordinarily high perceived crash rate as reported by Google Play console only on Android 14 devices. [1]: https://i.sstatic.net/gRHcq.png [2]: https://i.sstatic.net/jJ63t.png [3]: https://i.sstatic.net/7eEEX.png

Upvotes: 0

Views: 212

Answers (0)

Related Questions