Device: OnePlus One (OPO); running CM12, is rooted, and has Xposed Framework installed.
I need to enable On-screen navigation (it disables Hardware (HW) keys and shows soft keys at the screen; like this) in OPO. I'm able to do it via Settings but my objective requires a command-line solution through shell.
(Note that this is not a development/programming question, simply an Android question.)
Objective: To disable Back(HW) key when main activity of an app (random) is in foreground, but without a reboot.
I found On-screen nav. to be a good choice which doesn't require a reboot. I'll use an automation app to trigger the disabling action.
There are manual ways to disable HW keys (by editing
.klfiles) and enabling Soft keys (by editingbuild.prop), or using tools like Xposed modules to disable or swap HW keys. But they all require reboot (soft/hard) at least once which I cannot afford.I experimented and found that when On-screen nav. is enabled, the value for
dev_force_show_navbarchanges to1from0. Similarly.button_brightnesschanges to0from255. Both names are underSettings.db(Table:secure)Also, there is no special activity assigned for Settings → Buttons(it enables On-screen nav). I used
dumpsys activity | grep mFocusedActivityto see activity related to Buttons. The result was:com.android.settings/.SubSettingsdumpsys activity activitiesordumpsys activity recentsalso has nothing more to tell here.I logged my actions using
logcatwhen enabling On-screen nav. and here is the log file.
So, how do I enable On-screen nav. through command line, irrespective of whether it requires superuser access or not?
Edit: Is there any other way using which I can achieve the objective precisely?
Only thing that comes to my mind is to use input <keyevent> but that's counterproductive to me. The other way is to trigger an Xposed module like Xposed Additions but I'm unable to use it with shell.
qemu.hw.mainkeys=0– Thomas Vos Jun 13 '15 at 13:33settingsand take a look how they did it then. – Thomas Vos Jun 13 '15 at 18:06