From db0c1f18c94d334db435e6ff92a3fba0335771f3 Mon Sep 17 00:00:00 2001 From: arangelov Date: Fri, 14 Feb 2020 17:35:12 +0000 Subject: [PATCH] Be more consistent with Q when the tabs feature flag is disabled. This change involves 2 things: - Check when there are apps on the other profile when deciding whether to autolaunch with the tabs disabled - Only take into account the rebuildInactiveTab result when the tabbed view is enabled. Otherwise it's always false and that always calls postRebuildList with false. Fixes: 149031386 Test: manual Change-Id: I166b3abca3c0da38b3c496b34f139107f6b56410 --- .../com/android/internal/app/ResolverActivity.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 5dc8b0b2b21d7..8f0ffd9d13525 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -1304,8 +1304,11 @@ public class ResolverActivity extends Activity implements + "cannot be null."); } // We partially rebuild the inactive adapter to determine if we should auto launch - boolean rebuildActiveCompleted = mMultiProfilePagerAdapter.rebuildActiveTab(true); - boolean rebuildInactiveCompleted = mMultiProfilePagerAdapter.rebuildInactiveTab(false); + boolean rebuildCompleted = mMultiProfilePagerAdapter.rebuildActiveTab(true); + if (hasWorkProfile() && ENABLE_TABBED_VIEW) { + boolean rebuildInactiveCompleted = mMultiProfilePagerAdapter.rebuildInactiveTab(false); + rebuildCompleted = rebuildCompleted && rebuildInactiveCompleted; + } if (useLayoutWithDefault()) { mLayoutId = R.layout.resolver_list_with_default; @@ -1314,7 +1317,7 @@ public class ResolverActivity extends Activity implements } setContentView(mLayoutId); mMultiProfilePagerAdapter.setupViewPager(findViewById(R.id.profile_pager)); - return postRebuildList(rebuildActiveCompleted && rebuildInactiveCompleted); + return postRebuildList(rebuildCompleted); } /** @@ -1378,6 +1381,10 @@ public class ResolverActivity extends Activity implements return false; } + if (mMultiProfilePagerAdapter.getActiveListAdapter().getOtherProfile() != null) { + return false; + } + // Only one target, so we're a candidate to auto-launch! final TargetInfo target = mMultiProfilePagerAdapter.getActiveListAdapter() .targetInfoForPosition(0, false);