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

        Issue Links

          For Gerrit Dashboard: QTBUG-114437
          # Subject Branch Project Status CR V

          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