Loading core/java/com/android/internal/app/ResolverActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -1603,6 +1603,11 @@ public class ResolverActivity extends Activity implements List<DisplayResolveInfo> otherProfileList = mMultiProfilePagerAdapter.getInactiveListAdapter().mDisplayList; if (sameProfileList.isEmpty()) { Log.d(TAG, "No targets in the current profile"); return false; } if (otherProfileList.size() != 1) { Log.d(TAG, "Found " + otherProfileList.size() + " resolvers in the other profile"); return false; Loading core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java +30 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import static org.testng.Assert.assertFalse; import static org.testng.Assert.fail; import android.content.Intent; import android.content.pm.ResolveInfo; Loading @@ -52,6 +53,7 @@ import android.widget.TextView; import androidx.test.InstrumentationRegistry; import androidx.test.espresso.Espresso; import androidx.test.espresso.NoMatchingViewException; import androidx.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -749,6 +751,34 @@ public class ResolverActivityTest { onView(withId(R.id.open_cross_profile)).check(matches(isDisplayed())); } @Test public void testMiniResolver_noCurrentProfileTarget() { ResolverActivity.ENABLE_TABBED_VIEW = true; markWorkProfileUserAvailable(); List<ResolvedComponentInfo> personalResolvedComponentInfos = createResolvedComponentsForTest(0); List<ResolvedComponentInfo> workResolvedComponentInfos = createResolvedComponentsForTest(1); setupResolverControllers(personalResolvedComponentInfos, workResolvedComponentInfos); Intent sendIntent = createSendImageIntent(); sendIntent.setType("TestType"); mActivityRule.launchActivity(sendIntent); waitForIdle(); // Need to ensure mini resolver doesn't trigger here. assertNotMiniResolver(); } private void assertNotMiniResolver() { try { onView(withId(R.id.open_cross_profile)).check(matches(isDisplayed())); } catch (NoMatchingViewException e) { return; } fail("Mini resolver present but shouldn't be"); } @Test public void testWorkTab_noAppsAvailable_workOff_noAppsAvailableEmptyStateShown() { // enable the work tab feature flag Loading Loading
core/java/com/android/internal/app/ResolverActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -1603,6 +1603,11 @@ public class ResolverActivity extends Activity implements List<DisplayResolveInfo> otherProfileList = mMultiProfilePagerAdapter.getInactiveListAdapter().mDisplayList; if (sameProfileList.isEmpty()) { Log.d(TAG, "No targets in the current profile"); return false; } if (otherProfileList.size() != 1) { Log.d(TAG, "Found " + otherProfileList.size() + " resolvers in the other profile"); return false; Loading
core/tests/coretests/src/com/android/internal/app/ResolverActivityTest.java +30 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import static org.testng.Assert.assertFalse; import static org.testng.Assert.fail; import android.content.Intent; import android.content.pm.ResolveInfo; Loading @@ -52,6 +53,7 @@ import android.widget.TextView; import androidx.test.InstrumentationRegistry; import androidx.test.espresso.Espresso; import androidx.test.espresso.NoMatchingViewException; import androidx.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -749,6 +751,34 @@ public class ResolverActivityTest { onView(withId(R.id.open_cross_profile)).check(matches(isDisplayed())); } @Test public void testMiniResolver_noCurrentProfileTarget() { ResolverActivity.ENABLE_TABBED_VIEW = true; markWorkProfileUserAvailable(); List<ResolvedComponentInfo> personalResolvedComponentInfos = createResolvedComponentsForTest(0); List<ResolvedComponentInfo> workResolvedComponentInfos = createResolvedComponentsForTest(1); setupResolverControllers(personalResolvedComponentInfos, workResolvedComponentInfos); Intent sendIntent = createSendImageIntent(); sendIntent.setType("TestType"); mActivityRule.launchActivity(sendIntent); waitForIdle(); // Need to ensure mini resolver doesn't trigger here. assertNotMiniResolver(); } private void assertNotMiniResolver() { try { onView(withId(R.id.open_cross_profile)).check(matches(isDisplayed())); } catch (NoMatchingViewException e) { return; } fail("Mini resolver present but shouldn't be"); } @Test public void testWorkTab_noAppsAvailable_workOff_noAppsAvailableEmptyStateShown() { // enable the work tab feature flag Loading