From e223eb3d8fbcf974bb0f4b2177fed343bbef8c42 Mon Sep 17 00:00:00 2001 From: Alexander Martinz Date: Thu, 7 Nov 2024 19:34:43 +0100 Subject: [PATCH] Recorder: grant read permissions for apps requesting recordings Recorder is already properly handling requests to record audio and return the file as Uri. However, we also need to explicitly grand read permissions for the Uri, otherwise the requesting app can not use the recording. E MediaPlayerService: Couldn't open fd for content://0@media/external_primary/audio/media/1000000046 E MediaPlayerNative: Unable to create media player E ByodPresentMediaDialog: Cannot play given audio with media player. E ByodPresentMediaDialog: java.io.IOException: setDataSource failed.: status=0x80000000 Test: CTS-Verifier - https://source.android.com/docs/compatibility/cts/verifier - BYOD Managed Provisioning - Start BYOD provisioning flow - Sound recorder support cross profile audio capture Test: manualTests#com.android.cts.verifier.managedprovisioning.ByodFlowTestActivity Change-Id: Ic107d21ae309a425842b94eeea11c614e3357bbe Signed-off-by: Alexander Martinz --- app/src/main/java/org/lineageos/recorder/RecorderActivity.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/org/lineageos/recorder/RecorderActivity.kt b/app/src/main/java/org/lineageos/recorder/RecorderActivity.kt index 2091af89..a642448f 100644 --- a/app/src/main/java/org/lineageos/recorder/RecorderActivity.kt +++ b/app/src/main/java/org/lineageos/recorder/RecorderActivity.kt @@ -331,6 +331,7 @@ class RecorderActivity : AppCompatActivity(R.layout.activity_main) { private fun confirmLastResult() { val resultIntent = Intent().setData(preferencesManager.lastItemUri) + .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) setResult(RESULT_OK, resultIntent) finish() }