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