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
e7a7235a
authored
Sep 02, 2021
by
olly
Committed by
Christos Tsilopoulos
Sep 16, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove max API level for reading TV resolution from system properties
PiperOrigin-RevId: 394415421
parent
4a7aaaa3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 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 @
e7a7235a
...
@@ -2280,21 +2280,20 @@ public final class Util {
...
@@ -2280,21 +2280,20 @@ public final class Util {
* @return The size of the current mode, in pixels.
* @return The size of the current mode, in pixels.
*/
*/
public
static
Point
getCurrentDisplayModeSize
(
Context
context
,
Display
display
)
{
public
static
Point
getCurrentDisplayModeSize
(
Context
context
,
Display
display
)
{
if
(
Util
.
SDK_INT
<=
29
&&
display
.
getDisplayId
()
==
Display
.
DEFAULT_DISPLAY
&&
isTv
(
context
))
{
if
(
display
.
getDisplayId
()
==
Display
.
DEFAULT_DISPLAY
&&
isTv
(
context
))
{
// On Android TVs it is common for the UI to be configured for a lower resolution than
// On Android TVs it's common for the UI to be driven at a lower resolution than the physical
// SurfaceViews can output. Before API 26 the Display object does not provide a way to
// resolution of the display (e.g., driving the UI at 1080p when the display is 4K).
// identify this case, and up to and including API 28 many devices still do not correctly set
// SurfaceView outputs are still able to use the full physical resolution on such devices.
// their hardware compositor output size.
//
// Prior to API level 26, the Display object did not provide a way to obtain the true physical
// Sony Android TVs advertise support for 4k output via a system feature.
// resolution of the display. From API level 26, Display.getMode().getPhysical[Width|Height]
if
(
"Sony"
.
equals
(
Util
.
MANUFACTURER
)
// is expected to return the display's true physical resolution, but we still see devices
&&
Util
.
MODEL
.
startsWith
(
"BRAVIA"
)
// setting their hardware compositor output size incorrectly, which makes this unreliable.
&&
context
.
getPackageManager
().
hasSystemFeature
(
"com.sony.dtv.hardware.panel.qfhd"
))
{
// Hence for TV devices, we try and read the display's true physical resolution from system
return
new
Point
(
3840
,
2160
);
// properties.
}
//
// From API level 28, Treble may prevent the system from writing sys.display-size, so we check
// Otherwise check the system property for display size. From API 28 treble may prevent the
// vendor.display-size instead.
// system from writing sys.display-size so we check vendor.display-size instead.
@Nullable
@Nullable
String
displaySize
=
String
displaySize
=
Util
.
SDK_INT
<
28
Util
.
SDK_INT
<
28
...
@@ -2316,6 +2315,13 @@ public final class Util {
...
@@ -2316,6 +2315,13 @@ public final class Util {
}
}
Log
.
e
(
TAG
,
"Invalid display size: "
+
displaySize
);
Log
.
e
(
TAG
,
"Invalid display size: "
+
displaySize
);
}
}
// Sony Android TVs advertise support for 4k output via a system feature.
if
(
"Sony"
.
equals
(
Util
.
MANUFACTURER
)
&&
Util
.
MODEL
.
startsWith
(
"BRAVIA"
)
&&
context
.
getPackageManager
().
hasSystemFeature
(
"com.sony.dtv.hardware.panel.qfhd"
))
{
return
new
Point
(
3840
,
2160
);
}
}
}
Point
displaySize
=
new
Point
();
Point
displaySize
=
new
Point
();
...
...
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