mirror of https://github.com/encounter/SDL.git
Fixed opening audio on Android from the Steam Link shell activity
This commit is contained in:
parent
b431286471
commit
14bf532df3
|
@ -1606,24 +1606,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
* This method is called by SDL using JNI.
|
* This method is called by SDL using JNI.
|
||||||
*/
|
*/
|
||||||
public static void requestPermission(String permission, int requestCode) {
|
public static void requestPermission(String permission, int requestCode) {
|
||||||
if (mSingleton != null) {
|
|
||||||
mSingleton.checkPermission(permission, requestCode);
|
|
||||||
} else {
|
|
||||||
nativePermissionResult(requestCode, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This can be overridden
|
|
||||||
*/
|
|
||||||
public void checkPermission(String permission, int requestCode) {
|
|
||||||
if (Build.VERSION.SDK_INT < 23) {
|
if (Build.VERSION.SDK_INT < 23) {
|
||||||
nativePermissionResult(requestCode, true);
|
nativePermissionResult(requestCode, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
|
Activity activity = (Activity)getContext();
|
||||||
this.requestPermissions(new String[]{permission}, requestCode);
|
if (activity.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
activity.requestPermissions(new String[]{permission}, requestCode);
|
||||||
} else {
|
} else {
|
||||||
nativePermissionResult(requestCode, true);
|
nativePermissionResult(requestCode, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,6 +234,7 @@ openslES_CreatePCMRecorder(_THIS)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {
|
if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {
|
||||||
|
LOGE("This app doesn't have RECORD_AUDIO permission");
|
||||||
return SDL_SetError("This app doesn't have RECORD_AUDIO permission");
|
return SDL_SetError("This app doesn't have RECORD_AUDIO permission");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue