giorgio.gottardi
giorgio.gottardi

Reputation: 23

read cpuinfo_cur_freq with root permission

i'm trying to read the file "cpuinfo_cur_freq" for retreiving the current working frequency of my rooted Galaxy SII. I've used some pieces of code like this

    final Runtime runtime = Runtime.getRuntime();
    try {
        runtime.exec("su"); //or whatever command.
    }

    catch (IOException e) { 
        e.printStackTrace(); 
    }

to add super user permissions to my app but still i'm not able to access that file. This is the error

W/System.err(5295): java.io.FileNotFoundException: /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq: open failed: EACCES (Permission denied)

Could you help me ?

Upvotes: 1

Views: 1151

Answers (1)

Mr.Radar
Mr.Radar

Reputation: 815

Even on rooted phones, the "su"-command won't grant superuser rights to an app (and even if it works on adb shell).

The only workaround I know (after spending some days on this issue) is to compile a custom android image (where you have to change the code of the implementation of su command) and flash this to your phone.

If you do so, keep in mind, that any app on your phone could get su rights by just executing the above code.

Upvotes: 1

Related Questions