Search in sources :

Example 91 with PowerManager

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();
}
Also used : PowerManager(android.os.PowerManager)

Example 92 with PowerManager

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);
}
Also used : PowerManager(android.os.PowerManager) Handler(android.os.Handler)

Example 93 with PowerManager

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!");
    }
}
Also used : PowerManager(android.os.PowerManager) RemoteException(android.os.RemoteException)

Example 94 with PowerManager

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();
}
Also used : PowerManager(android.os.PowerManager)

Example 95 with PowerManager

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;
}
Also used : PowerManager(android.os.PowerManager) HandlerThread(android.os.HandlerThread) INetworkStatsService(android.net.INetworkStatsService) IAlarmManager(android.app.IAlarmManager) AlarmManager(android.app.AlarmManager) Handler(android.os.Handler)

Aggregations

PowerManager (android.os.PowerManager)289 IntentFilter (android.content.IntentFilter)50 Intent (android.content.Intent)44 Handler (android.os.Handler)33 RemoteException (android.os.RemoteException)31 PendingIntent (android.app.PendingIntent)29 HandlerThread (android.os.HandlerThread)26 Context (android.content.Context)24 IPowerManager (android.os.IPowerManager)21 View (android.view.View)19 Resources (android.content.res.Resources)15 AlarmManager (android.app.AlarmManager)11 SharedPreferences (android.content.SharedPreferences)11 TextView (android.widget.TextView)11 NotificationCompat (android.support.v4.app.NotificationCompat)10 ComponentName (android.content.ComponentName)9 KeyguardManager (android.app.KeyguardManager)8 Vibrator (android.os.Vibrator)8 MotionEvent (android.view.MotionEvent)8 ContentResolver (android.content.ContentResolver)7