I am using the official android watch face API and I want to keep the screen on for a couple of seconds during an animation so that the screen doesn't go into ambient mode during the animation and once the animation is finished, I want to reset everything back to normal, is this possible? My class extends CanvasWatchFaceService and I am also extending the CanvasWatchFaceService.Engine So I want something similar to this but for a watchface:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Then this:
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON).
You need to explicitly hold wake lock: http://developer.android.com/reference/android/os/PowerManager.WakeLock.html
Get a wake lock that keeps the screen on and release it when you finish animating.
Here is a document about keeping the device awake: https://developer.android.com/training/scheduling/wakelock.html
And here is an example:
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
WakeLock wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
"WatchFaceWakelockTag"); // note WakeLock spelling
wakeLock.acquire();