大家好,我最近在研究手机自动化测试,3.2版本的解锁与2.3的有差异,文档里面只说了用 FLAG_DISMISS_KEYGUARD and/or FLAG_SHOW_WHEN_LOCKED instead; Handle returned by newKeyguardLock(String) that allows you to disable / reenable the keyguard,,我不清楚怎么用这两个flag.
     目前2.3解锁成功,3.2的没反应, 我查了3.2的解锁flag为0x00400000,获取锁的方法newKeyguardLock(String)deprecated 下面是我代码:
发送广播为am broadcast -a android.tests.util.disablekeyguard -f 4194304,是用monkey模拟的
public class DisableKeyguardReceiver extends BroadcastReceiver { static KeyguardManager.KeyguardLock lock; @Override
public void onReceive(Context context, Intent intent) {
int  flag = intent.getFlags(); KeyguardManager keyguardManager = (KeyguardManager) context
.getSystemService(Context.KEYGUARD_SERVICE);
if (lock == null) {
lock = keyguardManager.newKeyguardLock("cts");
}
if (flag==WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD) {

lock.disableKeyguard();
} else {
lock.reenableKeyguard();
}
}
}
       请求大侠帮助~~~!