src/core/android/SDL_android.c
changeset 11844 8e2ca40e07f3
parent 11823 56d562cbea17
child 11865 af91d564aa40
     1.1 --- a/src/core/android/SDL_android.c	Mon Feb 05 11:40:39 2018 -0800
     1.2 +++ b/src/core/android/SDL_android.c	Tue Feb 06 15:03:35 2018 -0800
     1.3 @@ -211,6 +211,7 @@
     1.4  static jmethodID midSetActivityTitle;
     1.5  static jmethodID midSetOrientation;
     1.6  static jmethodID midGetContext;
     1.7 +static jmethodID midIsAndroidTV;
     1.8  static jmethodID midInputGetInputDeviceIds;
     1.9  static jmethodID midSendMessage;
    1.10  static jmethodID midShowTextInput;
    1.11 @@ -305,6 +306,8 @@
    1.12                                  "setOrientation","(IIZLjava/lang/String;)V");
    1.13      midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.14                                  "getContext","()Landroid/content/Context;");
    1.15 +    midIsAndroidTV = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.16 +                                "isAndroidTV","()Z");
    1.17      midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.18                                  "inputGetInputDeviceIds", "(I)[I");
    1.19      midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.20 @@ -326,9 +329,10 @@
    1.21                                  "getManifestEnvironmentVariables", "()Z");
    1.22  
    1.23      midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
    1.24 +    midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
    1.25  
    1.26      if (!midGetNativeSurface ||
    1.27 -       !midSetActivityTitle || !midSetOrientation || !midGetContext || !midInputGetInputDeviceIds ||
    1.28 +       !midSetActivityTitle || !midSetOrientation || !midGetContext || !midIsAndroidTV || !midInputGetInputDeviceIds ||
    1.29         !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown ||
    1.30         !midClipboardSetText || !midClipboardGetText || !midClipboardHasText ||
    1.31         !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables|| !midGetDisplayDPI) {
    1.32 @@ -1993,6 +1997,12 @@
    1.33      return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
    1.34  }
    1.35  
    1.36 +SDL_bool SDL_IsAndroidTV(void)
    1.37 +{
    1.38 +    JNIEnv *env = Android_JNI_GetEnv();
    1.39 +    return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV);
    1.40 +}
    1.41 +
    1.42  const char * SDL_AndroidGetInternalStoragePath(void)
    1.43  {
    1.44      static char *s_AndroidInternalFilesPath = NULL;