本文整理汇总了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();
}
示例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;
}
示例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());
}
}
}
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
}
示例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);
}
示例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));
}
示例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;
}
}
示例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();
}
示例14: isScreenLocked
import android.app.KeyguardManager; //导入方法依赖的package包/类
/**
* 系统是否在锁屏状态
*
* @return
*/
private boolean isScreenLocked()
{
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
return keyguardManager.inKeyguardRestrictedInputMode();
}
示例15: isKeyguardUp
import android.app.KeyguardManager; //导入方法依赖的package包/类
public boolean isKeyguardUp() {
KeyguardManager km = (KeyguardManager) this.context.getSystemService(Context.KEYGUARD_SERVICE);
return km.inKeyguardRestrictedInputMode() || km.isKeyguardLocked();
}