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 → MacroDroid Shortcut → <Add New Macro>
→ Volume Up/Down → Volume Down → proceed → ignore Add Constraints → name it "Volume Down
".
2. 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 → AutoInput → Key → Configuration:
- Keys: Volume Up
- Key Action: Key Down
Create a task and add following actions:
Plugin → AutoInput → Modes:
Configuration:
- Key Suppress: Enable
- Keys: Volume Up
Timeout: None
App → Launch App → 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 combinationBind action to hardware key combination.