[MOD] viper4android + MIUI 12 + Magisk 21.1

Search This thread

_mysiak_

Senior Member
Apr 1, 2009
2,457
1,451
Xiaomi Mi 10T Lite
Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

1. Locate and edit file
Code:
/data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
2. Add this text to the end of the file
Code:
magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow audioserver system_file file { execmod }'
magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow mediaserver system_file file { execmod }'
magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
3. save, reboot phone
4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled

Edit:
One user needed few extra lines to make it working on his Redmi Note 9:
Code:
magiskpolicy --live 'allow mtk_hal_audio sysfs_dt_firmware_android file { read }'
magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio process { execmem }'
magiskpolicy --live 'allow vendor_default_prop vendor_default_prop file { read }'
magiskpolicy --live 'allow mtk_hal_audio metadata_file dir { search }'
magiskpolicy --live 'allow mtk_hal_audio debugfs_ion dir { search }'
 
Last edited:

lukolh

Member
Jun 2, 2014
11
2
Thanks a lot. i just received the MIUI 12 update and i couldn't get V4A to work anymore. Followed your instruction and its working fine now. V4A is the only reason i keep my phone rooted so far. I'm on Redmi N5P
 
  • Like
Reactions: Ronny Say

Xosrov

New member
Feb 10, 2021
3
2
This fixed it, i think the problem is because of A11 because a lot of people have this problem with it.
Hopefully those people can find this post too.
Thanks
 
  • Like
Reactions: Ronny Say

hachamacha

Senior Member
Jun 15, 2010
1,368
751
Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

1. Locate and edit file
Code:
/data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
2. Add this text to the end of the file
Code:
magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow audioserver system_file file { execmod }'
magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow mediaserver system_file file { execmod }'
magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
3. save, reboot phone
4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled
Thanks very much! - I think this was my last little nit on V11.0 / OP7T Global and adding these magiskpolicy lines to the end of the file and a reboot worked fine. I used root-explorer / Edit and had to just clean up from the cut&Paste I did so it matched exactly the above.

FWIW: I'm using ViperFX as installed via Magisk repo 2.5.0.4 Legacy mode. I'd forgotten how much I liked Viper ;). - Oh - Meant to mention I was using Magisk 22.0 since it came out. No problems.

screenie.jpg
 
Last edited:

mehediceps

Member
Feb 11, 2015
20
2
Sylhet
LG Nexus 5X
Realme 7 Pro
Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

1. Locate and edit file
Code:
/data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
2. Add this text to the end of the file
Code:
magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow audioserver system_file file { execmod }'
magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow mediaserver system_file file { execmod }'
magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
3. save, reboot phone
4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled
Thanks a lot man! Huge respect. Follow your instructions and it works like charm in Samsung M21 One UI 3.0
 

leobahlis

Senior Member
Nov 14, 2018
63
5
Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

1. Locate and edit file
Code:
/data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
2. Add this text to the end of the file
Code:
magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow audioserver system_file file { execmod }'
magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow mediaserver system_file file { execmod }'
magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
3. save, reboot phone
4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled
What's difference with legacy mode on to off?( Not talking about this method to work...talking in general)
 

_mysiak_

Senior Member
Apr 1, 2009
2,457
1,451
Xiaomi Mi 10T Lite
What's difference with legacy mode on to off?( Not talking about this method to work...talking in general)
Legacy mode connects to the default audio session, which works system wide. Non-legacy mode connects to dedicated audio sessions created by each app, but some don't use/announce their audio session ID and Viper might not work in such apps (e.g. Youtube or Netflix). In theory, non-legacy mode should offer higher quality, but I wasn't able to tell the difference. Legacy mode offers better compatibility.

Btw. those who want "plug&play" experience and/or higher sound processing quality should give James DSP a try.
 

leobahlis

Senior Member
Nov 14, 2018
63
5
Legacy mode connects to the default audio session, which works system wide. Non-legacy mode connects to dedicated audio sessions created by each app, but some don't use/announce their audio session ID and Viper might not work in such apps (e.g. Youtube or Netflix). In theory, non-legacy mode should offer higher quality, but I wasn't able to tell the difference. Legacy mode offers better compatibility.

Btw. those who want "plug&play" experience and/or higher sound processing quality should give James DSP a try.
Thanks for the explanation
this james dsp works in miui selinux enforced?
 

br4t0

Member
May 1, 2021
10
2
I can't find " /data/adb/modules/ViPER4AndroidFX/post-fs-data.sh" on my phone...

I only find this folder, but its empty:

Mi 10T Lite\android\Android\data\com.pittvandewitt.viperfx\files

I dont get it :(
 

Rock-Ace

Senior Member
Mar 25, 2013
233
91
Hyderabad
Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

1. Locate and edit file
Code:
/data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
2. Add this text to the end of the file
Code:
magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow audioserver system_file file { execmod }'
magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow mediaserver system_file file { execmod }'
magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
3. save, reboot phone
4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled
Thanks , it worked for my Mi 10T Pro with MIUI 12.6 weekly channel Rom
 

Top Liked Posts

  • There are no posts matching your filters.
  • 46
    Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

    1. Locate and edit file
    Code:
    /data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
    2. Add this text to the end of the file
    Code:
    magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
    magiskpolicy --live 'allow audioserver system_file file { execmod }'
    magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
    magiskpolicy --live 'allow mediaserver system_file file { execmod }'
    magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
    magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
    magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
    magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
    magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
    magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
    3. save, reboot phone
    4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled

    Edit:
    One user needed few extra lines to make it working on his Redmi Note 9:
    Code:
    magiskpolicy --live 'allow mtk_hal_audio sysfs_dt_firmware_android file { read }'
    magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio process { execmem }'
    magiskpolicy --live 'allow vendor_default_prop vendor_default_prop file { read }'
    magiskpolicy --live 'allow mtk_hal_audio metadata_file dir { search }'
    magiskpolicy --live 'allow mtk_hal_audio debugfs_ion dir { search }'
    2
    Thank you, this fix is working for me on MIUI 12.0.6 xiaomi.eu running on viper4android 2.7.2.1
    Although I had to edit it externally on my PC since my rootexplorer keep crashing while editing on the phone.
    Btw I'm using Mi 9T Pro.
    2
    Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

    1. Locate and edit file
    Code:
    /data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
    2. Add this text to the end of the file
    Code:
    magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
    magiskpolicy --live 'allow audioserver system_file file { execmod }'
    magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
    magiskpolicy --live 'allow mediaserver system_file file { execmod }'
    magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
    magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
    magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
    magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
    magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
    magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
    3. save, reboot phone
    4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled

    Edit:
    One user needed few extra lines to make it working on his Redmi Note 9:
    Code:
    magiskpolicy --live 'allow mtk_hal_audio sysfs_dt_firmware_android file { read }'
    magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio process { execmem }'
    magiskpolicy --live 'allow vendor_default_prop vendor_default_prop file { read }'
    magiskpolicy --live 'allow mtk_hal_audio metadata_file dir { search }'
    magiskpolicy --live 'allow mtk_hal_audio debugfs_ion dir { search }'
    Cheers for this tip !
    After installing viper via magisk on my Mi 8 Dipper running official Miui 12.0.2. I uninstalled it (without trying the code first-I wasn't aware of) then I installed the 2.7.2.1 apk (should be the same I suppose) , then I found your post and added these lines. No need for me to add "few extra lines".
    And it works ! So, cheers again.
    2
    Default viper4android Magisk module doesn't work for me with SELinux enforcing. "Brute force" fix is to set SELinux to permissive, but I don't like this approach. Viper4android module should patch selinux policies during installation, but it fails for some reason. Fix is quite simple:

    1. Locate and edit file
    Code:
    /data/adb/modules/ViPER4AndroidFX/post-fs-data.sh
    2. Add this text to the end of the file
    Code:
    magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
    magiskpolicy --live 'allow audioserver system_file file { execmod }'
    magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
    magiskpolicy --live 'allow mediaserver system_file file { execmod }'
    magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
    magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
    magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
    magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
    magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
    magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
    3. save, reboot phone
    4. go to viper4android app and toggle legacy mode off and on, it should work now with legacy mode enabled

    Edit:
    One user needed few extra lines to make it working on his Redmi Note 9:
    Code:
    magiskpolicy --live 'allow mtk_hal_audio sysfs_dt_firmware_android file { read }'
    magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio process { execmem }'
    magiskpolicy --live 'allow vendor_default_prop vendor_default_prop file { read }'
    magiskpolicy --live 'allow mtk_hal_audio metadata_file dir { search }'
    magiskpolicy --live 'allow mtk_hal_audio debugfs_ion dir { search }'
    Wahoooooo! It WORKS! Finally!
    I've been trying to get Viper4android to work on my Redmi Note 9 without having SELinux in Permissive for so long! Thanks a lot! I finally find the joy of music without ever more complex prerequisites!
    1624390543308.jpg
    1
    do i need to remove musicfx app first ? im on miui 12.5 rooted
    It works without removing anything for me, so I guess that you don't have to either.