本文整理汇总了Java中android.app.KeyguardManager.KeyguardLock.disableKeyguard方法的典型用法代码示例。如果您正苦于以下问题:Java KeyguardLock.disableKeyguard方法的具体用法?Java KeyguardLock.disableKeyguard怎么用?Java KeyguardLock.disableKeyguard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.KeyguardManager.KeyguardLock
的用法示例。
在下文中一共展示了KeyguardLock.disableKeyguard方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acquire
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的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();
}
示例2: riseAndShine
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void riseAndShine(Activity activity) {
KeyguardManager keyguardManager = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock keyguardLock = keyguardManager.newKeyguardLock(activity.getLocalClassName());
keyguardLock.disableKeyguard();
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
PowerManager powerManager = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
WakeLock lock = powerManager.newWakeLock(
PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
"wakeup!");
lock.acquire();
lock.release();
}
示例3: onReceive
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
KeyguardManager keyguardManager = (KeyguardManager) context
.getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager
.newKeyguardLock(Context.KEYGUARD_SERVICE);
lock.disableKeyguard();
Intent myIntent = new Intent(context, BitcoinPosActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);
}
}
示例4: onReceive
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的package包/类
@Override
public void onReceive(Context ctx, Intent intent) {
//Unlock device screen
PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "TAG");
wl.acquire(30*1000);
mKeyGuardManager = (KeyguardManager) ctx.getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("com.inostudio.alar_clock");
mLock.disableKeyguard();
//Create notification
creatNotification(ctx);
//Start dialog
Intent dialog = new Intent();
dialog.setClassName("com.inostudio.alarm_clock", "com.inostudio.alarm_clock.RootActivity");
dialog.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(dialog);
//release screen
wl.release();
}
示例5: cancelLockScreen
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的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);
}
示例6: noSysLocker
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的package包/类
public static void noSysLocker(Context context) {
KeyguardManager keyguardManager = (KeyguardManager) context
.getApplicationContext().getSystemService(
Context.KEYGUARD_SERVICE);
KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("Zhaome");
keyguardLock.disableKeyguard();
}
示例7: enable
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的package包/类
public void enable()
{
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
startService(new Intent(this, LockScreenService.class));
Toast.makeText(this.getBaseContext(),"Enabled",Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Please set LockScreen as default launcher", Toast.LENGTH_SHORT).show();
}
示例8: unlockScreen
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的package包/类
/**
* Not used any more. This is replaced by {@link #initWindowFlags}.
* */
@Deprecated
private void unlockScreen() {
CustomLog.d("Trying to unlock screen...");
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
}
示例9: onSensorChanged
import android.app.KeyguardManager.KeyguardLock; //导入方法依赖的package包/类
@Override
public void onSensorChanged(SensorEvent evt) {
if(evt.sensor.getType()==Sensor.TYPE_ACCELEROMETER){
//assign directions
float x = evt.values[0];
float y = evt.values[1];
float z = evt.values[2];
if(!initializated){
prev_x = x;
prev_y = y;
prev_z = z;
initializated = true;
}else{
//The calculation of the error
float dx = Math.abs(prev_x - x);
float dy = Math.abs(prev_y - y);
float dz = Math.abs(prev_z - z);
//if error < accuracy set value 0
if(dx < accuracy) dx = 0;
if(dy < accuracy) dy = 0;
if(dz < accuracy) dz = 0;
prev_x = x;
prev_y = y;
prev_z = z;
if(dx > 0 || dy > 0 || dz > 0){
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "com.inostudio.alar_clock");
wl.acquire(30 * 1000);
//unlock screen
mKeyGuardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("com.inostudio.alar_clock");
mLock.disableKeyguard();
//Start NightActivity
Intent nightActivity = new Intent();
nightActivity.setClassName("com.inostudio.alarm_clock", "com.inostudio.alarm_clock.RootActivity");
nightActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(nightActivity);
}
}
}
}