Skip to content

Commit

Permalink
Recorder: grant read permissions for apps requesting recordings
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit e223eb3)
  • Loading branch information
amartinz authored and luca020400 committed Nov 8, 2024
1 parent 09b8722 commit 824dc49
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 824dc49

Please sign in to comment.