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.