Change mapping of Hardware buttons in an un-rooted device? How can I change the mapping of my un-rooted device's buttons like swapping the volume buttons? My device is a Sony Xperia E C1505
Not sure why would you want to swap those buttons but you can certainly do it using AutoInput (for Android 4.3 and above), Tasker, both are/have paid/7-day full trial, MacroDroid (free/paid) and Shortcut Launcher/ AutoShortcut (free/paid).


After installing Shortcut Launcher you would see four icons namely Shortcut 1, Shortcut 2, and so on in your app drawer. 

Tap Shortcut 1 &rarr; MacroDroid Shortcut &rarr; &lt;Add New Macro&gt; &rarr; Volume Up/Down &rarr; Volume Down &rarr; proceed &rarr; ignore Add Constraints &rarr; name it "Volume Down".
Similarly, assign a MacrDroid shortcut to Shortcut 2 but choose Volume Up and name it "Volume Up". 

Alternatively, AutoShortcut can be used in place of Shortcut Launcher. Use it in a Tasker's task to directly access a MacroDroid shortcut. It is available under Plugin.
In Tasker create an Event based profile from Plugin &rarr;  AutoInput &rarr;  Key &rarr; Configuration:


Keys: Volume Up
Key Action: Key Down

Create a task and add following actions:


Plugin &rarr; AutoInput  &rarr; Modes:


Configuration: 


Key Suppress: Enable
Keys: Volume Up

Timeout: None

App &rarr; Launch App &rarr; Shortcut 1

Create another Event based profile but for Volume Down (follow step 3)
Repeat step 4  but under sub-step 1 do Keys: Volume Down and assign the app Shortcut 2 in sub-step 2 there.


That's it. It's not completely flawless but the flaws can be ignored.

For any reasoning about related to AutoInput see my answer at Bind action to hardware key combination.