Giter Club home page Giter Club logo

Comments (11)

Stericson avatar Stericson commented on July 27, 2024

Can you provide The code you are using and logs from adb with RootTools.debug = true?

from roottools.

thuantran avatar thuantran commented on July 27, 2024

Here's the code I use roottools to run command

    public static String shellExec(String workingDir, Integer timeout,
            String... commands) {
        if (Looper.myLooper() == Looper.getMainLooper()) {
            Logcat.e("Warning execute commands on main thread\n"
                    + Arrays.toString(commands));
        }
        try {
            if (workingDir != null) {
                String[] tmp = new String[commands.length + 1];
                tmp[0] = "cd \"" + workingDir + "\"";
                System.arraycopy(commands, 0, tmp, 1, commands.length);
                commands = tmp;
            }

            final StringBuilder sb = new StringBuilder(4096);

            CommandCapture cc = new CommandCapture(0, timeout == null ? 5000
                    : timeout, commands) {
                @Override
                public void commandOutput(int id, String line) {
                    sb.append("\n").append(line);
                }
            };

            RootTools.getShell(true, ShellContext.UNTRUSTED_APP).add(cc);
            synchronized (cc) {
                try {
                    cc.wait();
                } catch (InterruptedException e) {
                }
            }
            return sb.length() > 0 ? sb.substring(1) : "";
        } catch (Exception e) {
            Logcat.e("Error execute command\n" + Arrays.toString(commands), e);
            return "";
        }
    }

And here's the relavant adb log:

11-14 11:20:11.230: D/TricksterMOD(15823): Result 0
11-14 11:20:11.323: D/OpenGLRenderer(15823): Render dirty regions requested: true
11-14 11:20:11.328: D/Atlas(15823): Validating map...
11-14 11:20:11.335: D/TricksterMOD(15823): Start checking status
11-14 11:20:11.349: D/TricksterMOD(15823): Result 0
11-14 11:20:11.364: D/RootTools v3.5(15823): Checking for Root access
11-14 11:20:11.365: D/RootTools v3.5(15823): CommandHandler not created
11-14 11:20:11.365: D/RootTools v3.5(15823): Starting Root Shell!
11-14 11:20:11.366: D/RootTools v3.5(15823): Starting shell: su
11-14 11:20:11.366: D/RootTools v3.5(15823): Context: normal
11-14 11:20:11.366: D/RootTools v3.5(15823): Timeout: 0
11-14 11:20:11.394: I/Adreno-EGL(15823): <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/24/14, 167c270, I68fa98814b
11-14 11:20:11.395: I/OpenGLRenderer(15823): Initialized EGL, version 1.4
11-14 11:20:11.408: D/OpenGLRenderer(15823): Enabling debug mode 0
11-14 11:20:17.013: D/RootTools v3.5(15823): Using Existing Root Shell!
11-14 11:20:17.013: D/RootTools v3.5(15823): Command is in position 0 currently executing command at position 0 and the number of commands is 1
11-14 11:20:17.202: D/RootTools v3.5(15823): Executing: id
11-14 11:20:17.233: D/RootTools v3.5(15823): context=u:r:init:s0
11-14 11:20:17.233: D/RootTools v3.5(15823): uid=0(root)
11-14 11:20:17.233: D/RootTools v3.5(15823): Access Given
11-14 11:20:17.245: D/RootTools v3.5(15823): Command 2 finished.
11-14 11:20:17.246: D/TricksterMOD(15823): ============checkShell============
11-14 11:20:17.248: D/RootTools v3.5(15823): CommandHandler not created
11-14 11:20:17.248: D/RootTools v3.5(15823): Using Existing Root Shell!
11-14 11:20:17.280: D/RootTools v3.5(15823): Executing: echo ${KSH_VERSION}${BASH_VERSION}
11-14 11:20:17.280: D/RootTools v3.5(15823): id
11-14 11:20:17.303: D/RootTools v3.5(15823): Command 0 finished.
11-14 11:20:17.306: D/TricksterMOD(15823): SHELL VERSION @(#)MIRBSD KSH R48 2013/08/14
11-14 11:20:17.306: D/TricksterMOD(15823): uid=0(root) gid=0(root) context=u:r:init:s0

from roottools.

ulligan avatar ulligan commented on July 27, 2024

uid=0(root) gid=0(root) context=u:r:init:s0

from roottools.

thuantran avatar thuantran commented on July 27, 2024

Is there any news on this Stericson?

from roottools.

Stericson avatar Stericson commented on July 27, 2024

Hi Thuantran,

I'm planning to look at this today. I'm sorry, I've been swamped with work...

from roottools.

Stericson avatar Stericson commented on July 27, 2024

Hey guys,

I think I fixed the issue, looks like it was a problem with ProcessBuilder.

Can you guys try this version out?

https://drive.google.com/file/d/0B5Amguus3csDQW1zV04waEhXNkE/view?usp=sharing

Also, I noticed a bug that may have been slowing the shell down, so I addressed that as well which may or may not speed up the shell (depending on use)

from roottools.

thuantran avatar thuantran commented on July 27, 2024

Sorry but I can't use the jar, it throws out this error

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.processClass(Main.java:665)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
    at com.android.dx.command.dexer.Main.access$600(Main.java:78)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:596)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
    at com.android.dx.command.dexer.Main.run(Main.java:230)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:188)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:786)
    at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:597)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:328)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
    at org.eclipse.core.internal.resources.Project.build(Project.java:124)
    at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1143)
    at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:155)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
...while parsing com/stericson/RootTools/BuildConfig.class

[2014-11-27 09:49:06 - Trickster MOD] Dx 1 error; aborting

from roottools.

Stericson avatar Stericson commented on July 27, 2024

I've updated the jar, can you use it now?

https://drive.google.com/file/d/0B5Amguus3csDQW1zV04waEhXNkE/view?usp=sharing

from roottools.

thuantran avatar thuantran commented on July 27, 2024

Still the same problem even in Android Studio as I moved my projects over. I also tried your new RootShell same issue with the jar. I will report this issue there and will double check this SELinux with plain library source until you have this fixed.

from roottools.

thuantran avatar thuantran commented on July 27, 2024

The context switching issue seems to be fixed in RootShell for me, thanks.

I don't know why but you've "blow out" your code in RootShell project so in the mean time I will report stuffs regarding the jar issue here until further notice.

from roottools.

Stericson avatar Stericson commented on July 27, 2024

Thanks!

yea, sorry about that. I was working on it...I'm horrible at commit messages.

I've pushed everything back in. So you should see all of the code.

from roottools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.