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


Java KeyguardManager.inKeyguardRestrictedInputMode方法代码示例

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


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

示例1: handleIntent

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void handleIntent(Intent intent) {
    KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
    if (km.inKeyguardRestrictedInputMode() || !ApplicationLoader.isScreenOn) {
        getWindow().addFlags(
                        WindowManager.LayoutParams.FLAG_DIM_BEHIND |
                        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
                        WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                        WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    } else {
        getWindow().addFlags(
                        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
                        WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                        WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    }

    if (currentMessageObject == null) {
        currentMessageNum = 0;
    }
    getNewMessage();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:22,代码来源:PopupNotificationActivity.java

示例2: isLockScreen

import android.app.KeyguardManager; //导入方法依赖的package包/类
public boolean isLockScreen(){
       final KeyguardManager km = (KeyguardManager)ActivityManager.getActivity().getSystemService(Context.KEYGUARD_SERVICE);
       final boolean isLock = km.inKeyguardRestrictedInputMode();
       
       if(isLock == false){
		final String isPause = System.getProperty("user.hc.app.isPause");
		if(isPause != null && isPause.equals("true")){
			//切换到当前的应用中
			AndroidUIUtil.runDelay(new Runnable() {
				@Override
				public void run() {
		            J2SEInitor.doAction(J2SEActionMap.startBringToFrontService);
		            
		            try{
		            	Thread.sleep(2000);
		            }catch (final Exception e) {
					}
		            
		            J2SEInitor.doAction(J2SEActionMap.stopBringToFrontService);
				}
			});
		}
       }
       
       return isLock;
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:27,代码来源:AndroidPlatformService.java

示例3: forceScreenUnlockIfNeeded

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * Forces the phone to have its screen unlocked by executing a dedicated custom script
 * the user has put in its device
 */
protected void forceScreenUnlockIfNeeded(){

    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
    boolean isEnabled = sp.getBoolean(SettingsActivity.PREF_KEY_UNLOCK_SCRIPT, false);

    if ( isEnabled ){
        KeyguardManager km = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
        if (km.inKeyguardRestrictedInputMode()) {
            UnlockerStub unlocker = new UnlockerImpl(sp.getString(SettingsActivity.PREF_KEY_FILE_UNLOCK_NAME, Config.DEFAULT_FILE_SH_UNLOCK_NAME));
            try {
                unlocker.unlock(null);
            } catch (UnlockerStub.UnlockException ue) {
                ue.printStackTrace();
                displayToast("An error occurs during unlock execution: " + ue.getMessage());
            }
        }
    }

}
 
开发者ID:pylapp,项目名称:SmoothClicker,代码行数:24,代码来源:AsyncTaskForScreen.java

示例4: isPrivacyModeActive

import android.app.KeyguardManager; //导入方法依赖的package包/类
private boolean isPrivacyModeActive() {
    KeyguardManager keyguardService = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);

    boolean privacyModeAlwaysEnabled = QMail.getNotificationHideSubject() == NotificationHideSubject.ALWAYS;
    boolean privacyModeEnabledWhenLocked = QMail.getNotificationHideSubject() == NotificationHideSubject.WHEN_LOCKED;
    boolean screenLocked = keyguardService.inKeyguardRestrictedInputMode();

    return privacyModeAlwaysEnabled || (privacyModeEnabledWhenLocked && screenLocked);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:10,代码来源:DeviceNotifications.java

示例5: 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

示例6: isLockScreen

import android.app.KeyguardManager; //导入方法依赖的package包/类
/** 是否为锁屏或黑屏状态*/
public static boolean isLockScreen() {
    KeyguardManager km = getKeyguardManager();
    boolean b = km.inKeyguardRestrictedInputMode();
    boolean screenOn = !isScreenOn();
    LogUtils.printOut(b+", "+screenOn);
    return b || screenOn;
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:9,代码来源:NotifyUtils.java

示例7: handleIntent

import android.app.KeyguardManager; //导入方法依赖的package包/类
private void handleIntent(Intent intent) {
    isReply = intent != null && intent.getBooleanExtra("force", false);
    if (isReply) {
        popupMessages = NotificationsController.getInstance().popupReplyMessages;
    } else {
        popupMessages = NotificationsController.getInstance().popupMessages;
    }
    KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
    if (km.inKeyguardRestrictedInputMode() || !ApplicationLoader.isScreenOn) {
        getWindow().addFlags(
                WindowManager.LayoutParams.FLAG_DIM_BEHIND |
                        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
                        WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                        WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    } else {
        getWindow().addFlags(
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
                        WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                        WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    }

    if (currentMessageObject == null) {
        currentMessageNum = 0;
    }
    getNewMessage();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:28,代码来源:PopupNotificationActivity.java

示例8: lockDeviceNow

import android.app.KeyguardManager; //导入方法依赖的package包/类
public static boolean lockDeviceNow(Context context, Context baseContext) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(baseContext);
    int lockMethod = prefs.getInt(PreferenceString.LOCK_METHOD, LOCK_METHOD_DEVICE_ADMIN);
    switch (lockMethod) {
        case LOCK_METHOD_DEVICE_ADMIN:
            KeyguardManager keyguardManager = (KeyguardManager) baseContext.getSystemService(Context.KEYGUARD_SERVICE);
            if (!keyguardManager.inKeyguardRestrictedInputMode()) {
                DevicePolicyManager dpm = (DevicePolicyManager) baseContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
                if (dpm.isAdminActive(new ComponentName(baseContext, AdminReceiver.class)))
                    dpm.lockNow();
            }
            return true;
        case LOCK_METHOD_ROOT:
            try {
                KeyguardManager km = (KeyguardManager) baseContext.getSystemService(Context.KEYGUARD_SERVICE);
                boolean locked = km.inKeyguardRestrictedInputMode();
                if (!locked) { // don't lock if already screen off
                    Runtime.getRuntime().exec(new String[]{"su", "-c", "input keyevent 26"}).waitFor();
                }
                return true;
            } catch (IOException | InterruptedException e) {
                Toast.makeText(context, "PluckLockEx Root access denied", Toast.LENGTH_SHORT).show();
            }

        case LOCK_METHOD_FAKE:
            Toast.makeText(context, "PluckLockEx fake lock", Toast.LENGTH_SHORT).show();
            return true;
    }
    return false;
}
 
开发者ID:0xFireball,项目名称:PluckLockEx,代码行数:31,代码来源:AccelerometerService.java

示例9: isPhoneUnlocked

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * Use this method to know if the phone is unlocked or not
 *
 * @param context Context
 * @return true if the phone is unlocked else false
 */
public static boolean isPhoneUnlocked(Context context) {
    KeyguardManager myKM = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    if (myKM.inKeyguardRestrictedInputMode()) {
        M.L(M.Type.INFO, "Screen Lock Status", "locked");
        return true;
    } else {
        M.L(M.Type.INFO, "Screen Lock Status", "unlocked");
        return false;
    }
}
 
开发者ID:FirzenYogesh,项目名称:MukkiaSevaigal,代码行数:17,代码来源:S.java

示例10: isPrivacyModeActive

import android.app.KeyguardManager; //导入方法依赖的package包/类
private boolean isPrivacyModeActive() {
    KeyguardManager keyguardService = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);

    boolean privacyModeAlwaysEnabled = K9.getNotificationHideSubject() == NotificationHideSubject.ALWAYS;
    boolean privacyModeEnabledWhenLocked = K9.getNotificationHideSubject() == NotificationHideSubject.WHEN_LOCKED;
    boolean screenLocked = keyguardService.inKeyguardRestrictedInputMode();

    return privacyModeAlwaysEnabled || (privacyModeEnabledWhenLocked && screenLocked);
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:10,代码来源:DeviceNotifications.java

示例11: isLocked

import android.app.KeyguardManager; //导入方法依赖的package包/类
public void isLocked(CallbackContext context) {
    KeyguardManager kgMgr = (KeyguardManager) this.cordova.getActivity()
        .getApplicationContext()
        .getSystemService(Context.KEYGUARD_SERVICE);
    boolean result = kgMgr.inKeyguardRestrictedInputMode();
    context.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
 
开发者ID:polybuildr,项目名称:cordova-plugin-lock-info,代码行数:8,代码来源:LockInfoPlugin.java

示例12: isPhoneLocked

import android.app.KeyguardManager; //导入方法依赖的package包/类
public boolean isPhoneLocked(){
    KeyguardManager myKM = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    if( myKM.inKeyguardRestrictedInputMode()) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:NicolaSabino,项目名称:Monitor_1.0,代码行数:9,代码来源:DataService.java

示例13: isScreenLock

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * 判断是否锁屏
 *
 * @return {@code true}: 是<br>{@code false}: 否
 */
public static boolean isScreenLock() {
    KeyguardManager km = (KeyguardManager) Utils.getContext()
            .getSystemService(Context.KEYGUARD_SERVICE);
    return km.inKeyguardRestrictedInputMode();
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:11,代码来源:ScreenUtils.java

示例14: isScreenLocked

import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
 * 系统是否在锁屏状态
 *
 * @return
 */
private boolean isScreenLocked()
{
    KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    return keyguardManager.inKeyguardRestrictedInputMode();
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:11,代码来源:AppCompatDlalog.java

示例15: 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


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