src/core/android/SDL_android.c
changeset 11688 e4d90d54cb01
parent 11678 1f10a52295e3
child 11715 35da714ed287
equal deleted inserted replaced
11687:e968d755a760 11688:e4d90d54cb01
   249 
   249 
   250 /* Accelerometer data storage */
   250 /* Accelerometer data storage */
   251 static float fLastAccelerometer[3];
   251 static float fLastAccelerometer[3];
   252 static SDL_bool bHasNewData;
   252 static SDL_bool bHasNewData;
   253 
   253 
   254 static SDL_bool bHasEnvironmentVariables;
   254 static SDL_bool bHasEnvironmentVariables = SDL_FALSE;
   255 
   255 
   256 /*******************************************************************************
   256 /*******************************************************************************
   257                  Functions called by JNI
   257                  Functions called by JNI
   258 *******************************************************************************/
   258 *******************************************************************************/
   259 
   259 
   322                                 "clipboardHasText", "()Z");
   322                                 "clipboardHasText", "()Z");
   323     midOpenAPKExpansionInputStream = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   323     midOpenAPKExpansionInputStream = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   324                                 "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
   324                                 "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
   325 
   325 
   326     midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   326     midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   327                                 "getManifestEnvironmentVariables", "()V");
   327                                 "getManifestEnvironmentVariables", "()Z");
   328 
   328 
   329     midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
   329     midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
   330 
   330 
   331     if (!midGetNativeSurface ||
   331     if (!midGetNativeSurface ||
   332        !midSetActivityTitle || !midSetOrientation || !midGetContext || !midInputGetInputDeviceIds ||
   332        !midSetActivityTitle || !midSetOrientation || !midGetContext || !midInputGetInputDeviceIds ||
   829     (*env)->ReleaseStringUTFChars(env, name, utfname);
   829     (*env)->ReleaseStringUTFChars(env, name, utfname);
   830     (*env)->ReleaseStringUTFChars(env, value, utfvalue);
   830     (*env)->ReleaseStringUTFChars(env, value, utfvalue);
   831 
   831 
   832 }
   832 }
   833 
   833 
   834 JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeEnvironmentVariablesSet)(
       
   835         JNIEnv* env, jclass cls)
       
   836 {
       
   837     bHasEnvironmentVariables = SDL_TRUE;
       
   838 }
       
   839 
       
   840 /*******************************************************************************
   834 /*******************************************************************************
   841              Functions called by SDL into Java
   835              Functions called by SDL into Java
   842 *******************************************************************************/
   836 *******************************************************************************/
   843 
   837 
   844 static int s_active = 0;
   838 static int s_active = 0;
  2141         return;
  2135         return;
  2142     }
  2136     }
  2143 
  2137 
  2144     if (!bHasEnvironmentVariables) {
  2138     if (!bHasEnvironmentVariables) {
  2145         JNIEnv *env = Android_JNI_GetEnv();
  2139         JNIEnv *env = Android_JNI_GetEnv();
  2146         (*env)->CallStaticVoidMethod(env, mActivityClass, midGetManifestEnvironmentVariables);
  2140         SDL_bool ret = (*env)->CallStaticBooleanMethod(env, mActivityClass, midGetManifestEnvironmentVariables);
       
  2141         if (ret) {
       
  2142             bHasEnvironmentVariables = SDL_TRUE;
       
  2143         }
  2147     }
  2144     }
  2148 }
  2145 }
  2149 
  2146 
  2150 #endif /* __ANDROID__ */
  2147 #endif /* __ANDROID__ */
  2151 
  2148