|
33 | 33 | import android.net.Uri; |
34 | 34 | import android.opengl.GLES20; |
35 | 35 | import android.os.AsyncTask; |
| 36 | +import android.os.Build; |
36 | 37 | import android.os.Environment; |
37 | 38 | import android.os.Handler; |
38 | 39 | import android.os.Looper; |
39 | 40 | import androidx.core.content.ContextCompat; |
| 41 | + |
| 42 | +import android.system.Os; |
40 | 43 | import android.util.Log; |
41 | 44 |
|
42 | 45 | import com.viro.core.internal.MediaRecorderSurface; |
@@ -292,14 +295,21 @@ private void deleteNativeRecorder(){ |
292 | 295 | private static boolean hasAudioAndRecordingPermissions(Context context) { |
293 | 296 | boolean hasRecordPermissions = ContextCompat.checkSelfPermission(context, |
294 | 297 | Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED; |
295 | | - boolean hasExternalStoragePerm = ContextCompat.checkSelfPermission(context, |
296 | | - Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; |
| 298 | + boolean hasExternalStoragePerm = true; |
| 299 | + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) { |
| 300 | + hasExternalStoragePerm = ContextCompat.checkSelfPermission(context, |
| 301 | + Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; |
| 302 | + } |
297 | 303 | return hasRecordPermissions && hasExternalStoragePerm; |
298 | 304 | } |
299 | 305 |
|
300 | 306 | private static boolean hasRecordingPermissions(Context context) { |
301 | | - return ContextCompat.checkSelfPermission(context, |
302 | | - Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; |
| 307 | + boolean hasExternalStoragePerm = true; |
| 308 | + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) { |
| 309 | + hasExternalStoragePerm = ContextCompat.checkSelfPermission(context, |
| 310 | + Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; |
| 311 | + } |
| 312 | + return hasExternalStoragePerm; |
303 | 313 | } |
304 | 314 |
|
305 | 315 | /** |
@@ -876,4 +886,3 @@ public void onNativeTakeScreenshot() { |
876 | 886 | private native void nativeEnableFrameRecording(long nativeRecorderRef, boolean enabled); |
877 | 887 | private native void nativeScheduleScreenCapture(long nativeRecorderRef); |
878 | 888 | } |
879 | | - |
|
0 commit comments