summaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-09 16:06:04 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-09 16:06:04 -0700
commite195af3a008721a130abdb6f78891f610fb71ce5 (patch)
tree29a842734ee7526df49eb21704c8f5407b1359fd /src/com
parent11966310fbb7fe63cfc272e40d9d556c5501e45e (diff)
parente8faa129879de450efc0b8389000e73b05b01527 (diff)
Merge "Add WindowInsets back on non-freeform window devices" into main
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/documentsui/BaseActivity.java41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/com/android/documentsui/BaseActivity.java b/src/com/android/documentsui/BaseActivity.java
index 0b5d96da9..790feeac4 100644
--- a/src/com/android/documentsui/BaseActivity.java
+++ b/src/com/android/documentsui/BaseActivity.java
@@ -569,23 +569,32 @@ public abstract class BaseActivity
View root = findViewById(R.id.coordinator_layout);
root.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
- root.setOnApplyWindowInsetsListener((v, insets) -> {
- root.setPadding(insets.getSystemWindowInsetLeft(),
- insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), 0);
-
- // When use_material3 flag is ON, no additional bottom gap in full screen mode.
- if (!isUseMaterial3FlagEnabled()) {
- View saveContainer = findViewById(R.id.container_save);
- saveContainer.setPadding(
- 0, 0, 0, insets.getSystemWindowInsetBottom());
-
- View rootsContainer = findViewById(R.id.container_roots);
- rootsContainer.setPadding(
- 0, 0, 0, insets.getSystemWindowInsetBottom());
- }
+ root.setOnApplyWindowInsetsListener(
+ (v, insets) -> {
+ root.setPadding(
+ insets.getSystemWindowInsetLeft(),
+ insets.getSystemWindowInsetTop(),
+ insets.getSystemWindowInsetRight(),
+ 0);
+
+ // When use_material3 flag is ON and FEATURE_FREEFORM_WINDOW_MANAGEMENT is
+ // enabled, then there should not be any additional bottom gap in full screen
+ // mode. Otherwise need to take into account the system window insets such as
+ // the bottom swipe up navigation gesture.
+ if (!isUseMaterial3FlagEnabled()
+ || !getApplicationContext()
+ .getPackageManager()
+ .hasSystemFeature(
+ PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT)) {
+ View saveContainer = findViewById(R.id.container_save);
+ saveContainer.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom());
+
+ View rootsContainer = findViewById(R.id.container_roots);
+ rootsContainer.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom());
+ }
- return insets.consumeSystemWindowInsets();
- });
+ return insets.consumeSystemWindowInsets();
+ });
getWindow().setNavigationBarDividerColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= 29) {