AJ0
AJ0

Reputation: 13

Android : change permission of system files

My phone is rooted and i wrote code in my app to change file permission of system file which is located at /sys/class/leds/lcd-backlight/brightness

Runtime.getRuntime().exec("su");
Runtime.getRuntime().exec("chmod 777 /sys/class/leds/lcd-backlight/brightness");

but this code can't change the file permission of the specified file and i won't got any kind of error or exception

Upvotes: 0

Views: 1015

Answers (2)

AJ0
AJ0

Reputation: 13

Download the RootTools.jar from this link https://github.com/Stericson/RootTools/releases

Put that .jar file into your project's 'libs' directory

import com.stericson.RootTools.*;

. .

Command cmd=new Command(0,"chmod 766 /sys/class/leds/lcd-backlight/brightness");
RootShell.getShell(true).add(cmd);

Upvotes: 1

That's not how you execute su-ed commands. Please refer to http://su.chainfire.eu/ for guidance.

Upvotes: 0

Related Questions