Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
22eca89a
Commit
22eca89a
authored
2 years ago
by
Nicolas Pomepuy
Browse files
Options
Downloads
Patches
Plain Diff
Add logs to the Uri resolver
parent
3e3a5913
No related branches found
No related tags found
1 merge request
!1630
Add logs to the Uri resolver
Pipeline
#285628
passed with stage
in 8 minutes and 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
+10
-3
10 additions, 3 deletions
...cation/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
with
10 additions
and
3 deletions
application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
+
10
−
3
View file @
22eca89a
...
...
@@ -352,7 +352,10 @@ object FileUtils {
val
filename
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
MediaStore
.
MediaColumns
.
DISPLAY_NAME
)).
replace
(
"/"
,
""
)
if
(
BuildConfig
.
DEBUG
)
Log
.
i
(
TAG
,
"Getting file $filename from content:// URI"
)
inputStream
=
ctx
.
contentResolver
.
openInputStream
(
data
)
if
(
inputStream
==
null
)
return
data
if
(
inputStream
==
null
)
{
Log
.
i
(
"FileUtils"
,
"Expanding uri: $data to $data"
)
return
data
}
os
=
FileOutputStream
(
AndroidDevices
.
EXTERNAL_PUBLIC_DIRECTORY
+
"/Download/"
+
filename
)
val
buffer
=
ByteArray
(
1024
)
var
bytesRead
=
inputStream
.
read
(
buffer
)
...
...
@@ -363,7 +366,7 @@ object FileUtils {
uri
=
AndroidUtil
.
PathToUri
(
AndroidDevices
.
EXTERNAL_PUBLIC_DIRECTORY
+
"/Download/"
+
filename
)
}
}
catch
(
e
:
Exception
)
{
Log
.
e
(
TAG
,
"Couldn't download file from mail URI"
)
Log
.
e
(
TAG
,
"Couldn't download file from mail URI
: $data
"
)
return
null
}
finally
{
CloseableUtils
.
close
(
inputStream
)
...
...
@@ -380,7 +383,10 @@ object FileUtils {
val
inputPFD
:
ParcelFileDescriptor
?
try
{
inputPFD
=
ctx
.
contentResolver
.
openFileDescriptor
(
data
,
"r"
)
if
(
inputPFD
==
null
)
return
data
if
(
inputPFD
==
null
)
{
Log
.
i
(
"FileUtils"
,
"Expanding uri: $data to $data"
)
return
data
}
uri
=
AndroidUtil
.
LocationToUri
(
"fd://"
+
inputPFD
.
fd
)
// Cursor returnCursor =
// getContentResolver().query(data, null, null, null, null);
...
...
@@ -412,6 +418,7 @@ object FileUtils {
}
}
// Media or MMS URI
}
Log
.
i
(
"FileUtils"
,
"Expanding uri: $data to $uri"
)
return
uri
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment