For waking a device and turning screen on, you've the following options:
Use PowerManager Wakelock technique.
Use WindowManager LayoutParams Flags.
For going with first option,
problem is the wakelock constructor takes two flags with a OR operator. One level, another Flag.
PowerManager pm = (PowerManager)
wl = pm.newWakeLock
Here, nothing's wrong but , SCREEN_BRIGHT_
WAKE_LOCK and other flags have been deprecated and there's no Level flag that could work with ACQUIRE_CAUSES_
It's a good thing since wakelock usage is discouraged.
LayoutParams Flags are the recommended way, but there's a catch that those flags, once set, work only during a window is created.
That means, you've to set them in your onCreate method before anything else., otherwise they won't work reliably.
So, that invalidates the scope of any condition checking before setting the flags, which could be handled by an extra Activity in control flow. ;) I'll leave it up to here.