use of android.os.PowerManager in project android_frameworks_base by DirtyUnicorns.
the class SoundTriggerTestActivity method screenWakeup.
private void screenWakeup() {
if (mScreenWakelock == null) {
PowerManager pm = ((PowerManager) getSystemService(POWER_SERVICE));
mScreenWakelock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, TAG);
}
mScreenWakelock.acquire();
}
use of android.os.PowerManager in project android_frameworks_base by DirtyUnicorns.
the class RebootTile method handleLongClick.
@Override
protected void handleLongClick() {
mHost.collapsePanels();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.reboot(mRebootToRecovery ? "recovery" : "");
}
}, 500);
}
use of android.os.PowerManager in project android_frameworks_base by DirtyUnicorns.
the class FingerprintManager method addLockoutResetCallback.
/**
* @hide
*/
public void addLockoutResetCallback(final LockoutResetCallback callback) {
if (mService != null) {
try {
final PowerManager powerManager = mContext.getSystemService(PowerManager.class);
mService.addLockoutResetCallback(new IFingerprintServiceLockoutResetCallback.Stub() {
@Override
public void onLockoutReset(long deviceId) throws RemoteException {
final PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "lockoutResetCallback");
wakeLock.acquire();
mHandler.post(new Runnable() {
@Override
public void run() {
try {
callback.onLockoutReset();
} finally {
wakeLock.release();
}
}
});
}
});
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
} else {
Log.w(TAG, "addLockoutResetCallback(): Service not connected!");
}
}
use of android.os.PowerManager in project android_frameworks_base by DirtyUnicorns.
the class GeofenceHardwareImpl method acquireWakeLock.
private void acquireWakeLock() {
if (mWakeLock == null) {
PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
}
mWakeLock.acquire();
}
use of android.os.PowerManager in project android_frameworks_base by DirtyUnicorns.
the class NetworkStatsService method create.
public static NetworkStatsService create(Context context, INetworkManagementService networkManager) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
NetworkStatsService service = new NetworkStatsService(context, networkManager, alarmManager, wakeLock, NtpTrustedTime.getInstance(context), TelephonyManager.getDefault(), new DefaultNetworkStatsSettings(context), new NetworkStatsObservers(), getDefaultSystemDir(), getDefaultBaseDir());
HandlerThread handlerThread = new HandlerThread(TAG);
Handler.Callback callback = new HandlerCallback(service);
handlerThread.start();
Handler handler = new Handler(handlerThread.getLooper(), callback);
service.setHandler(handler, callback);
return service;
}
Aggregations