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
545cd1eb
authored
Jun 15, 2022
by
olly
Committed by
Marc Baechinger
Jun 15, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
parent
10050a1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
545cd1eb
...
...
@@ -196,7 +196,7 @@ public final class Util {
*/
@Nullable
public
static
ComponentName
startForegroundService
(
Context
context
,
Intent
intent
)
{
if
(
Util
.
SDK_INT
>=
26
)
{
if
(
SDK_INT
>=
26
)
{
return
context
.
startForegroundService
(
intent
);
}
else
{
return
context
.
startService
(
intent
);
...
...
@@ -212,7 +212,7 @@ public final class Util {
* @return Whether a permission request was made.
*/
public
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
Uri
...
uris
)
{
if
(
Util
.
SDK_INT
<
23
)
{
if
(
SDK_INT
<
23
)
{
return
false
;
}
for
(
Uri
uri
:
uris
)
{
...
...
@@ -235,7 +235,7 @@ public final class Util {
*/
public
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
MediaItem
...
mediaItems
)
{
if
(
Util
.
SDK_INT
<
23
)
{
if
(
SDK_INT
<
23
)
{
return
false
;
}
for
(
MediaItem
mediaItem
:
mediaItems
)
{
...
...
@@ -257,7 +257,7 @@ public final class Util {
}
private
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
Uri
uri
)
{
return
Util
.
SDK_INT
>=
23
&&
(
isLocalFileUri
(
uri
)
||
isMediaStoreExternalContentUri
(
uri
))
return
SDK_INT
>=
23
&&
(
isLocalFileUri
(
uri
)
||
isMediaStoreExternalContentUri
(
uri
))
?
requestExternalStoragePermission
(
activity
)
:
false
;
}
...
...
@@ -283,7 +283,7 @@ public final class Util {
* @return Whether it may be possible to load the URIs of the given media items.
*/
public
static
boolean
checkCleartextTrafficPermitted
(
MediaItem
...
mediaItems
)
{
if
(
Util
.
SDK_INT
<
24
)
{
if
(
SDK_INT
<
24
)
{
// We assume cleartext traffic is permitted.
return
true
;
}
...
...
@@ -644,7 +644,7 @@ public final class Util {
normalizedTag
=
language
;
}
normalizedTag
=
Ascii
.
toLowerCase
(
normalizedTag
);
String
mainLanguage
=
Util
.
splitAtFirst
(
normalizedTag
,
"-"
)[
0
];
String
mainLanguage
=
splitAtFirst
(
normalizedTag
,
"-"
)[
0
];
if
(
languageTagReplacementMap
==
null
)
{
languageTagReplacementMap
=
createIsoLanguageReplacementMap
();
}
...
...
@@ -1655,9 +1655,9 @@ public final class Util {
case
7
:
return
AudioFormat
.
CHANNEL_OUT_5POINT1
|
AudioFormat
.
CHANNEL_OUT_BACK_CENTER
;
case
8
:
if
(
Util
.
SDK_INT
>=
23
)
{
if
(
SDK_INT
>=
23
)
{
return
AudioFormat
.
CHANNEL_OUT_7POINT1_SURROUND
;
}
else
if
(
Util
.
SDK_INT
>=
21
)
{
}
else
if
(
SDK_INT
>=
21
)
{
// Equal to AudioFormat.CHANNEL_OUT_7POINT1_SURROUND, which is hidden before Android M.
return
AudioFormat
.
CHANNEL_OUT_5POINT1
|
AudioFormat
.
CHANNEL_OUT_SIDE_LEFT
...
...
@@ -1940,7 +1940,7 @@ public final class Util {
public
static
@ContentType
int
inferContentTypeForUriAndMimeType
(
Uri
uri
,
@Nullable
String
mimeType
)
{
if
(
mimeType
==
null
)
{
return
Util
.
inferContentType
(
uri
);
return
inferContentType
(
uri
);
}
switch
(
mimeType
)
{
case
MimeTypes
.
APPLICATION_MPD
:
...
...
@@ -2264,7 +2264,7 @@ public final class Util {
/** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */
public
static
Locale
getDefaultDisplayLocale
()
{
return
Util
.
SDK_INT
>=
24
?
Locale
.
getDefault
(
Locale
.
Category
.
DISPLAY
)
:
Locale
.
getDefault
();
return
SDK_INT
>=
24
?
Locale
.
getDefault
(
Locale
.
Category
.
DISPLAY
)
:
Locale
.
getDefault
();
}
/**
...
...
@@ -2336,7 +2336,7 @@ public final class Util {
* @return Whether the app is running on an automotive device.
*/
public
static
boolean
isAutomotive
(
Context
context
)
{
return
Util
.
SDK_INT
>=
23
return
SDK_INT
>=
23
&&
context
.
getPackageManager
().
hasSystemFeature
(
PackageManager
.
FEATURE_AUTOMOTIVE
);
}
...
...
@@ -2354,7 +2354,7 @@ public final class Util {
*/
public
static
Point
getCurrentDisplayModeSize
(
Context
context
)
{
@Nullable
Display
defaultDisplay
=
null
;
if
(
Util
.
SDK_INT
>=
17
)
{
if
(
SDK_INT
>=
17
)
{
@Nullable
DisplayManager
displayManager
=
(
DisplayManager
)
context
.
getSystemService
(
Context
.
DISPLAY_SERVICE
);
...
...
@@ -2402,7 +2402,7 @@ public final class Util {
// vendor.display-size instead.
@Nullable
String
displaySize
=
Util
.
SDK_INT
<
28
SDK_INT
<
28
?
getSystemProperty
(
"sys.display-size"
)
:
getSystemProperty
(
"vendor.display-size"
);
// If we managed to read the display size, attempt to parse it.
...
...
@@ -2423,17 +2423,17 @@ public final class Util {
}
// Sony Android TVs advertise support for 4k output via a system feature.
if
(
"Sony"
.
equals
(
Util
.
MANUFACTURER
)
&&
Util
.
MODEL
.
startsWith
(
"BRAVIA"
)
if
(
"Sony"
.
equals
(
MANUFACTURER
)
&&
MODEL
.
startsWith
(
"BRAVIA"
)
&&
context
.
getPackageManager
().
hasSystemFeature
(
"com.sony.dtv.hardware.panel.qfhd"
))
{
return
new
Point
(
3840
,
2160
);
}
}
Point
displaySize
=
new
Point
();
if
(
Util
.
SDK_INT
>=
23
)
{
if
(
SDK_INT
>=
23
)
{
getDisplaySizeV23
(
display
,
displaySize
);
}
else
if
(
Util
.
SDK_INT
>=
17
)
{
}
else
if
(
SDK_INT
>=
17
)
{
getDisplaySizeV17
(
display
,
displaySize
);
}
else
{
getDisplaySizeV16
(
display
,
displaySize
);
...
...
@@ -2652,7 +2652,7 @@ public final class Util {
@RequiresApi
(
24
)
private
static
String
[]
getSystemLocalesV24
(
Configuration
config
)
{
return
Util
.
split
(
config
.
getLocales
().
toLanguageTags
(),
","
);
return
split
(
config
.
getLocales
().
toLanguageTags
(),
","
);
}
@RequiresApi
(
21
)
...
...
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