Reboot android phone through code
<p>My aim is to clear the RAM..For tat my idea is to reboot the phone..I got this code to do tat..</p>

<pre><code> public static void rebootSU() 
    { 
        Runtime runtime = Runtime.getRuntime(); 
        Process proc = null; 
        OutputStreamWriter osw = null;    
        StringBuilder sbstdOut = new StringBuilder();   
        StringBuilder sbstdErr = new StringBuilder(); 
        String command="/system/bin/reboot";    
        try { 
            // Run Script    
            proc = runtime.exec("su");   
            osw = new OutputStreamWriter(proc.getOutputStream());  
            osw.write(command);   
            osw.flush();     
            osw.close();     
            } catch (IOException ex) { 
                ex.printStackTrace();   
                } finally {       
                    if (osw != null) {     
                        try {      
                            osw.close();   
                            } catch (IOException e) { 
                                e.printStackTrace(); 
                                }      
                            }    
                    }   
                try {     
                    if (proc != null)    
                        proc.waitFor();  
                    } catch (InterruptedException e) {  
                        e.printStackTrace(); 
                        }   
                    //sbstdOut.append(ReadBufferedReader(new InputStreamReader(proc.getInputStream()))); 
                    //sbstdErr.append(ReadBufferedReader(new InputStreamReader(proc.getErrorStream()))); 
                    if (proc.exitValue() != 0) 
                    {    

                    }        
                    } 
</code></pre>

<p>When I executed this code, following warning is shown in the logcat..I gave REBOOT permission also..When I searched about this they are telling like signing with some firmware key and all..But I am not at all aware of that..Any help would be appreciated.</p>

<p>In Logcat</p>

<pre><code>04-14 10:37:13.526: WARN/PackageManager(58): Not granting permission android.permission.REBOOT to package com.RebootTest (protectionLevel=3 flags=0x8446)
</code></pre>
