Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle screenlock / power botton ? #864

Open
sachinGirish opened this issue Feb 8, 2017 · 3 comments
Open

How to handle screenlock / power botton ? #864

sachinGirish opened this issue Feb 8, 2017 · 3 comments

Comments

@sachinGirish
Copy link

How to handle screen lock/ power botton ?
I have a test case that needs to lock screen and unlock screen, how i can handle it using robotium.

@vikramuk
Copy link

vikramuk commented Feb 8, 2017 via email

@sachinGirish
Copy link
Author

@vikramuk I tryed using keyevent but it not works.

I am able to unlock using activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

Window window = this.getWindow();
window.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD);
window.addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(LayoutParams.FLAG_TURN_SCREEN_ON);

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
is there any other specific code to lock screen.

Iam trying to use PARTIAL_WAKE_LOCK to lock but not getting it.

@vikramuk
Copy link

vikramuk commented Feb 9, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants