title: How to get DisplayCutout height when creating an Activity?
body: <p>I have a game with full screen <a href="https://developer.android.com/reference/android/view/SurfaceView" rel="noreferrer">SurfaceView</a> (Portrait) and thread that renders continously on the surface. </p>
  
  <p>The SurfaceView is initialized <code>onCreate</code> and its size is determined by the width and height of the screen in pixels.</p>
  
  <p>After it's created, it is set as the content view of the Game Activity (no XML definitions):</p>
  
  <pre><code>Bitmap frameBuffer = Bitmap.createBitmap(screenWidth, screenHeight, Config.ARGB_8888);
  
  MySurfaceView renderView = new MySurfaceView(this, frameBuffer);
  
  this.setContentView(renderView);
  </code></pre>
  
  <p>The problem is, height of the screen doesn't include Display Cutouts (for devices that have them) and is taller than the allowed drawing screen, because the renderView is placed below the cutout area and does not use it for rendering.</p>
  
  <p>I seek to find the real <code>screen height - display cutout height</code> so that I can make the frame buffer have that height.</p>
  
  <p>Do you know if there is way to get display cutout area height <code>onCreate</code>, the same way we're able to get navigation/status bar height. Below is a snippet that returns navigation bar height:</p>
  
  <pre><code>Resources resources = getResources();
  int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
  if (resourceId &gt; 0) {
      int navigationBarHeight = resources.getDimensionPixelSize(resourceId);
  }
  </code></pre>
  
  <p>Thank you for your help!</p>
  
  <p>--- UPDATE ---</p>
  
  <p>I will try to clarify the question more:</p>
  
  <p>1) <code>onCreate</code> a full screen portrait SurfaceView is created with the dimensions of the screen width and height (no XML)</p>
  
  <p>2) Immersive mode is enabled for API level > 19 (KitKat)</p>
  
  <p>3) Screen width and height is taken with Display.getSize() or Display.getRealSize() depending on API level</p>
  
  <p>4) On devices with Top Display Cutout the view is automatically placed below the cutout and bottom content is cut out, <strong>and this is the issue</strong></p>
  
  <p>5) I would like to get the height of the Display Cutout <code>onCreate</code>, so that I can create the SurfaceView height to be <code>screenHeight - displayCutoutHeight</code>.</p>
  
  <p>6) The problem boils down to finding the height of the Display Cutout.</p>