summaryrefslogtreecommitdiff
path: root/java/tests/src
diff options
context:
space:
mode:
author Andrey Epin <ayepin@google.com> 2022-11-28 11:54:33 -0800
committer Andrey Epin <ayepin@google.com> 2022-12-28 18:50:25 +0000
commitf9a8f40c27f1b0188cbfa9b20af44ea04614cf93 (patch)
treea6f9c93cdc5d039ac248854b1292471ea90300ca /java/tests/src
parentebe0fe5ad0528f2f6e90ee24e3041054fac1ed22 (diff)
ResolverDrawerLayout: unify mCollapsibleHeight calculation.
(an ag/20419209 cherry-pick) mCollapsibleHeight was calculated differently in two places: in onMeasure() and in setCollapsibleHeightReserved() methods. The latter is updated to use the same logic as the former. There was two particular aspects of the onMeasure() logic: - It calculated mCollapsibleHeight and mUncollapsibleHeight so the sum of the two yields the total children height; - mCollapsibleHeight was calculated based on the total childrens height. Thus a correct mCollapsibleHeight calculation in the setCollapsibleHeightReserved() method would need to know the total children height and maintain the invariant that mCollapsibleHeight + mUncollapsibleHeight would yield that height. Instead of deriving the total children height as a sum of mCollapsibleHeight + mUncollapsibleHeight, a new field, mHeightUsed, is added to store the total children height and mUncollapsibleHeight is deleted. This way we don’t have to also update mUncollapsibleHeight in setCollapsibleHeightReserved() plus mUncollapsibleHeight was always used as a part of the sum mCollapsibleHeight + mUncollapsibleHeight so it is a natural replacement. Flag: IntentResolver package entirely behind the CHOOSER_UNBUNDLED which is in teamfood Bug: 256869196 Test: reproduce the issue in a separate test environment, make sure that the change acutally fixes it Test: manual Chooser smoke test Test: manual Resolver smoke test Test: atest FrameworksCoreTests:ChooserActivityTest Test: atest FrameworksCoreTests:ResolverActivityTest Change-Id: Id169bd1c4b9f7270d75baab2e5e3841b76ab00e6
Diffstat (limited to 'java/tests/src')
-rw-r--r--java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java34
1 files changed, 16 insertions, 18 deletions
diff --git a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java
index b7eecb3f..ca2e8ccd 100644
--- a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java
+++ b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityWorkProfileTest.java
@@ -24,6 +24,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
+import static com.android.intentresolver.ChooserWrapperActivity.sOverrides;
import static com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.ExpectedBlocker.NO_BLOCKER;
import static com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.ExpectedBlocker.PERSONAL_PROFILE_ACCESS_BLOCKER;
import static com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.ExpectedBlocker.PERSONAL_PROFILE_SHARE_BLOCKER;
@@ -31,7 +32,6 @@ import static com.android.intentresolver.UnbundledChooserActivityWorkProfileTest
import static com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.ExpectedBlocker.WORK_PROFILE_SHARE_BLOCKER;
import static com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.Tab.PERSONAL;
import static com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.Tab.WORK;
-import static com.android.intentresolver.ChooserWrapperActivity.sOverrides;
import static org.hamcrest.CoreMatchers.not;
import static org.mockito.ArgumentMatchers.eq;
@@ -45,9 +45,9 @@ import androidx.test.InstrumentationRegistry;
import androidx.test.espresso.NoMatchingViewException;
import androidx.test.rule.ActivityTestRule;
-import com.android.internal.R;
import com.android.intentresolver.ResolverActivity.ResolvedComponentInfo;
import com.android.intentresolver.UnbundledChooserActivityWorkProfileTest.TestCase.Tab;
+import com.android.internal.R;
import org.junit.Before;
import org.junit.Rule;
@@ -129,14 +129,13 @@ public class UnbundledChooserActivityWorkProfileTest {
/* tab= */ WORK,
/* expectedBlocker= */ NO_BLOCKER
),
-// TODO(b/256869196) ChooserActivity goes into requestLayout loop
-// new TestCase(
-// /* isSendAction= */ true,
-// /* hasCrossProfileIntents= */ false,
-// /* myUserHandle= */ WORK_USER_HANDLE,
-// /* tab= */ WORK,
-// /* expectedBlocker= */ NO_BLOCKER
-// ),
+ new TestCase(
+ /* isSendAction= */ true,
+ /* hasCrossProfileIntents= */ false,
+ /* myUserHandle= */ WORK_USER_HANDLE,
+ /* tab= */ WORK,
+ /* expectedBlocker= */ NO_BLOCKER
+ ),
new TestCase(
/* isSendAction= */ true,
/* hasCrossProfileIntents= */ true,
@@ -158,14 +157,13 @@ public class UnbundledChooserActivityWorkProfileTest {
/* tab= */ PERSONAL,
/* expectedBlocker= */ NO_BLOCKER
),
-// TODO(b/256869196) ChooserActivity goes into requestLayout loop
-// new TestCase(
-// /* isSendAction= */ true,
-// /* hasCrossProfileIntents= */ false,
-// /* myUserHandle= */ WORK_USER_HANDLE,
-// /* tab= */ PERSONAL,
-// /* expectedBlocker= */ PERSONAL_PROFILE_SHARE_BLOCKER
-// ),
+ new TestCase(
+ /* isSendAction= */ true,
+ /* hasCrossProfileIntents= */ false,
+ /* myUserHandle= */ WORK_USER_HANDLE,
+ /* tab= */ PERSONAL,
+ /* expectedBlocker= */ PERSONAL_PROFILE_SHARE_BLOCKER
+ ),
new TestCase(
/* isSendAction= */ true,
/* hasCrossProfileIntents= */ true,