Give the caller permission to read the result uri.
When Handling RECORD_SOUND_ACTION:
Add the flag INTENT.FLAG_GRANT_READ_URI_PERMISSION so that
the receiver can read the uri, even if it does not have
the permission READ_EXTERNAL_DATA_STORAGE.
This is also required if the caller is in a different profile.
BUG:20657656
Change-Id: I684a7e744f77fe45b2d6d2a49e252f47c90b4643
diff --git a/src/com/android/soundrecorder/SoundRecorder.java b/src/com/android/soundrecorder/SoundRecorder.java
index 55c3e2c..3970188 100644
--- a/src/com/android/soundrecorder/SoundRecorder.java
+++ b/src/com/android/soundrecorder/SoundRecorder.java
@@ -471,7 +471,8 @@
if (uri == null) {
return;
}
- setResult(RESULT_OK, new Intent().setData(uri));
+ setResult(RESULT_OK, new Intent().setData(uri)
+ .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION));
}
/*