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
Show 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 {
...
@@ -196,7 +196,7 @@ public final class Util {
*/
*/
@Nullable
@Nullable
public
static
ComponentName
startForegroundService
(
Context
context
,
Intent
intent
)
{
public
static
ComponentName
startForegroundService
(
Context
context
,
Intent
intent
)
{
if
(
Util
.
SDK_INT
>=
26
)
{
if
(
SDK_INT
>=
26
)
{
return
context
.
startForegroundService
(
intent
);
return
context
.
startForegroundService
(
intent
);
}
else
{
}
else
{
return
context
.
startService
(
intent
);
return
context
.
startService
(
intent
);
...
@@ -212,7 +212,7 @@ public final class Util {
...
@@ -212,7 +212,7 @@ public final class Util {
* @return Whether a permission request was made.
* @return Whether a permission request was made.
*/
*/
public
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
Uri
...
uris
)
{
public
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
Uri
...
uris
)
{
if
(
Util
.
SDK_INT
<
23
)
{
if
(
SDK_INT
<
23
)
{
return
false
;
return
false
;
}
}
for
(
Uri
uri
:
uris
)
{
for
(
Uri
uri
:
uris
)
{
...
@@ -235,7 +235,7 @@ public final class Util {
...
@@ -235,7 +235,7 @@ public final class Util {
*/
*/
public
static
boolean
maybeRequestReadExternalStoragePermission
(
public
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
MediaItem
...
mediaItems
)
{
Activity
activity
,
MediaItem
...
mediaItems
)
{
if
(
Util
.
SDK_INT
<
23
)
{
if
(
SDK_INT
<
23
)
{
return
false
;
return
false
;
}
}
for
(
MediaItem
mediaItem
:
mediaItems
)
{
for
(
MediaItem
mediaItem
:
mediaItems
)
{
...
@@ -257,7 +257,7 @@ public final class Util {
...
@@ -257,7 +257,7 @@ public final class Util {
}
}
private
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
Uri
uri
)
{
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
)
?
requestExternalStoragePermission
(
activity
)
:
false
;
:
false
;
}
}
...
@@ -283,7 +283,7 @@ public final class Util {
...
@@ -283,7 +283,7 @@ public final class Util {
* @return Whether it may be possible to load the URIs of the given media items.
* @return Whether it may be possible to load the URIs of the given media items.
*/
*/
public
static
boolean
checkCleartextTrafficPermitted
(
MediaItem
...
mediaItems
)
{
public
static
boolean
checkCleartextTrafficPermitted
(
MediaItem
...
mediaItems
)
{
if
(
Util
.
SDK_INT
<
24
)
{
if
(
SDK_INT
<
24
)
{
// We assume cleartext traffic is permitted.
// We assume cleartext traffic is permitted.
return
true
;
return
true
;
}
}
...
@@ -644,7 +644,7 @@ public final class Util {
...
@@ -644,7 +644,7 @@ public final class Util {
normalizedTag
=
language
;
normalizedTag
=
language
;
}
}
normalizedTag
=
Ascii
.
toLowerCase
(
normalizedTag
);
normalizedTag
=
Ascii
.
toLowerCase
(
normalizedTag
);
String
mainLanguage
=
Util
.
splitAtFirst
(
normalizedTag
,
"-"
)[
0
];
String
mainLanguage
=
splitAtFirst
(
normalizedTag
,
"-"
)[
0
];
if
(
languageTagReplacementMap
==
null
)
{
if
(
languageTagReplacementMap
==
null
)
{
languageTagReplacementMap
=
createIsoLanguageReplacementMap
();
languageTagReplacementMap
=
createIsoLanguageReplacementMap
();
}
}
...
@@ -1655,9 +1655,9 @@ public final class Util {
...
@@ -1655,9 +1655,9 @@ public final class Util {
case
7
:
case
7
:
return
AudioFormat
.
CHANNEL_OUT_5POINT1
|
AudioFormat
.
CHANNEL_OUT_BACK_CENTER
;
return
AudioFormat
.
CHANNEL_OUT_5POINT1
|
AudioFormat
.
CHANNEL_OUT_BACK_CENTER
;
case
8
:
case
8
:
if
(
Util
.
SDK_INT
>=
23
)
{
if
(
SDK_INT
>=
23
)
{
return
AudioFormat
.
CHANNEL_OUT_7POINT1_SURROUND
;
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.
// Equal to AudioFormat.CHANNEL_OUT_7POINT1_SURROUND, which is hidden before Android M.
return
AudioFormat
.
CHANNEL_OUT_5POINT1
return
AudioFormat
.
CHANNEL_OUT_5POINT1
|
AudioFormat
.
CHANNEL_OUT_SIDE_LEFT
|
AudioFormat
.
CHANNEL_OUT_SIDE_LEFT
...
@@ -1940,7 +1940,7 @@ public final class Util {
...
@@ -1940,7 +1940,7 @@ public final class Util {
public
static
@ContentType
int
inferContentTypeForUriAndMimeType
(
public
static
@ContentType
int
inferContentTypeForUriAndMimeType
(
Uri
uri
,
@Nullable
String
mimeType
)
{
Uri
uri
,
@Nullable
String
mimeType
)
{
if
(
mimeType
==
null
)
{
if
(
mimeType
==
null
)
{
return
Util
.
inferContentType
(
uri
);
return
inferContentType
(
uri
);
}
}
switch
(
mimeType
)
{
switch
(
mimeType
)
{
case
MimeTypes
.
APPLICATION_MPD
:
case
MimeTypes
.
APPLICATION_MPD
:
...
@@ -2264,7 +2264,7 @@ public final class Util {
...
@@ -2264,7 +2264,7 @@ public final class Util {
/** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */
/** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */
public
static
Locale
getDefaultDisplayLocale
()
{
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 {
...
@@ -2336,7 +2336,7 @@ public final class Util {
* @return Whether the app is running on an automotive device.
* @return Whether the app is running on an automotive device.
*/
*/
public
static
boolean
isAutomotive
(
Context
context
)
{
public
static
boolean
isAutomotive
(
Context
context
)
{
return
Util
.
SDK_INT
>=
23
return
SDK_INT
>=
23
&&
context
.
getPackageManager
().
hasSystemFeature
(
PackageManager
.
FEATURE_AUTOMOTIVE
);
&&
context
.
getPackageManager
().
hasSystemFeature
(
PackageManager
.
FEATURE_AUTOMOTIVE
);
}
}
...
@@ -2354,7 +2354,7 @@ public final class Util {
...
@@ -2354,7 +2354,7 @@ public final class Util {
*/
*/
public
static
Point
getCurrentDisplayModeSize
(
Context
context
)
{
public
static
Point
getCurrentDisplayModeSize
(
Context
context
)
{
@Nullable
Display
defaultDisplay
=
null
;
@Nullable
Display
defaultDisplay
=
null
;
if
(
Util
.
SDK_INT
>=
17
)
{
if
(
SDK_INT
>=
17
)
{
@Nullable
@Nullable
DisplayManager
displayManager
=
DisplayManager
displayManager
=
(
DisplayManager
)
context
.
getSystemService
(
Context
.
DISPLAY_SERVICE
);
(
DisplayManager
)
context
.
getSystemService
(
Context
.
DISPLAY_SERVICE
);
...
@@ -2402,7 +2402,7 @@ public final class Util {
...
@@ -2402,7 +2402,7 @@ public final class Util {
// vendor.display-size instead.
// vendor.display-size instead.
@Nullable
@Nullable
String
displaySize
=
String
displaySize
=
Util
.
SDK_INT
<
28
SDK_INT
<
28
?
getSystemProperty
(
"sys.display-size"
)
?
getSystemProperty
(
"sys.display-size"
)
:
getSystemProperty
(
"vendor.display-size"
);
:
getSystemProperty
(
"vendor.display-size"
);
// If we managed to read the display size, attempt to parse it.
// If we managed to read the display size, attempt to parse it.
...
@@ -2423,17 +2423,17 @@ public final class Util {
...
@@ -2423,17 +2423,17 @@ public final class Util {
}
}
// Sony Android TVs advertise support for 4k output via a system feature.
// Sony Android TVs advertise support for 4k output via a system feature.
if
(
"Sony"
.
equals
(
Util
.
MANUFACTURER
)
if
(
"Sony"
.
equals
(
MANUFACTURER
)
&&
Util
.
MODEL
.
startsWith
(
"BRAVIA"
)
&&
MODEL
.
startsWith
(
"BRAVIA"
)
&&
context
.
getPackageManager
().
hasSystemFeature
(
"com.sony.dtv.hardware.panel.qfhd"
))
{
&&
context
.
getPackageManager
().
hasSystemFeature
(
"com.sony.dtv.hardware.panel.qfhd"
))
{
return
new
Point
(
3840
,
2160
);
return
new
Point
(
3840
,
2160
);
}
}
}
}
Point
displaySize
=
new
Point
();
Point
displaySize
=
new
Point
();
if
(
Util
.
SDK_INT
>=
23
)
{
if
(
SDK_INT
>=
23
)
{
getDisplaySizeV23
(
display
,
displaySize
);
getDisplaySizeV23
(
display
,
displaySize
);
}
else
if
(
Util
.
SDK_INT
>=
17
)
{
}
else
if
(
SDK_INT
>=
17
)
{
getDisplaySizeV17
(
display
,
displaySize
);
getDisplaySizeV17
(
display
,
displaySize
);
}
else
{
}
else
{
getDisplaySizeV16
(
display
,
displaySize
);
getDisplaySizeV16
(
display
,
displaySize
);
...
@@ -2652,7 +2652,7 @@ public final class Util {
...
@@ -2652,7 +2652,7 @@ public final class Util {
@RequiresApi
(
24
)
@RequiresApi
(
24
)
private
static
String
[]
getSystemLocalesV24
(
Configuration
config
)
{
private
static
String
[]
getSystemLocalesV24
(
Configuration
config
)
{
return
Util
.
split
(
config
.
getLocales
().
toLanguageTags
(),
","
);
return
split
(
config
.
getLocales
().
toLanguageTags
(),
","
);
}
}
@RequiresApi
(
21
)
@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