Delete /data/data folder
<p>My application is a system application. What I need is to perform clean data for all other applications. As far as I know, data for all application store in /data/data. Is there any way to remove all folders/files in /data/data programatically?</p>

<p>I know how to do that from adb:</p>

<pre><code>adb shell
# rm -r /data/data
</code></pre>

<p>And this is how I'm trying to do it in the code:</p>

<pre><code>Process process;
    try {
        process = Runtime.getRuntime().exec("su");
        DataOutputStream os = new DataOutputStream(process.getOutputStream());
        os.writeBytes("mount -o remount,rw -t rfs /dev/stl5 /data; \n");
        os.writeBytes("rm -r /data/data; \n");
        os.writeBytes("mount -o remount,ro -t rfs /dev/stl5 /data; \n");

        return;
    } catch (IOException e) {
        e.printStackTrace();
    }
</code></pre>
