ScreenHelper

public class ScreenHelper {
    /**
     * 解锁屏
     * 
     * @param context
     */
    public static void unLockScreen(Context context) {
        KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");
        // 解锁
        kl.disableKeyguard();
    }

    /**
     * 点亮屏幕
     * 
     * @param context
     */
    public static void lightUpScreen(Context context) {
        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "A_LOG");
        wl.acquire();
        wl.release();
    }
}

 

你可能感兴趣的:(screen)