Git Product home page Git Product logo

Comments (4)

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 4, 2024

That's really weird. At least give people choice, or put documentation (the old ones still exist), or deprecate it...

I used this library to make things a bit easier, but if the minimal thing is not possible, I think I will make my own solution. It's not the hardest thing to do.
The license is also a weird thing to ask for. It's such a small code...

Anyway, I think I will make my own solution. I just need the root stuff.

from roottools.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 4, 2024

I always put credits to all libraries that I use, even in code (so that it will be easier to find) . This is my app:
https://play.google.com/store/apps/details?id=com.lb.app_manager

from roottools.

chenxiaolong avatar chenxiaolong commented on September 4, 2024

Another method is to take advantage of Java's threading wait() and notify() methods.

    public static class RootCommandRunner extends Thread {
        @Override
        public void run() {
            try {
                Command command = new Command(0, "root command here") {
                    @Override
                    public void commandOutput(int id, String line) {
                    }

                    @Override
                    public void commandCompleted(int id, int exitCode) {
                        synchronized (RootCommandRunner.this) {
                            RootCommandRunner.this.notify();
                        }
                    }

                    @Override
                    public void commandTerminated(int id, String reason) {
                        synchronized (RootCommandRunner.this) {
                            RootCommandRunner.this.notify();
                        }
                    }
                };

                RootTools.getShell(true).add(command);

                synchronized (this) {
                    wait();
                }

                // Anything here will execute after the command is finished
            } catch (IOException e) {
                e.printStackTrace();
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (TimeoutException e) {
                e.printStackTrace();
            } catch (RootDeniedException e) {
                e.printStackTrace();
            }
        }
    }

from roottools.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 4, 2024

@chenxiaolong If you want to use a wait-notifier mechanism , I think this is the correct way to do it:
http://tutorials.jenkov.com/java-concurrency/thread-signaling.html

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.