Java 类android.os.IPowerManager 实例源码
项目:Scalpel_Android
文件:Sca.java
private void doStart() {
IBinder scaBinder = ServiceManager.getService("sca");
log("scaBinder:" + scaBinder);
if (scaBinder != null) {
sent(new Feedback(Response.START_FAILURE_ALREADY_STARTED, "Sca server already started."));
return;
}
ServiceManager.addService(ScaContext.SCA_SERVICE, ScaHookService.get(), true);
ServiceManager.addService(ScaContext.SCA_TELEPHONY_SERVICE, new TelephonyManagerProxy(), true);
ServiceManager.addService(ScaContext.SCA_POWER_SERVICE, new PowerManagerProxy().asBinder(), true);
com.nick.commands.sca.IScaService me =
com.nick.commands.sca.IScaService.Stub.asInterface(ServiceManager.getService(ScaContext.SCA_SERVICE));
ITelephony telephony = ITelephony.Stub.asInterface(ServiceManager.getService(ScaContext.SCA_TELEPHONY_SERVICE));
IPowerManager power = IPowerManager.Stub.asInterface(ServiceManager.getService(ScaContext.SCA_POWER_SERVICE));
log("Sca service:" + me);
log("Sca phone service:" + telephony);
log("Sca power service:" + power);
if (me == null) {
sent(new Feedback(Response.START_FAILURE_SYSTEM_ERR, "Sca server startup failure, have you installed?"));
return;
}
sent(new Feedback(Response.START_OK, "Sca server startup success."));
ServiceKeeper keeper = new ServiceKeeper();
keeper.keep();
}
项目:PhoneProfiles
文件:CmdGoToSleep.java
private static boolean run() {
try {
IPowerManager adapter = IPowerManager.Stub.asInterface(ServiceManager.getService("power"));
adapter.goToSleep(SystemClock.uptimeMillis(), 0, 0);
return true;
} catch (Throwable e) {
return false;
}
}
项目:PhoneProfilesPlus
文件:CmdGoToSleep.java
private static boolean run() {
try {
IPowerManager adapter = IPowerManager.Stub.asInterface(ServiceManager.getService("power"));
adapter.goToSleep(SystemClock.uptimeMillis(), 0, 0);
return true;
} catch (Throwable e) {
return false;
}
}