2016-11-11 6 views
1

タッチスクリーンイベントを '/ dev/input/event1'に書きたいが、 'open( "/ dev/input/event1"、O_RDWR);'許可を得てdenied.My電話が根ざしていると私はコードでルートを取得:アンドロイドオープン( "/ 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);" 

を追加し、それが正常に動作します。

関連する問題