From 4c0513d8c77bd85dee791cbc1f22ee136f758e33 Mon Sep 17 00:00:00 2001 From: arangelov Date: Thu, 5 Mar 2020 22:24:13 +0000 Subject: [PATCH] Prevent intent resolver from changing height when no app targets If we select the inactive tab, and there are no resolved targets, the intent resolver changes its height for a few frames. This is because first we show and reload the list view as we switch to the other, and then in onPostListReady we show the empty state screen for no apps available. There are few frames between these two events, when the list view has a height of 0. That's when the ResolverViewPager recalculates its height and thus reduces the intent resolver height. Then as the empty state screen is shown, the proper intent resolver height is restored. The fix is to move the showListView call to onPostListReady. Test: manual Fixes: 150888674 Change-Id: I685568e183bbd5708242e1228195ec6b09023272 --- .../android/internal/app/AbstractMultiProfilePagerAdapter.java | 3 +-- core/java/com/android/internal/app/ResolverActivity.java | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java b/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java index 18d77386d063b..0a1094bcc9af8 100644 --- a/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java +++ b/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java @@ -327,7 +327,6 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { return false; } } - showListView(activeListAdapter); return activeListAdapter.rebuildList(doPostProcessing); } @@ -408,7 +407,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { emptyStateView.findViewById(R.id.resolver_empty_state_progress).setVisibility(View.GONE); } - private void showListView(ResolverListAdapter activeListAdapter) { + protected void showListView(ResolverListAdapter activeListAdapter) { ProfileDescriptor descriptor = getItem( userHandleToPageIndex(activeListAdapter.getUserHandle())); descriptor.rootView.findViewById(R.id.resolver_list).setVisibility(View.VISIBLE); diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index bd7b47d853d29..075a58b0403e8 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -989,6 +989,8 @@ public class ResolverActivity extends Activity implements } if (shouldShowEmptyState(listAdapter)) { mMultiProfilePagerAdapter.showEmptyState(listAdapter); + } else { + mMultiProfilePagerAdapter.showListView(listAdapter); } if (doPostProcessing) { if (mMultiProfilePagerAdapter.getCurrentUserHandle().getIdentifier()