當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。