Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
22b126ca
authored
Jun 08, 2021
by
aquilescanta
Committed by
Oliver Woodman
Jun 08, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Assign ERROR_CODE_IO_NO_PERMISSION to ErrnoException (EACCES)
PiperOrigin-RevId: 378134423
parent
14d101bb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
View file @
22b126ca
...
@@ -25,9 +25,13 @@ import android.os.Looper;
...
@@ -25,9 +25,13 @@ import android.os.Looper;
import
android.os.Message
;
import
android.os.Message
;
import
android.os.Process
;
import
android.os.Process
;
import
android.os.SystemClock
;
import
android.os.SystemClock
;
import
android.system.ErrnoException
;
import
android.system.OsConstants
;
import
android.util.Pair
;
import
android.util.Pair
;
import
androidx.annotation.CheckResult
;
import
androidx.annotation.CheckResult
;
import
androidx.annotation.DoNotInline
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
com.google.android.exoplayer2.DefaultMediaClock.PlaybackParametersListener
;
import
com.google.android.exoplayer2.DefaultMediaClock.PlaybackParametersListener
;
import
com.google.android.exoplayer2.Player.DiscontinuityReason
;
import
com.google.android.exoplayer2.Player.DiscontinuityReason
;
import
com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason
;
import
com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason
;
...
@@ -578,7 +582,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
...
@@ -578,7 +582,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
@Nullable
Throwable
cause
=
e
.
getCause
();
@Nullable
Throwable
cause
=
e
.
getCause
();
int
errorCode
=
PlaybackException
.
ERROR_CODE_IO_UNSPECIFIED
;
int
errorCode
=
PlaybackException
.
ERROR_CODE_IO_UNSPECIFIED
;
if
(
cause
instanceof
FileNotFoundException
)
{
if
(
cause
instanceof
FileNotFoundException
)
{
if
(
Util
.
SDK_INT
>=
21
&&
ErrnoExceptionWrapperV21
.
isPermissionError
(
cause
.
getCause
()))
{
errorCode
=
PlaybackException
.
ERROR_CODE_IO_NO_PERMISSION
;
}
else
{
errorCode
=
PlaybackException
.
ERROR_CODE_IO_FILE_NOT_FOUND
;
errorCode
=
PlaybackException
.
ERROR_CODE_IO_FILE_NOT_FOUND
;
}
}
else
if
(
cause
instanceof
SecurityException
)
{
}
else
if
(
cause
instanceof
SecurityException
)
{
errorCode
=
PlaybackException
.
ERROR_CODE_IO_NO_PERMISSION
;
errorCode
=
PlaybackException
.
ERROR_CODE_IO_NO_PERMISSION
;
}
}
...
@@ -3026,4 +3034,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
...
@@ -3026,4 +3034,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
this
.
shuffleOrder
=
shuffleOrder
;
this
.
shuffleOrder
=
shuffleOrder
;
}
}
}
}
@RequiresApi
(
21
)
private
static
final
class
ErrnoExceptionWrapperV21
{
@DoNotInline
public
static
boolean
isPermissionError
(
@Nullable
Throwable
e
)
{
return
e
instanceof
ErrnoException
&&
((
ErrnoException
)
e
).
errno
==
OsConstants
.
EACCES
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment