Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging system file permission
    primarykey
    data
    text
    <p>I've really tried everything:</p> <ul> <li><a href="https://nethack-android.googlecode.com/svn-history/r430/trunk/slashem-0.0.7E7F3/sys/android/NetHackApp/src/com/slashemff/NetHackFileHelpers.java" rel="nofollow noreferrer">NetHackFileHelpers</a></li> <li><a href="https://stackoverflow.com/questions/11408154/how-to-get-file-permission-mode-programmatically-in-java">How to get File Permission Mode programmatically in Java</a></li> <li><a href="https://stackoverflow.com/questions/8412384/change-file-permission-in-application">Change file permission in application</a></li> <li><a href="https://stackoverflow.com/questions/7129144/mount-r-w-system-in-android-application-to-edit-read-only-files">Mount R/W system in android application to edit Read Only files</a></li> </ul> <p>Now, suppose I've remounted as root, and therefore <code>RW</code> permission on file system (Android version 2.3.7):</p> <pre><code>Process process = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(process.getOutputStream()); os.writeBytes("chmod -c 0777 /system/etc/customization/settings/com/android/browser/custom_settings.xml\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); </code></pre> <p>or:</p> <pre><code>Process process = Runtime.getRuntime().exec("su -c \"/system/etc/customization/settings/com/android/browser/custom_settings.xml\""); </code></pre> <p>or: </p> <pre><code>Class&lt;?&gt; fileUtils = Class.forName("android.os.FileUtils"); Method setPermissions = fileUtils.getMethod("setPermissions", String.class, int.class, int.class, int.class); int a = (Integer) setPermissions.invoke(null, "/system/etc/customization/settings/com/android/browser/custom_settings.xml", 0777, -1, -1); </code></pre> <p>The behaviour is the same: nothing happens. Whereas if I <code>chmod</code> from adb shell works fine. How can I change the permissions of that file from within my code?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload