Commit 79055066 by Oliver Woodman

On Sony Bravia devices check for 4k panel.

Documentation: https://developer.sony.com/develop/tvs/android-tv/design-guide/

On API 23 we should also check Display.Mode (where supported).

Issue: #800
parent 952bd4e7
......@@ -55,11 +55,9 @@ public final class VideoFormatSelectorUtil {
public static int[] selectVideoFormatsForDefaultDisplay(Context context,
List<? extends FormatWrapper> formatWrappers, String[] allowedContainerMimeTypes,
boolean filterHdFormats) throws DecoderQueryException {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
Point displaySize = getDisplaySize(display);
Point viewportSize = getViewportSize(context);
return selectVideoFormats(formatWrappers, allowedContainerMimeTypes, filterHdFormats, true,
displaySize.x, displaySize.y);
viewportSize.x, viewportSize.y);
}
/**
......@@ -184,6 +182,19 @@ public final class VideoFormatSelectorUtil {
}
}
private static Point getViewportSize(Context context) {
// Before API 23 the platform Display object does not provide a way to identify Android TVs that
// can show 4k resolution in a SurfaceView, so check for supported devices here.
// See also https://developer.sony.com/develop/tvs/android-tv/design-guide/.
if (Util.MODEL != null && Util.MODEL.startsWith("BRAVIA")
&& context.getPackageManager().hasSystemFeature("com.sony.dtv.hardware.panel.qfhd")) {
return new Point(3840, 2160);
}
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
return getDisplaySize(windowManager.getDefaultDisplay());
}
private static Point getDisplaySize(Display display) {
Point displaySize = new Point();
if (Util.SDK_INT >= 17) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment