锁屏

private PowerManager.WakeLock mFullWakelock = null;   
private void acquireFullWakelock(Context context)
 {
        PowerManager localPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
        if (mFullWakelock == null)
        {
            mFullWakelock = localPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK
                    | PowerManager.ON_AFTER_RELEASE | PowerManager.ACQUIRE_CAUSES_WAKEUP,
                    "dmFullLock");
        }

        if (DEBUG)
        {
            Log.v(TAG, "need to aquire full wake up ? " + (mFullWakelock.isHeld() == false));
        }

        if (mFullWakelock.isHeld() == false)
        {            
            mFullWakelock.acquire();
        }
 }

你可能感兴趣的:(service,null,UP)