Bug 2739 - [Android] No support for SDL_DisableScreenSaver by Martin Gerhardy

This commit is contained in:
Gabriel Jacobo 2014-10-20 10:10:39 -03:00
parent a32480ef1f
commit 0ec4fc6589
4 changed files with 28 additions and 1 deletions

View file

@ -187,6 +187,13 @@ public class SDLActivity extends Activity {
return super.dispatchKeyEvent(event);
}
public static void suspendScreenSaver(boolean suspend) {
if (suspend)
mSingleton.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
else
mSingleton.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
/** Called by onPause or surfaceDestroyed. Even if surfaceDestroyed
* is the first to be called, mIsSurfaceReady should still be set
* to 'true' during the call to onPause (in a usual scenario).