anycall
Introduction: Call system service IPC from normal apps (ROOT)
Tags:
This project can run as root to call system service IPC from normal apps.
You can find the native part here
Use
This module simple demonstrates how to call the PowerManager.goToSleep(long uptimeMillis) to
turn the screen off.
Import Available on jcenter
compile 'com.ztc1997.anycall:library:x.y.z'Initializes an Anycall instance
Anycall anycall = new Anycall(this); anycall.startShell(new Anycall.StartShellListener() { @Override public void onFinish(boolean success) { output.append("Start shell success = " + success + "\n"); } });Calling the IPC method
anycall.callMethod("android.os.IPowerManager", POWER_SERVICE, "goToSleep", SystemClock.uptimeMillis(), new Anycall.CallMethodResultListener() { @Override public boolean onResult(int resultCode, Parcel reply) { output.append("Go to sleep resultCode = " + resultCode + "\n"); Log.d(TAG, "resultCode = " + resultCode); try { reply.readException(); } catch (Exception e) { e.printStackTrace(); } return true; } });Recycle resources
anycall.stopShell();
known bugs
- Because there is no time to compile the binaries, temporarily can only use in Android 6.0-7.1.
