Dumpsys permission denial in java
<p>I am trying to obtain the dumpsys statistics [like dumpsys cpuinfo, dumpsys battery]. I executing these in java and writing it to a file. But I am getting, </p>

<pre><code>2012.06.20 07:32:19
Permission Denial: can't dump cpuinfo from from pid=862, uid=10040 without permission android.permission.DUMP
for all dumpsys commands.
</code></pre>

<p>I have added the permission <code>"android.permission.DUMP"</code> and <code>"android.permission.BATTERY_STATS"</code> in android.manifest. But, not obtaining the resulyPlease help as its critical.The code I use is as below where cmd contains dumpsys cpuinfo or dumpsys battery [anyone]</p>

<pre><code>Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
System.setOut(new PrintStream(new FileOutputStream("/sdcard/Monitor/"+file+".txt",false)));
System.out.println("\n\n"+sdf.format(cal.getTime()));           
Log.w("cmd-fn", cmd);
process=Runtime.getRuntime().exec(cmd);
process.waitFor();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String buffer="";

while((buffer=bufferedReader.readLine())!=null)
      {
    //fileobj.write(buffer);
    System.out.println(buffer);
    //output.write(buffer);
}
    buffer="";
    BufferedReader buffered = new BufferedReader(new InputStreamReader(process.getErrorStream()));
    while((buffer=buffered.readLine())!=null)
        {
        Log.w("exception",buffer);
        }
</code></pre>

<p>Below is my manifest entries</p>

<pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
&lt;uses-permission android:name="android.permission.DUMP" /&gt;
&lt;uses-permission android:name="android.permission.BATTERY_STATS" /&gt;
&lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
</code></pre>
