title: How adjust my app in Android 11 in cell phone screen?
body: <p>Before Android 11, I've adjusted my app to fullscreen easily</p>
  <p>My old phone had the camera hole and base buttons outside the screen area, my new phone has a camera hole and the base buttons inside a screen.</p>
  <p>With few settings, my app was fullscreen in the old phone.</p>
  <p><strong>Styles.xml</strong></p>
  <pre><code>&lt;style name=&quot;AppTheme.NoActionBar&quot;&gt;
          &lt;item name=&quot;windowActionBar&quot;&gt;false&lt;/item&gt;   
          &lt;item name=&quot;windowNoTitle&quot;&gt;true&lt;/item&gt;    
          &lt;item name=&quot;android:windowFullscreen&quot;&gt;true&lt;/item&gt;
          &lt;item name=&quot;android:windowContentOverlay&quot;&gt;@null&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  <p><strong>AndroidManifest.xml</strong></p>
  <pre><code>&lt;application
     ...       
     android:theme=&quot;@style/AppTheme.NoActionBar&quot;&gt;
  &lt;/application&gt;
  </code></pre>
  <p>In my new phone with  <em>Android 11</em>, I've searched many <code>Stackoverflow</code> question. I've tried many different solutions.  In the end, I put in my app the following code in that start of <code>OnCreate()</code>.</p>
  <pre><code>if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.P) {
    window.attributes.layoutInDisplayCutoutMode =
        WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
  }
  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.R) {
      WindowCompat.setDecorFitsSystemWindows(window, false)
   else {
        @Suppress(&quot;DEPRECATION&quot;)
        window.setFlags(
          WindowManager.LayoutParams.FLAG_FULLSCREEN,
          WindowManager.LayoutParams.FLAG_FULLSCREEN
        )
      }
  </code></pre>
  <p>I wanted a narrow margin near the base buttons and the camera hole, like Chrome.</p>
  <p>But all can I get is a wide margin between the app and button (downward) and between the app and the camera hole (upward):</p>
  <p><a href="https://i.stack.imgur.com/qHxyJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qHxyJ.png" alt="App 1" /></a></p>
  <p>But I would want a narrow  margin:</p>
  <p><a href="https://i.stack.imgur.com/3PEds.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3PEds.png" alt="Ideal" /></a></p>
  <p>similar to Chrome browser for Android:</p>
  <p><a href="https://i.stack.imgur.com/Xbjtm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xbjtm.png" alt="My wish" /></a></p>
  <p>How can I do this programatically?</p>
  <p>I haven't been able to find a single clue to my problem in Internet (and StackOverflow)</p>
  <p>I also haven't been able to figure out how to identify if a given cell phone has the camera hole on the screen or if it has the base buttons on the screen. It looks like it's based on <a href="https://developer.android.com/reference/kotlin/android/view/DisplayCutout" rel="nofollow noreferrer"><code>DisplayCutout</code></a>, <code>WindowInsets</code> and <code>boundingRectTop</code> and <code>boundingRectBottom</code>, but there is no real and clear usage example in Internet.</p>