Closed think-android closed 9 years ago
This looks like an issue with Root.
Make sure that the following is true:
If the above doesn't work, there may still be an issue with root on your device.
If non of the above help can you provide me with the code that is causing the issue?
Hi there, thanks a lot for your answer.
The code try to do "pm uninstall ...".
It does work in the shell, SuperSU pop up for access and so on: su --context u:r:system_app:s0 -c "pm uninstall com.example.app" < /dev/null
The app is listed in superSU as well, as allowed. But it crash somethere. I'm trying to get the SuperSU logs to see what command will be fire at the end.
I post my code later (have to boot my other PC).
This is the part:
Command command = new Command(0, false, "pm uninstall " + packageName) { @Override public void commandCompleted(int arg0, int arg1) { }
@Override
public void commandOutput(int arg0, String arg1) {
Log.d("LOG_TAG",arg1);
if (arg1.toLowerCase(Locale.US).contains(String.valueOf("Failure").toLowerCase(Locale.US))
|| arg1.toLowerCase(Locale.US).contains(String.valueOf("Error").toLowerCase(Locale.US))
|| arg1.toLowerCase(Locale.US).contains(String.valueOf("denied").toLowerCase(Locale.US))
) {
try {
throw new Exception(arg1);
} catch (Exception e) {
e.printStackTrace();
}
Notification.Builder errorBuilder = new Notification.Builder(RootUninstallIntentService.this);
errorBuilder.setContentTitle(appLabel)
.setAutoCancel(true)
.setContentIntent(PendingIntent.getActivity(RootUninstallIntentService.this, 0, new Intent(), 0))
.setContentText(arg1)
.setColor(getResources().getColor(R.color.primary))
.setSmallIcon(R.drawable.noti_icon);
mNotifyManager.notify(Common.NOTI_ID_RESTORE_ERROR + ((Long) System.currentTimeMillis()).intValue(), errorBuilder.build());
}
}
@Override
public void commandTerminated(int arg0, String arg1) {
}
};
synchronized (command) {
try {
RootTools.debugMode=true;
Shell shell = RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP);
shell.add(command);
command.wait();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (RootDeniedException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
One thing I forget, the code will be call from a IntentService.
So, I got SuperSU PRO and can provide more logs now.
This code:
Command command = new Command(0, "pm uninstall " + packageName)
{
@Override
public void commandOutput(int id, String line) {
Log.d("######## ", line);
}
@Override
public void commandTerminated(int id, String reason) {
}
@Override
public void commandCompleted(int id, int exitCode) {
}
};
try {
RootTools.getShell(true).add(command);
} catch (IOException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
} catch (RootDeniedException e) {
e.printStackTrace();
}
got this superSU logs:
if I change RootTools.getShell(true).add(command); to RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command);
SuperSU says:
So, I've got your code and did some debug.
the code: RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command);
Shell.java / Worker class: ....... if (line == null) { throw new EOFException(); } ....... the EOFException will be fired, so it seems line==null
Let me do some testing on this....I'll reach back out to you...
Thank you very much. If you need more info or logs or whatever, just tell a word.
Can you try this new version?
https://drive.google.com/file/d/0B5Amguus3csDQW1zV04waEhXNkE/view?usp=sharing
Let me know if you see the same issue?
SuperSU v2.16 RootTool v3.5 Nexus 7 with Android 5.0, patched kernel (from Chainfire)
D/RootTools v3.5( 3069): Context is different than open shell, switching context... D/RootTools v3.5( 3069): Starting Root Shell! D/RootTools v3.5( 3069): Starting shell: su D/RootTools v3.5( 3069): Context: u:r:system_app:s0 D/RootTools v3.5( 3069): Timeout: 25000 D/RootTools v3.5( 3069): Closing shell D/RootTools v3.5( 3069): Read all output D/RootTools v3.5( 3069): Shell destroyed --------- beginning of crash F/libc ( 3259): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 3259 (daemonsu) E/ ( 183): ptrace attach failed: Permission denied W/System.err( 3069): com.stericson.RootTools.exceptions.RootDeniedException: Root Access Denied W/System.err( 3069): at com.stericson.RootTools.execution.Shell.(Shell.java:168)
W/System.err( 3069): at com.stericson.RootTools.execution.Shell.startRootShell(Shell.java:558)
W/System.err( 3069): at com.stericson.RootTools.execution.Shell.switchRootShellContext(Shell.java:626)
W/System.err( 3069): at com.stericson.RootTools.execution.Shell.startRootShell(Shell.java:570)
W/System.err( 3069): at com.stericson.RootTools.RootTools.getShell(RootTools.java:376)
W/System.err( 3069): at com.stericson.RootTools.RootTools.getShell(RootTools.java:393)
W/System.err( 3069): at com.think_android.apps.appmonster.base.service.RootUninstallIntentService.silentUninstall(RootUninstallIntentService.java:99)
W/System.err( 3069): at com.think_android.apps.appmonster.base.service.RootUninstallIntentService.handleActionUninstallApp(RootUninstallIntentService.java:58)
W/System.err( 3069): at com.think_android.apps.appmonster.base.service.RootUninstallIntentService.onHandleIntent(RootUninstallIntentService.java:51)
W/System.err( 3069): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
W/System.err( 3069): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 3069): at android.os.Looper.loop(Looper.java:135)
W/System.err( 3069): at android.os.HandlerThread.run(HandlerThread.java:61)