当前位置: 首页>>代码示例>>Java>>正文


Java KeyguardManager.newKeyguardLock方法代码示例

本文整理汇总了Java中android.app.KeyguardManager.newKeyguardLock方法的典型用法代码示例。如果您正苦于以下问题:Java KeyguardManager.newKeyguardLock方法的具体用法?Java KeyguardManager.newKeyguardLock怎么用?Java KeyguardManager.newKeyguardLock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.KeyguardManager的用法示例。


在下文中一共展示了KeyguardManager.newKeyguardLock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: wakeAndUnlock

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void wakeAndUnlock()
{
    //获取电源管理器对象
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

    //获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
    PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");

    //点亮屏幕
    wl.acquire(1000);

    //得到键盘锁管理器对象
    KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    kl = km.newKeyguardLock("unLock");

    //解锁
    kl.disableKeyguard();

}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:20,代码来源:AppCompatDlalog.java

示例2: wakeAndUnlock

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void wakeAndUnlock(boolean b)
   {
if (b)
{
    //获取电源管理器对象
    mPowerManager = (PowerManager)getApplicationContext().getSystemService(Context.POWER_SERVICE);
    //获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
    mWakeLock = mPowerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");
    //点亮屏幕
    mWakeLock.acquire();
    //得到键盘锁管理器对象
    mKeyguardManager = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
    mKeyguardLock = mKeyguardManager.newKeyguardLock("unLock");
    //解锁
    mKeyguardLock.disableKeyguard();
}
else
{
    //锁屏
    mKeyguardLock.reenableKeyguard();
    //释放wakeLock,关灯
    mWakeLock.release();
}}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:24,代码来源:dex_smali.java

示例3: wakeAndUnlock

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void wakeAndUnlock(boolean b) {
    Log.i(TAG, "解锁亮屏?:" + b);
    if (b) {
        //获取电源管理器对象
        pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        //获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
        wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "bright");
        //点亮屏幕
        wl.acquire();
        //得到键盘锁管理器对象
        km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
        kl = km.newKeyguardLock("unLock");
        //解锁
        kl.disableKeyguard();
        isWaked = true;
    } else {
        //锁屏
        kl.reenableKeyguard();
        //释放wakeLock,关灯
        wl.release();
    }
}
 
开发者ID:mcxtzhang,项目名称:miser-utils,代码行数:23,代码来源:ComeOnMoneyService.java

示例4: wakeAndUnlock

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void wakeAndUnlock(boolean b) {
    if (b) {
        //获取电源管理器对象
        powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
        //获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
        wakeLock = powerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, TAG);

        // 屏幕解锁
        KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
        KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("unLock");

        keyguardLock.reenableKeyguard();
        keyguardLock.disableKeyguard(); // 解锁

        //点亮屏幕
        wakeLock.acquire();
    } else {
        //释放wakeLock,关灯
        wakeLock.release();
    }
}
 
开发者ID:qoli,项目名称:MiHomePlus,代码行数:22,代码来源:MyAccessibility.java

示例5: wakeAndUnlock

import android.app.KeyguardManager; //导入方法依赖的package包/类
public static void wakeAndUnlock() {
    //获取电源管理器对象
    PowerManager pm = getPowerManager();

    //获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
    PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");

    //点亮屏幕
    wl.acquire(1000);

    //得到键盘锁管理器对象
    KeyguardManager km = getKeyguardManager();
    KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");

    //解锁
    kl.disableKeyguard();
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:18,代码来源:NotifyUtils.java

示例6: wakeAndUnlock

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void wakeAndUnlock() {
    //获取电源管理器对象
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

    //获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
    PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");

    //点亮屏幕
    wl.acquire(1000);

    //得到键盘锁管理器对象
    KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    kl = km.newKeyguardLock("unLock");

    //解锁
    kl.disableKeyguard();

}
 
开发者ID:xmlxin,项目名称:ReplyMessage,代码行数:19,代码来源:AutoReplyService.java

示例7: acquire

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * 激活屏幕,不锁屏。 每次唤醒屏幕前都release。
 * 
 * @param context
 */
public static void acquire(Context context) {
	DebugLog.v(TAG, "Acquiring wake lock");
	if (sWakeLock != null) {
		sWakeLock.release();
	}

	PowerManager pm = (PowerManager) context
			.getSystemService(Context.POWER_SERVICE);

	sWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
			| PowerManager.ACQUIRE_CAUSES_WAKEUP
			| PowerManager.ON_AFTER_RELEASE, TAG);

	sWakeLock.acquire();

	// 解锁
	KeyguardManager keyguardManager = (KeyguardManager) context
			.getSystemService(Context.KEYGUARD_SERVICE);
	KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("");
	keyguardLock.disableKeyguard();
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:27,代码来源:AlertWakeLock.java

示例8: onCreate

import android.app.KeyguardManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    // add flag to current window
    Window window = this.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

    // init KeyguardManager

    KeyguardManager keyguardManager = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);

    if (keyguardManager.inKeyguardRestrictedInputMode()) {
        KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock(getLocalClassName());
        keyguardLock.disableKeyguard();
    }

    // wake up screen light
    PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "");
    wakeLock.acquire();

    // finish current activity
    finish();
}
 
开发者ID:macacajs,项目名称:unlock-apk,代码行数:29,代码来源:MainActivity.java

示例9: wakeAndUnlock2

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void wakeAndUnlock2(boolean b)
{
    if(b)
    {
        //获取电源管理器对象
        pm=(PowerManager) getSystemService(Context.POWER_SERVICE);

        //获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
        wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");

        //点亮屏幕
        wl.acquire();

        //得到键盘锁管理器对象
        km= (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
        kl = km.newKeyguardLock("unLock");

        //解锁
        kl.disableKeyguard();
    }
    else
    {
        //锁屏
        kl.reenableKeyguard();

        //释放wakeLock,关灯
        wl.release();
    }

}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:31,代码来源:Air.java

示例10: onBind

import android.app.KeyguardManager; //导入方法依赖的package包/类
@Override
   public IBinder onBind(Intent intent)
   {
IBinder mIBinder = super.onBind(intent);
mBinding = true;

powerMan = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = powerMan.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP, "WakeLock");
keyMan = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
keyLock = keyMan.newKeyguardLock("KeyLock");

// #TODO 换掉这些deprecated方法,

return mIBinder;
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:16,代码来源:PinEntryEditText.java

示例11: wakeUpAndUnlock

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void wakeUpAndUnlock(Context context)
{
	KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
	KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");
	// 解锁
	kl.disableKeyguard();
	// 获取电源管理器对象
	PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
	// 获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是LogCat里用的Tag
	PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "bright");
	// 点亮屏幕
	wl.acquire();
	// 释放
	wl.release();
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:16,代码来源:MD5_jni.java

示例12: PowerUtil

import android.app.KeyguardManager; //导入方法依赖的package包/类
public PowerUtil(Context context) {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
            "HongbaoWakelock");
    KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    keyguardLock = km.newKeyguardLock("HongbaoKeyguardLock");
}
 
开发者ID:KoreHuang,项目名称:WeChatLuckyMoney,代码行数:8,代码来源:PowerUtil.java

示例13: disableSysLockScreen

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * 禁用系统锁屏
 *
 * @param context 上下文对象
 */
public static void disableSysLockScreen(Context context) {
    if (keyguardLock == null) {
        KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(
                context.KEYGUARD_SERVICE);
        keyguardLock = keyguardManager.newKeyguardLock(CUSTOM_LOCK_SCREEN);
    }
    keyguardLock.disableKeyguard();
}
 
开发者ID:wl9739,项目名称:CustomLockScreen,代码行数:14,代码来源:SysLockScreenUtils.java

示例14: cancelLockScreen

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * 取消锁屏限制
 *
 * @param activity you know
 */
private static void cancelLockScreen(Activity activity) {
    Boolean isUnlock = mIsUnlockArray.get(activity);
    if (isUnlock != null && isUnlock) {
        return;
    }
    KeyguardManager mKeyguardManager = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE);
    KeyguardLock mKeyguardLock = mKeyguardManager.newKeyguardLock(activity.getClass().getName());
    mKeyguardLock.disableKeyguard();

    mIsUnlockArray.put(activity, true);
}
 
开发者ID:guiying712,项目名称:AndroidModulePattern,代码行数:17,代码来源:ScreenLockUtil.java

示例15: AgentRequestHandler

import android.app.KeyguardManager; //导入方法依赖的package包/类
public AgentRequestHandler(Context context, LocationMockHandler locationProvider) {
    this.context = context;
    this.locationProvider = locationProvider;

    KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    keyguardLock = keyguardManager.newKeyguardLock("AtmosphereKeyguardLock");
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-service,代码行数:8,代码来源:AgentRequestHandler.java


注:本文中的android.app.KeyguardManager.newKeyguardLock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。