From 53d920eccd9efeddae4a36c41ab31717cbc330ec Mon Sep 17 00:00:00 2001 From: Andrey Epin Date: Mon, 17 Jun 2024 17:32:10 -0700 Subject: Reclalculate drawer offset even when the targets list has not changed Shareousel has a variable-sized preview that affects the overall drawer offset. Therefore, we cannot early return from the offset calcualtion based solely on the condition that the targets list has not changed. Empirically, this introduces a minor overhead of the offset recalculation when the drawor is snapped to/from the top. Fix: 347316548 Test: manual testing with injected debug logging Flag: com.android.intentresolver.fix_missing_drawer_offset_calculation Change-Id: I69ec7a5e05fad0d6607e3614208b30910a3a17ba --- java/src/com/android/intentresolver/ChooserActivity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java index a5516fde..0fa5e758 100644 --- a/java/src/com/android/intentresolver/ChooserActivity.java +++ b/java/src/com/android/intentresolver/ChooserActivity.java @@ -2258,7 +2258,8 @@ public class ChooserActivity extends Hilt_ChooserActivity implements if (isLayoutUpdated || insetsChanged - || mLastNumberOfChildren != recyclerView.getChildCount()) { + || mLastNumberOfChildren != recyclerView.getChildCount() + || mFeatureFlags.fixMissingDrawerOffsetCalculation()) { mCurrAvailableWidth = availableWidth; if (isLayoutUpdated) { // It is very important we call setAdapter from here. Otherwise in some cases @@ -2277,7 +2278,8 @@ public class ChooserActivity extends Hilt_ChooserActivity implements return; } - if (mLastNumberOfChildren == recyclerView.getChildCount() && !insetsChanged) { + if (mLastNumberOfChildren == recyclerView.getChildCount() && !insetsChanged + && !mFeatureFlags.fixMissingDrawerOffsetCalculation()) { return; } -- cgit v1.2.3-59-g8ed1b