I need to mount nfs share from the system app to sdcard or to mnt folder, but
The only solution that works for me is the server binary that launched by
init as root process. I wrote simple server binary that can be connected via
LocalSocket from java side and I can send it some commands. To start server binary on system start, I added next lines to
service suservice /system/bin/suservice class core user root group root socket suservice stream 0600 system system
On java side I wrote simple library that works via callback interface and receives data from this service or error if something wrong.
Now only apps that started as
system:system can use this local socket to run root commands. User apps receive
Permission denied as expexted.
P.S. There is no need to run or keep
su binary now at all, because server binary already runs as root. I can completly remove
su binary from the system now.