Friday, February 14, 2014

After the phone ROOT, ROOT permissions the application program fails


Why did you help look after the call chmodInput prompts Root error, the phone has root.

public static boolean execRootCommand (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 ();
Log.d (TAG, "-------------- Root ------------");
/ / 1 is success
if (process.waitFor () == 1) {
Log.d (TAG, "Root SUCCESS");
return true;
} Else {
Log.d (TAG, "Root error");
return false;
}
} Catch (Exception e) {
Log.d (TAG, "ROOT ERR:" + e.getMessage ());
return false;
} Finally {
try {
if (os! = null) {
os.close ();
}
process.destroy ();
} Catch (Exception e) {
}
}
}

public static boolean chmodInput () {
/ / Exec "chmod 666 / dev / input / *"
String command = "chmod 666 / dev / input / *";
Log.d (TAG, "chmodInput!");
return execRootCommand (command);
}


              


<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
 
public static boolean execRootCommand (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 ();
Log.d (TAG, "-------------- Root ------------");
/ / 1 is success
if (process.waitFor () == 1) {
Log.d (TAG, "Root SUCCESS");
return true;
} Else {
Log.d (TAG, "Root error");
return false;
}
} Catch (Exception e) {
Log.d (TAG, "ROOT ERR:" + e.getMessage ());
return false;
} Finally {
try {
if (os! = null) {
os.close ();
}
process.destroy ();
} Catch (Exception e) {
}
}
}

public static boolean chmodInput () {
/ / Exec "chmod 666 / dev / input / *"
String command = "chmod 666 / dev / input / *";
Log.d (TAG, "chmodInput!");
return execRootCommand (command);
}



Reply:
The landlord is not necessary to determine the return value waitFor directly catch the exception on the line.


 public static boolean execRootCommand (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 ();
Log.d (TAG, "-------------- Root ------------");
process.waitFor ();
} Catch (Exception e) {
Log.d (TAG, "ROOT ERROR:" + e.getMessage ());
return false;
} Finally {
try {
if (os! = null) {
os.close ();
}
process.destroy ();
Log.d (TAG, "ROOT SUCCESS!");
} Catch (Exception e) {
}
}
return true;
}

public static boolean chmodInput () {
/ / Exec "chmod 666 / dev / input / *"
String command = "chmod 666 / dev / input / *";
Log.d (TAG, "chmodInput!");
return execRootCommand (command);
}



Reply:
Thank you upstairs, do not judge,

No comments:

Post a Comment