src/core/android/SDL_android.c
changeset 9173 c677ab1148c5
parent 9135 6cd8e6b54f4d
child 9174 f9244b2a1511
     1.1 --- a/src/core/android/SDL_android.c	Fri Oct 17 23:36:45 2014 +0200
     1.2 +++ b/src/core/android/SDL_android.c	Mon Oct 20 10:10:39 2014 -0300
     1.3 @@ -77,6 +77,7 @@
     1.4  static jmethodID midAudioWriteByteBuffer;
     1.5  static jmethodID midAudioQuit;
     1.6  static jmethodID midPollInputDevices;
     1.7 +static jmethodID midSuspendScreenSaver;
     1.8  
     1.9  /* Accelerometer data storage */
    1.10  static float fLastAccelerometer[3];
    1.11 @@ -131,6 +132,8 @@
    1.12                                  "audioQuit", "()V");
    1.13      midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.14                                  "pollInputDevices", "()V");
    1.15 +    midSuspendScreenSaver = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.16 +                                "suspendScreenSaver", "(Z)V");
    1.17  
    1.18      bHasNewData = false;
    1.19  
    1.20 @@ -444,7 +447,13 @@
    1.21  
    1.22  static SDL_bool LocalReferenceHolder_IsActive()
    1.23  {
    1.24 -    return s_active > 0;    
    1.25 +    return s_active > 0;
    1.26 +}
    1.27 +
    1.28 +void Android_JNI_SuspendScreenSaver(SDL_bool suspend)
    1.29 +{
    1.30 +    JNIEnv *env = Android_JNI_GetEnv();
    1.31 +    (*env)->CallStaticObjectMethod(env, mActivityClass, midSuspendScreenSaver, suspend);
    1.32  }
    1.33  
    1.34  ANativeWindow* Android_JNI_GetNativeWindow(void)