title: Display.getSupportedModes() returns only 1080p display mode on 4K Android TV
body: <p>Am recently adding support for 4K in my app for Android TV users. My test device is SONY KD-49XF9005. While the built-in image viewer, as well as YouTube, can display in 4K without issue, I've got no luck getting it to work for my app so far.</p>
  
  <p>My app uses a GLSurfaceView to render images. I've followed <a href="https://developer.android.com/about/versions/marshmallow/android-6.0#4K-display" rel="noreferrer" title="here">the 4K Display Mode API guide</a>, and with that I hope to be able to select one of the 4K display modes available on my TV so that my GLSurfaceView can draw in physical resolution (code snippet shown below). However, the API constantly returns me one and only one display mode i.e. 1080p. This really bothers me, the hardware should support it as other built-in apps can use 4K, why doesn't it return a 4K display mode for my app?</p>
  
  <p>I've also read through all relevant Android TV developer guide and wasn't able to find anything special. I'd really appreciate if anyone can shred me some light on this. Thanks!</p>
  
  <pre><code>public static void select4kDisplayMode(Context context, Window window) {
      if (Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.M) {
          return;
      }
  
      WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
      Display display = windowManager.getDefaultDisplay();
      Display.Mode[] modes = display.getSupportedModes();
      if (modes == null) {
          return;
      }
  
      Display.Mode selected = null;
      long max = 0;
      for (Display.Mode mode : modes) {
          FL.d(TAG, "available display mode: Mode %d: %dx%d/%.1ffps", mode.getModeId(),
                  mode.getPhysicalWidth(), mode.getPhysicalHeight(),
                  mode.getRefreshRate());
          long val = mode.getPhysicalWidth() * mode.getPhysicalHeight();
          if (val &gt; max) {
              max = val;
              selected = mode;
          }
      }
      if (selected != null) {
          WindowManager.LayoutParams params = window.getAttributes();
          params.preferredDisplayModeId = selected.getModeId();
          window.setAttributes(params);
  
          FL.d(TAG, "selected display mode: Mode %d: %dx%d/%.1ffps", selected.getModeId(),
                  selected.getPhysicalWidth(), selected.getPhysicalHeight(),
                  selected.getRefreshRate());
      }
  }
  </code></pre>