Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114437

REG: Android: Layout in display cut mode being overridden to short edges always

    XMLWordPrintable

Details

    • Android
    • df8e1cc73 (dev), b87c8a325 (6.6), adb7e2525 (dev), 07839c11f (6.5), 061a057d5 (6.6), 0e4110aa6 (tqtc/lts-6.2), 154771b42 (6.5), 30990b0dc (tqtc/lts-6.2)
    • 2023wk24FOQtforAndroid, 2023wk26FOQtforAndroid, 2023wk28FOQtforAndroid, 2023wk30FOQtforAndroid, 2023wk32FOQtforAndroid, 2023wk34FOQtforAndroid, 2023wk36FOQtforAndroid, 2023wk38FOQtforAndroid, 2023wk40FOQtforAndroid

    Description

      Consider a QQuickWindow in a fullscreen mode:

      window()->setVisibility(QWindow::FullScreen); 

      Consider the MainActivity that extends QtActivity which sets layoutInDisplayCutoutMode to 

       LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT : 

       

      public class MainActivity extends org.qtproject.qt.android.bindings.QtActivity {
      
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          requestWindowFeature(Window.FEATURE_NO_TITLE); //will hide the title
      
       WindowManager.LayoutParams attr = this.getWindow().getAttributes();
       attr.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT; 
      super.onCreate(savedInstanceState);
      }
      ...
      ...

      Expected behaviour is (like in 6.5.0) the QQuickWindow occupies fullscreen except the display cut out area at the top. 

      Actual behaviour is the layoutInDisplayCutoutMode is getting set to LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES silently which is intern having an adverse effect on the output of getSafeInsetTop,  which returns a greater value than the actual height of the displaycutout area or the actual safe inset top.

       public int getSafeInsetTop() {
              if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                  DisplayCutout displayCutout = this.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
                  if (displayCutout != null) {
                      return displayCutout.getSafeInsetTop();
                  }
              }
              return 0;
          } 

      The result of getSafeInsetTop is pushing the screen below when getSafeInsetTop is used to add a margin at the top, as window content is now overlapping with the status bar at top if top margin is not added.

       

      Attachments

        1. pixel6a-android14beta-implicit-fullscreenwithborders.mp4
          656 kB
          Rami Potinkara
        2. pixel6a-android14beta-qtbug98766-fullscreenwithborders.mp4
          653 kB
          Rami Potinkara
        3. Qt6.5.1_when margin_is_not_set.jpg
          42 kB
          Manasa M S
        4. Qt6.5.1.when_margin_set_using_getSafeInsetTop.jpg
          43 kB
          Manasa M S
        5. QTBUG-114437-diff-Qt650vsQt652.png
          23 kB
          Rami Potinkara
        6. Reproduce_Qt_Bug.zip
          21 kB
          Manasa M S
        7. studies-202308118.png
          33 kB
          Rami Potinkara
        8. With Qt 6.5.0_working_fine.jpg
          45 kB
          Manasa M S

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              rampe Rami Potinkara
              manasa.shreedhar Manasa M S
              Votes:
              1 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews