src/core/android/SDL_android.cpp
changeset 7190 11612d544fcd
parent 7149 534891ad4897
child 7191 75360622e65f
     1.1 --- a/src/core/android/SDL_android.cpp	Sat May 18 09:35:09 2013 -0700
     1.2 +++ b/src/core/android/SDL_android.cpp	Sat May 18 12:48:50 2013 -0700
     1.3 @@ -181,12 +181,20 @@
     1.4      bHasNewData = true;
     1.5  }
     1.6  
     1.7 +// Low memory
     1.8 +extern "C" void Java_org_libsdl_app_SDLActivity_nativeLowMemory(
     1.9 +                                    JNIEnv* env, jclass cls)
    1.10 +{    
    1.11 +    SDL_SendAppEvent(SDL_APP_LOWMEMORY);
    1.12 +}
    1.13 +
    1.14  // Quit
    1.15  extern "C" void Java_org_libsdl_app_SDLActivity_nativeQuit(
    1.16                                      JNIEnv* env, jclass cls)
    1.17  {    
    1.18      // Inject a SDL_QUIT event
    1.19      SDL_SendQuit();
    1.20 +    SDL_SendAppEvent(SDL_APP_TERMINATING);
    1.21  }
    1.22  
    1.23  // Pause
    1.24 @@ -199,12 +207,20 @@
    1.25          SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
    1.26          SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
    1.27      }
    1.28 +
    1.29 +    __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()");
    1.30 +    SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
    1.31 +    SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
    1.32  }
    1.33  
    1.34  // Resume
    1.35  extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
    1.36                                      JNIEnv* env, jclass cls)
    1.37  {
    1.38 +    __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()");
    1.39 +    SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
    1.40 +    SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
    1.41 +
    1.42      if (Android_Window) {
    1.43          /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context
    1.44           * We can't restore the GL Context here because it needs to be done on the SDL main thread
    1.45 @@ -616,7 +632,9 @@
    1.46  
    1.47      if (false) {
    1.48  fallback:
    1.49 -        __android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file");
    1.50 +        // Disabled log message because of spam on the Nexus 7
    1.51 +        //__android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file");
    1.52 +
    1.53          /* Try the old method using InputStream */
    1.54          ctx->hidden.androidio.assetFileDescriptorRef = NULL;
    1.55