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 ec4dfdfc58
commit 79035b393a
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).