The following crash is rare but it does happen on different devices:
[libc.so] abort
SIGABRT
Thread:
getHistoricalRawPointerCoords: Invalid historical index 1 for MotionEvent { action=UP, id[0]=0, x[0]=810.527, y[0]=1609.98, eventTime=232287463228000, downTime=232287242045000, deviceId=3, source=TOUCHSCREEN, displayId=0, eventId=<US_SOCIAL_SECURITY_NUMBER>}
backtrace:
#00 pc 0x0000000000051ce8 /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
#01 pc 0x00000000006f9f28 /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+472)
#02 pc 0x0000000000016ea8 /apex/com.android.art/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+80)
#03 pc 0x00000000000a3090 /system/lib64/libbinder.so (android::base::LogMessage::~LogMessage()+352)
#04 pc 0x000000000002a824 /system/lib64/libinput.so (android::MotionEvent::getHistoricalRawPointerCoords(unsigned long, unsigned long) const+504)
#05 pc 0x000000000002a578 /system/lib64/libinput.so (android::MotionEvent::getHistoricalRawAxisValue(int, unsigned long, unsigned long) const+28)
#06 pc 0x0000000000048c40 /system/lib64/libinput.so (android::VelocityTracker::addMovement(android::MotionEvent const*)+496)
#07 pc 0x00000000002f0384 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+132)
#08 pc 0x0000000000c93f14 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.view.VelocityTracker.addMovement+68)
#09 pc 0x0000000000c80bb4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.view.GestureDetector.onTouchEvent+660)
#10 pc 0x0000000000c924d0 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.view.ScaleGestureDetector.onTouchEvent+176)
#11 pc 0x000000000020a2b0 /apex/com.android.art/lib64/libart.so (nterp_helper+4016)
The relevant code:
relativeLayoutFoo.setOnTouchListener((v, event) -> {
try {
if (event == null) {
return false;
} else {
//consume event
}
} catch (Exception ex) {
}
return false;
});
Could anyone offer a tip about the possible causes of this crash?
Please note "eventId=<US_SOCIAL_SECURITY_NUMBER>" in the thread. The app has nothing to do with US social security. It does not access user account information at all. It does not use any third-party ad packages.
Update [2023-05-26]
I modified the code to consume only copies of MotionEvent by using MotionEvent.obtain(event) and it has not made any difference. This appears to occur only on Android 13 devices:
What makes Android 13 so special to produce these crashes?
This crash may be related to this issue.