2016-11-11 21 views
1

我想将触摸屏事件写入'/ dev/input/event1',但它运行'open(“/ dev/input/event1”,O_RDWR);'经许可denied.My手机已经根深蒂固,我获得的根与代码:android open(“/ dev/input/event1”,O_RDWR);许可被拒绝?

String apkRoot="chmod 777 "+getPackageCodePath(); 
    RootCommand(apkRoot); 

public static boolean RootCommand(String command) 
{ 
    Process process = null; 
    DataOutputStream os = null; 
    try 
    { 
     process = Runtime.getRuntime().exec("su"); 
     os = new DataOutputStream(process.getOutputStream()); 
     os.writeBytes(command + "\n"); 
     os.writeBytes("exit\n"); 
     os.flush(); 
     process.waitFor(); 
    } catch (Exception e) 
    { 
     Log.d("*** DEBUG ***", "ROOT REE" + e.getMessage()); 
     return false; 
    } finally 
    { 
     try 
     { 
      if (os != null) 
      { 
       os.close(); 
      } 
      process.destroy(); 
     } catch (Exception e) 
     { 
     } 
    } 
    Log.d("*** DEBUG ***", "Root SUC "); 
    return true; 
} 

它表明我的应用程序中获取根的确,但我感到困惑的“权限被拒绝”。

回答

1

我添加代码

apkRoot="chmod 777 /dev/input/event1"; 
RootCommand(apkRoot);" 

,它工作正常。