[cocos creator 3.8.1] Android Samsung Issue(Back Button & S-Pen Recognition Error)

Hello developer friends! I’m one of the big fans of cocos – this engine has made game development possible for me.

However, there seems to be an issue with the latest update. We were using version 3.7.2 until a few weeks ago and then upgraded our engine. After this upgrade, we’ve been continuously receiving reviews that the Samsung models’ S-Pen and back button is no longer working.

Was there any change in this aspect in the recent upgrade? We’ve been in the market for six months and never had such reviews before. It’s quite perplexing that these reviews started appearing right after the upgrade. Can you please provide any guidance on how to fix this error?

Thanks as always.

It seems like the engine is not recognizing touches from the S-Pen as regular touch inputs. And I found the answer to the back button issue. Previously, the back button press on mobile devices was recognized as “KeyCode.MOBILE_BACK”, but now it is being recognized as “KeyCode.BACKSPACE”, which is causing the problem.

've found that the issue was occurring because the touch pen events were being recognized as mouse events. Modifying the following line in the AndroidPlatform.cpp file resolved the issue. Since we’ve only released the game for mobile, I don’t think it will be a significant problem, but just to be safe, could you check if there’s any potential issue for future problems?

Original: // bool isMouseEvent = motionEvent->pointerCount > 0 && (motionEvent->pointers[0].toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || motionEvent->pointers[0].toolType == AMOTION_EVENT_TOOL_TYPE_MOUSE);

Modified: bool isMouseEvent = motionEvent->pointerCount > 0 && (motionEvent->pointers[0].toolType == AMOTION_EVENT_TOOL_TYPE_MOUSE);