From 585bffb7ec38c3e3ee98cd829fe38d69cc0dea42 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Fri, 1 Dec 2023 22:42:35 +0000 Subject: [PATCH] Select the correct tab What the clients send over is the tab based on user, but the correct tab (position) wise needs to figured out. Bug: 314371622 Test: manual Change-Id: Ib6ebefb898b1c5678c14157333dc2b2ebc198ed8 --- .../dashboard/profileselector/ProfileSelectFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java index 3321d50b8b1..0348e11da0e 100644 --- a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java +++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java @@ -130,7 +130,6 @@ public abstract class ProfileSelectFragment extends DashboardFragment { if (titleResId > 0) { activity.setTitle(titleResId); } - final int selectedTab = getTabId(activity, getArguments()); final View tabContainer = mContentView.findViewById(R.id.tab_container); mViewPager = tabContainer.findViewById(R.id.view_pager); @@ -149,6 +148,7 @@ public abstract class ProfileSelectFragment extends DashboardFragment { } ); tabContainer.setVisibility(View.VISIBLE); + final int selectedTab = getTabId(activity, getArguments()); final TabLayout.Tab tab = tabs.getTabAt(selectedTab); tab.select(); @@ -228,7 +228,7 @@ public abstract class ProfileSelectFragment extends DashboardFragment { if (bundle != null) { final int extraTab = bundle.getInt(SettingsActivity.EXTRA_SHOW_FRAGMENT_TAB, -1); if (extraTab != -1) { - return extraTab; + return ((ViewPagerAdapter) mViewPager.getAdapter()).getTabForPosition(extraTab); } final int userId = bundle.getInt(EXTRA_USER_ID, UserHandle.SYSTEM.getIdentifier()); final boolean isWorkProfile = UserManager.get(activity).isManagedProfile(userId);