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


Java KeyguardLock.disableKeyguard方法代码示例

本文整理汇总了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();
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:27,代码来源:AlertWakeLock.java

示例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();
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:17,代码来源:EspressoTestRule.java

示例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);
	}
}
 
开发者ID:y12studio,项目名称:bkbc-bitcoinpos,代码行数:18,代码来源:BootReceiver.java

示例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();
}
 
开发者ID:vpeschenkov,项目名称:AlarmClock-Android,代码行数:24,代码来源:AlarmManagerBroadcastReceiver.java

示例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);
}
 
开发者ID:guiying712,项目名称:AndroidModulePattern,代码行数:17,代码来源:ScreenLockUtil.java

示例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();
}
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:8,代码来源:LockerUtils.java

示例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();
}
 
开发者ID:dhruvdangi,项目名称:LockScreen,代码行数:10,代码来源:LockScreen.java

示例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();
}
 
开发者ID:thomas-bornschlegel,项目名称:AndroidRemoteSlideshow,代码行数:11,代码来源:NookImageDisplayerActivity.java

示例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);
			}
	    }
	}
}
 
开发者ID:vpeschenkov,项目名称:AlarmClock-Android,代码行数:49,代码来源:AccelerometerService.java


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