summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mark Renouf <mrenouf@google.com> 2024-05-02 16:06:13 -0400
committer Mark Renouf <mrenouf@google.com> 2024-05-02 16:47:49 -0400
commit5b6870398d1c573a946736f3fca8273678de46f2 (patch)
tree584500c2401fdfeefef5742185365d9b13992807
parent8bcb1b4b6811ad123f6c37068577fd85228d6674 (diff)
Clean up onApplyWindowInsets and apply in all cases
Profile pager empty state inset padding was only applied when 'hasWorkProfile' was true. This seems to have been an alias for "are tabs shown", however this is no longer correct. Instead the "empty content" padding should include system bar insets unconditionally. For a test case, enable 3-button nav, add a private profile and test sharing content which has no matching apps (ShareTest with no text). The empty state view is shown partially beneath the nav bar. Bug: 338447666 Test: manually; see change description Flag: com.android.intentresolver.fix_empty_state_padding Change-Id: I8a65214095de3517330d75e20da9bf0d35a82bac
-rw-r--r--aconfig/FeatureFlags.aconfig6
-rw-r--r--java/src/com/android/intentresolver/ChooserActivity.java28
2 files changed, 17 insertions, 17 deletions
diff --git a/aconfig/FeatureFlags.aconfig b/aconfig/FeatureFlags.aconfig
index 4d787ea2..b7d9ea0d 100644
--- a/aconfig/FeatureFlags.aconfig
+++ b/aconfig/FeatureFlags.aconfig
@@ -52,3 +52,9 @@ flag {
purpose: PURPOSE_BUGFIX
}
}
+flag {
+ name: "fix_empty_state_padding"
+ namespace: "intentresolver"
+ description: "Always apply systemBar window insets regardless of profiles present"
+ bug: "338447666"
+}
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java
index ccf2a3dc..1922c05c 100644
--- a/java/src/com/android/intentresolver/ChooserActivity.java
+++ b/java/src/com/android/intentresolver/ChooserActivity.java
@@ -1170,19 +1170,6 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
safelyStartActivityAsUser(cti, user, null);
}
- protected WindowInsets super_onApplyWindowInsets(View v, WindowInsets insets) {
- mSystemWindowInsets = insets.getSystemWindowInsets();
-
- mResolverDrawerLayout.setPadding(mSystemWindowInsets.left, mSystemWindowInsets.top,
- mSystemWindowInsets.right, 0);
-
- // Need extra padding so the list can fully scroll up
- // To accommodate for window insets
- applyFooterView(mSystemWindowInsets.bottom);
-
- return insets.consumeSystemWindowInsets();
- }
-
@Override // ResolverListCommunicator
public final void onHandlePackagesChanged(ResolverListAdapter listAdapter) {
if (!mChooserMultiProfilePagerAdapter.onHandlePackagesChanged(
@@ -2649,16 +2636,23 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
}
protected WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
- if (mProfiles.getWorkProfilePresent()) {
+ mSystemWindowInsets = insets.getInsets(WindowInsets.Type.systemBars());
+ if (mFeatureFlags.fixEmptyStatePadding() || mProfiles.getWorkProfilePresent()) {
mChooserMultiProfilePagerAdapter
- .setEmptyStateBottomOffset(insets.getSystemWindowInsetBottom());
+ .setEmptyStateBottomOffset(mSystemWindowInsets.bottom);
}
- WindowInsets result = super_onApplyWindowInsets(v, insets);
+ mResolverDrawerLayout.setPadding(mSystemWindowInsets.left, mSystemWindowInsets.top,
+ mSystemWindowInsets.right, 0);
+
+ // Need extra padding so the list can fully scroll up
+ // To accommodate for window insets
+ applyFooterView(mSystemWindowInsets.bottom);
+
if (mResolverDrawerLayout != null) {
mResolverDrawerLayout.requestLayout();
}
- return result;
+ return WindowInsets.CONSUMED;
}
private void setHorizontalScrollingEnabled(boolean enabled) {