Fix SecurityException with PCAP file dump on Android TV

When no file manager was available, takePersistableUriPermission
was called without an Intent (and the corresponding
FLAG_GRANT_PERSISTABLE_URI_PERMISSION flag), causing a
SecurityException.

Fixes #176
This commit is contained in:
emanuele-f
2022-01-21 00:17:14 +01:00
parent e76499d02a
commit 3364a4946e
2 changed files with 26 additions and 10 deletions
+3 -1
View File
@@ -124,7 +124,9 @@ Due to the restrictions introduced via the [scoped storage](https://developer.an
4. Retrieve the internal URL which Android uses to reference this file. You can find this in the logcat output of PCAPdroid:
```
D/Main: PCAP URI to write: content://com.android.externalstorage.documents/document/primary%3Atest.pcap
D/Main: PCAP URI to write [persistable=true]: content://com.android.externalstorage.documents/document/primary%3Atest.pcap
```
You should now be able to write the `test.pcap` file by setting the `pcap_uri` to this URI. You must repeat the steps above if you delete the file.
*NOTE*: if the messages shows `[persistable=false]` then it was not possible to get the permissions on the URI, so the `pcap_uri` paramter won't work. This occurs on devices without a file manager to select the PCAP destination path (e.g. on Android TV).