Fixed opening audio on Android from the Steam Link shell activity
authorSam Lantinga <slouken@libsdl.org>
Thu, 13 Feb 2020 16:10:52 -0800
changeset 13516dd33a1cfaae5
parent 13515 9d631a3485a5
child 13517 fbcc6e833d3c
Fixed opening audio on Android from the Steam Link shell activity
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
src/audio/openslES/SDL_openslES.c
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Thu Feb 13 10:19:05 2020 -0800
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Thu Feb 13 16:10:52 2020 -0800
     1.3 @@ -1606,24 +1606,14 @@
     1.4       * This method is called by SDL using JNI.
     1.5       */
     1.6      public static void requestPermission(String permission, int requestCode) {
     1.7 -        if (mSingleton != null) {
     1.8 -            mSingleton.checkPermission(permission, requestCode);
     1.9 -        } else {
    1.10 -            nativePermissionResult(requestCode, false);
    1.11 -        }
    1.12 -    }
    1.13 -
    1.14 -    /**
    1.15 -     * This can be overridden
    1.16 -     */
    1.17 -    public void checkPermission(String permission, int requestCode) {
    1.18          if (Build.VERSION.SDK_INT < 23) {
    1.19              nativePermissionResult(requestCode, true);
    1.20              return;
    1.21          }
    1.22  
    1.23 -        if (this.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
    1.24 -            this.requestPermissions(new String[]{permission}, requestCode);
    1.25 +        Activity activity = (Activity)getContext();
    1.26 +        if (activity.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
    1.27 +            activity.requestPermissions(new String[]{permission}, requestCode);
    1.28          } else {
    1.29              nativePermissionResult(requestCode, true);
    1.30          }
     2.1 --- a/src/audio/openslES/SDL_openslES.c	Thu Feb 13 10:19:05 2020 -0800
     2.2 +++ b/src/audio/openslES/SDL_openslES.c	Thu Feb 13 16:10:52 2020 -0800
     2.3 @@ -234,6 +234,7 @@
     2.4      int i;
     2.5  
     2.6      if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {
     2.7 +        LOGE("This app doesn't have RECORD_AUDIO permission");
     2.8          return SDL_SetError("This app doesn't have RECORD_AUDIO permission");
     2.9      }
    2.10