[MOD] Xposed Additions mod: More versatile buttons

Search This thread


Jan 28, 2010
Dear gerhardo,

i am really glad that i found your mod. I have the same error with the original module like others. I mean using external keyboard doesn't work., german layout isn't supported etc...

All errors (almost all :) are gone with your apk. BUUUTTTTTTT my settings aren't saved. So it renders all useless. I read that the latest version you provide doesn't save the settings. :(

Can you provide me the version before? 2015-02-22: (the one with fixed shortcut supports)
I am using Lollipop currently.

I tried to compile your project from github with android studio but i get errors :( And in general i have no idea about android studio.
Last edited:


Senior Member
Aug 23, 2013
Moto X4
Sony Xperia 5 II
Old versions are available by modifying the download URL

I have not updated the mod in a while. My changes were not accepted in the original mod and the mod author has done a lot of structure changes so it is hard to keep up.
Also, I have no phone to use the mod on. So I do not plan more updates.
Did try to build it, it was OK for me in branch 3.4.x.g4.p (that contains a few more changes than latest release).


Jan 28, 2010
Thank You!!! Didn't expect such fast response :) I tried the url like http://web.comhem.se/gerhardo/ts/ but got an error.


This version complains that xposed isn't activated. I don't know if it is because of lollipop or selinux?! Have you any more recent version than those both? With working shortcuts and saved preferences?

I don't get why the original dev didn't implement your changes?? They still aren't fixed by now in the official most recent version.

I wil try the mentioned build in android studio. If i have any questions i come back :)
Last edited:


Senior Member
Aug 23, 2013
Moto X4
Sony Xperia 5 II
The version I could build:
(The changes are in the git commits, do not know if your problems are fixed or if there are new problems)

The original author did not motivate why he did not want to merge. The pull requests are still on GitHub (will close them now).
No hard feelings for that - this is a hobby project, you do what you find fun only. Merging changes done by others can be boring. But I will not contribute.
  • Like
Reactions: wmtype


Jan 28, 2010
I guess, this was it :) I am still not really trusting that app, if the preferences will survice a reboot. But it seems so. THANK YOU

Also my Android Studio can compile it meanwhile. But you really saved me :)

One question beside: I have that feeling that xposed additions doesn't work very well while on phone call. The buttons don't react then. Android behavious in this situtations like this module isn't installed and only the "default" button combination work.

Did you notice anything in this direction?


Senior Member
Aug 23, 2013
Moto X4
Sony Xperia 5 II
One question beside: I have that feeling that xposed additions doesn't work very well while on phone call. The buttons don't react then. Android behavious in this situtations like this module isn't installed and only the "default" button combination work.

Did you notice anything in this direction?

Do not remember if this intentional or how button events information gets presented to the module, do not see anything related when browsing.
Hint: The main implementation for hooking key events is in PhoneWindowManager.

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    This post has several sections:
    * Brief description of the mod, background
    * General mod information
    * History for the change
    * TrueSmart specific hints

    Remap/add buttons on the TS: Assign keys or actions to key long press/click for single/double/triple buttons, including button combinations.

    The TS only has two HW buttons. Both are mapped in such a way that they cannot be used by apps.
    To use apps in cold and wet conditions, we need HW buttons in the apps.
    Gestures like shake etc can to some extent be used, but sensors eat battery and are not as precise as buttons.

    It is possible (with root) to change mapping of buttons to they can be used in apps, but that do not increase number of buttons (Home and Power is still needed somehow too).

    I had expected that key combinations to be configurable in the default ROM, so combinations of key presses can be translated to Android standard buttons.
    The button configuration can however be achieved in the Xposed Framework that injects hooks at a very low level in the operating system. I looked at some of the modules that provides button mapping, but they were not as complete as I would wish, so I adapted an existing module.

    The Xposed Additions module modifications is not specific to the TrueSmart, but it is likely primarily interesting for the TrueSmart.
    General mod information

    * root
    * backups recommended

    Xposed Framework installation instructions:
    Note: Xposed is included with Lokifish Mars EnSec patch.

    Xposed-additions mod:
    This has Pro features temporary unlocked

    Xposed-additions thread on xda:
    This mod will hopefully be merged to mainline by dk_zero-cool, until then the changes should be discussed here.

    Source on GitHub:

    * Custom key: I would like to use any key (especially more than available in Screen off). (workaround is to add any key, then edit shared_prefs)

    This modification is signed with other keys than the original mod, so you have to uninstall the original mod to install this mod. Actually, you may even have to uninstall this mod if the test keys are replaced with standard keys.

    The long-long press handling requires a little training to get used to. You probably do not want to have for example kill application and Camera on the same long press and Click too. I have Back on click and Home on long press and it works fine with about a second to get Home (and you get home from Recent apps too).

    Note: This module could have conflicts if used together with the GravityBox module, that adds many other useful functions like pie menu. (GravityBox also have HW mapping functionality, but that was hard to adapt to the TS needs). I had some occasional problems with mapping Volume buttons on the phone I tested with. If this is a permanent problem, the modules must be integrated tighter.
    History for the mod

    See the original thread for details of the changes to the original module

    * Synced with 3.5.2: Should work with Lollipop with enforced SELinux (this build is not tested in Lollipop though).

    * App shortcuts did not work in

    * Lollipop compatible, based on original module conversion.
    Note: you will have to recreate the App Shortcuts after upgrading. The original author used the app shortcuts implementation, but store the data slightly differently, I aligned to that.

    * Key mapping with app conditions: Add configuration to use default (screen) condition if no action set for a key click/press and repetitions combination. This makes it possible to handle app conditions as overlay to screen on.

    * Only handle key conditions that matches. This module does not handle keys and key combinations that are not configured. However, previously it handled (possibly with default handling) keys also if there were no conditions that matched. This could for instance occur if a key only had onscreen condition, the module handled the key also in offscreen. Another example if a key had an app specific condition only.

    * Invoked keys: Do not delay first down until up or long-long timeout. No big difference as (most) action first when up/timeout anyway, but for instance Volume mapped to longpress gave problem to change just one step.
    * Allow Camera, Back remap also when screen off. May be remapped in apps, even if keys make no sense by themselves
    * Only run default action for secondary in a combo, ignore default action for primary key. Order could be maintained anyway when aborted and default Long-press would give alternating longpress for both, the behavior was inconsistent.

    * Unconfigured keys did not execute default handling, which affected feedback for some situations (configured keys still require handling).
    * Callcode configuration was not overriding default action
    *Do not turnon screen for (especially default) keys, can cause wakeup problems

    * Support for app shortcuts

    * Unconfigured keys was not always executing other steps when dispatched

    * Handling of wakeup keys (screen off) other than Power
    * Gingerbread corrections (still untested)
    * Combo: Always ignore primary key

    * The key/combo handling is updated. When a new key is pressed, check if there is any action for the key. If there are no actions for a single key, delay only if there are combo events configured for the key configuration. Just zip through unconfigured keys.
    - When a new down key is pressed, the module checks if a combo is configured if there are an ongoing event
    - Primary combo keys no longer requires explicit configuration (check unconfigured primary key).
    * Easier to perform combo key actions, previously all action had to be done in the first long press timeout.
    * Preserve the original key event when default invoking. Default invoking for keys with "meta" state should work better.
    * If primary key in a combo is released, end the combo directly as if secondary is released. This changes the behavior of this mod, to be the same as the original version.
    * Modified banner for Pro version.

    This is a a relative large change to the state handling for keys, especially for combo keys. The changes should simplify maintenance of the "long-long press" handling.
    Note especially that this is untested on Gingerbread. I have no GB devices, unless there are confirmations that it is working or there are simple changes, I plan to drop GB support.

    * Extend Pro license without time limit, but kept banner "Get Pro version for more features".
    * Set defaults for "external devices" to allow, as for instance MediaTek devices requires the setting.
    * Do not await multi-key events for keys that are not configured for single key events. This avoids the processing delay for unconfigured keys. It is possible to check the unconfigured keys to, by mapping them to default or by enabling "Check Unconfigured Primary Key".

    * Pro license extended to 2014-12-31

    * Based on 3.4.1, see the main module for changes. Some of the specific changes are adapted in 3.3/3.4.
    * Reset when pressing Power is set to 15s (8s in 3.4.1).
    * Make it possible to execute multi key preferences with the complete sequence
    * Increase max for long-press/click timeouts (especially 200ms for click is too short for the TS)
    * Patch to SeekBar for long-press/click handling (to avoid printouts in the log)
    * Pro license extended to 2014-10-17

    Some changes in the mod has been aligned with the main app (most of the proposals have been rejected for inclusion).
    - Data storage is same as in main mod. So you can keep the data when switching plugins, but you must migrate your key mappings from
    - Change Click/Long press settings after update (If previously using Default or Click follow long-press)
    - Not allowing all devices by default. You have to allow external Keyboard and Gamepad for the TS.
    - Previously all keys+app launch+actions were allowed with screen-off or lock screen. Tasker Actions can be used instead
    - Last/Previous app switched to the last app in the list. The switch is now to last app not exited (i.e. switched with Recent Apps or Home, not exit to launcher with Back).
    - Multi key mapping can be done with repeating secondary only (not by repeating primary only)
    - Feedback on long-press, long-long-press for key must be enabled in the settings file: Set enable_longpress_feedback to true in /data/data/com.spazedog.xposed.additionsgb/shared_prefs/config.xml
    - The mod previously did not execute default actions if multi was set to default as it is confusing: Should it be one or many? Then what is multi long-press default? The mod follows the 3.4 beavior with one default action.
    - Keys without any actions are not pass-through directly, the handling is always delayed. The mod handling required that multi-key also had single actions (reasonable for me but rejected).
    - Unconfigured wakeup keys (like Home on some devices) must be explicitly mapped in Screen-off.

    * Long-long-long power press: vibrate to announce pending reboot
    * Avoid reboot for <= 4.1, when when toggle to closed application or launching apps.

    * Always activate the screen for Power when screen is off. Was not done for unconfigured Power keys.
    * ToggleLastApp did not start most recent activity (visible in recent apps) if it was not running. This led to confusing behavior as some apps stop running when exiting with back, other not.
    * Extend Pro license to 2014-08-31

    * Press Power for 15s to reboot the device. This is built in most ROMs (8-12s), but not the Umeox x201 series.

    Bug fixes:
    * Toggle app could reboot the device
    * Unconfigured wakeup keys (like Home) did not wakeup the device

    Bug fixes:
    * Xposed Additions did not work in some ROMs (SlimKat) "showGlobalActionsDialog" missing

    Bug fixes:
    * Certain combinations of key events could give incorrect handling for key up and even both click and long press (this could also occur in the standard module, not just the mod).
    * Additional Haptic feedback long-long press

    Bug fixes:
    * Power key required mapping to wakeup/shutdown

    2014-04-12 Based on 3.2.2

    * New keys: Double long press, triple long press and triple tap
    * Holding a button after long press trigger long press on invoked button after another 2*long press.
    Then it is possible to map Home to long press to long press, get recent apps after 3*initial down.
    * Multi-key actions only require secondary button at first press, then only primary is needed.
    * Possibility to set press/tap timeout to system default and tap to press timeout. If tap/press do not match, actions may be neither press nor tap.

    No change but clarification: Default only applies to single long-press, single click, not any other key. (how to explain double tap creates single click?)
    Email log emails to me rather than the original author.

    Bug fixes:
    * Invoked button should have the initial down time.
    * Key invoked key kept down had no limit on inject key rate (could be several per ms in the emulator).
    * Up event was not sent for secondary button, only primary.
    * If a key was unmapped, the mod still inserted a delay to relay key down. Normally this makes no difference as applications wait until confirmed long press/click anyway.

    Extra in this release:
    * Enabled all actions in all situations, i.e. app launch when screen is off, all key insertions, all special actions. This will likely be removed if app shortcuts and custom keys are supported. Launch apps when screen is off normally requires that screen is turned on manually.

    A previous modification here, with minor changes: https://plus.google.com/107109556238544025767/posts/X6786oAd7so
    While that change was fixed and enhanced, the author existing module was rewritten, so my changes had to be rewritten too.
    TrueSmart Specific

    Example of setup. I want to use this in IpBike, that can use buttons like Vol+, Vol- and Camera to control the app.

    Double Click Delay: 250ms
    Long press delay: 300ms
    All conditions are onscreen, except where noted.

    * Single:
    - Long-press: Home (long-long press is Recent apps)
    - Click: Back
    * Double:
    - Long Press: Vol-
    - Click: Last application
    * Triple:
    - Long Press: Menu (long-long press search)
    - Click: Media previous

    Home, offscreen:
    * Single:
    - Click: Power This is not needed to wake the device since, but it gives haptic feedback at wake.

    * Single:
    - Long-press: Power
    - Click: Camera
    * Double:
    - Long Press: Vol+
    - Click: No Touch (app, configured to toggle)
    * Triple:
    - Long Press: Zoom out
    - Click: Media next

    Power-Home combinations:
    * Single:
    - Long-press: Oclock
    - Click: Llama Shortcut for IpBike (GPS, screen timeout etc, then start IpBike)
    * Double:
    - Call
    - Click: Camera Zoom FX

    IpBike setup:
    Workout Next Key: Vol+
    Zoom out: Zoom out
    Zoom in: Long press zoom in
    Start Sensors: Long Press Vol-
    Start Trip: Vol-
    Lap: Back
    Screenlock: Long Press Menu
    TTS feedback: Camera
    Next Screen: Media next
    Prev Screen: Media Prev
    Updated to 3.2.8, for Android <= 4.1 that could reboot when toggling apps.
    I did not spend too much time on it, but did not find a way to activate closed apps, so it is scenario 1 above.

    ...and my TrueSmart hanged yesterday, screen off. Buttons gave haptic feedback but no action, no reboot after 15s.
    I added an extra haptic feedback for longer press to see if this long-long-long press is detected at this point. I assume so, but no idea why the device did not reboot. Maybe need some other way than using the PowerManager. The firmware is crappy.