0

I'm trying to make a service control the action of another application through sending touch commands. Here's how I implemented it:

                       try {
                        StringBuilder strB = new StringBuilder();
                        strB.append("input swipe ");
                        strB.append(x);
                        strB.append(" ");
                        strB.append(y);
                        strB.append(" ");
                        strB.append(x);
                        strB.append(" ");
                        strB.append(y);
                        strB.append(" ");
                        strB.append("1000\n");
                        String val = strB.toString();
                        process = Runtime.getRuntime().exec("su");
                        stream = new DataOutputStream(process.getOutputStream());
                        stream.writeBytes(val);
                        stream.writeBytes("exit \n");
                        stream.flush();
                        stream.close();
                        process.waitFor();
                        process.destroy();
                        long mem = Runtime.getRuntime().freeMemory();
                        Log.e("Memory: ", "" + mem);
                        Log.e("Final values: ", val);
                    } catch (Exception e) {
                        System.err.println("IOException: " + e.getMessage());
                    }

The service works and is able to control the application I want, but the problem is, over a period of time, the application crashes and this error pops up:

E/memtrack( 6164): Couldn’t load memtrack module (No such file o directory) E/android.os.Debug( 6164): failed to load memtrack module: -2 E/Watchdog( 2326): !@Sync 141

If anyone has any insights or solution to this, your assistance will be greatly appreciated.

beh aaron
  • 168
  • 7
  • Possible duplicate of [Couldn't load memtrack module Logcat Error](https://stackoverflow.com/questions/22629568/couldnt-load-memtrack-module-logcat-error) – Andy Developer Jun 15 '17 at 07:29
  • Thing is the first 2 error lines regarding the memtrack do not cause the crash, they keep popping up actually (I added it in just in case it might help someone in the know). The app crashes when the watchdog error comes up. – beh aaron Jun 15 '17 at 07:44

0 Answers0