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


Java KeyguardManager.isKeyguardLocked方法代码示例

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


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

示例1: onReceive

import android.app.KeyguardManager; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {

    KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);

    //Log.d("Smarper-Features", "Got screen update");
    featuresLock.lock();
    try {
        if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
            currentFeatures.screenOn = true;
            //Log.d("Smarper-Debug", "Screen became interactive");
        } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {

            currentFeatures.screenOn = false;
            //Log.d("Smarper-Debug", "Screen became not interactive");

            //Update locked state:
            currentFeatures.screenLocked = km.isKeyguardLocked();
            //Log.d("Smarper-Debug", "Screen is locked: " + currentFeatures.screenLocked);

        } else { //ACTION_USER_PRESENT, i.e. screen is unlocked
            currentFeatures.screenLocked = false;
            // Log.d("Smarper-Debug", "Screen unlocking");
        }


    } finally {
        featuresLock.unlock();
    }
}
 
开发者ID:lca1,项目名称:smarper,代码行数:31,代码来源:Smarper.java

示例2: isKeyguardUp

import android.app.KeyguardManager; //导入方法依赖的package包/类
public boolean isKeyguardUp() {
    KeyguardManager km = (KeyguardManager) this.context.getSystemService(Context.KEYGUARD_SERVICE);
    return km.inKeyguardRestrictedInputMode() || km.isKeyguardLocked();
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:5,代码来源:LockScreenManager.java

示例3: isLocked

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * Checks the lock state of the device.
 *
 * @return <code>true</code> if the device is in locked state and <code>false</code> otherwise.
 */
private boolean isLocked() {
    KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return keyguardManager.isKeyguardLocked();
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-service,代码行数:10,代码来源:AgentRequestHandler.java


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