Android requesting superuser command gingerbread 2.3
So I am making an app that request superuser permission and then on a button click will reboot the phone. This command below works fine in [a modified version of] android 2.2 api level 8 but when trying to use [a modified version of] gin开发者_C百科gerbread 2.3 api level 9 or 10 it will not open superuser pop up and will not reboot phone any reason why? Here is the code I have been using with 2.2
public void onClick(View v) {
switch (v.getId()) {
case R.id.reboot_button:
try {
Runtime.getRuntime().exec(new String[]{"/system/bin/su","-c","reboot now"});
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
The specific hack that was used to gain superuser access in 2.2 level 8 and below (rageagainstthecage was I believe the commonly used name) was closed in Gingerbread (this bit me too).
EDIT: @Chris Stratton pointed out something, and I totally forgot to mention it. Firmware upgrades typically wipe out the hooks put in place by most of the superuser exploits such as rageagainstthecage). You generally have to re-run the original tool that granted you su
permissions after each firmware upgrade.
If you never had to run a tool to gain su
access then I expect your new firmware build is simply missing the su
binary and you may have to copy it into place by hand.
精彩评论