Certain keys cannot be remapped (ie: power button). For those that can be remapped you can use the suggested app directly. Writting your own app to do the same is a billion times harder than reading the manual from one that's already implemented, documented and in good shape.
I suggested the intent based on your previous log, but there're no traces on your full log that the intent was called more than once.
Sadly these kind of things require time and some knowledge. You can try to start the intent from adb with "am" and see it the setting flips it state. There're plenty of online tutorials of how to send intents using the shell.
|