Fix janky in App info screen

If a Recycle view inside in a NestedScrollView,
The times of calling recyclerView#onCreateViewHolder()
is requal to its data set.

When there are large set of apps need to be shown,
RecyclerView will need to take many time to call
onCreateViewHolder for each item.

So, it causes the screen is janky or freeze UI when page
is loading large data set.

For now, we get rid of NestedScrollView, just use RecycleView
and AppBarLayout to have same bahavior for spinner.

Fixes: 124384314
Fixes: 123036231
Fixes: 122964660
Fixes: 123088178

Test: 1. Select show system in App info screen. Observe whether there
is any janky.
2. Select show system in App info screen, and then change device
orientation. Observer whether there is any janky.
3. Go to Settings > Apps & notifications> Advanced > Special app access >
Select "battery optimization", and then Tap drop down and select "all
apps". Observe whether ther is any janky.

Change-Id: Icd65e91eec3b32476d80cc12e9c4baa71151306a
This commit is contained in:
tmfang
2019-02-18 11:08:24 +08:00
parent b87dfdc189
commit 7fb266f30b
4 changed files with 39 additions and 47 deletions

View File

@@ -186,7 +186,6 @@ public class ManageApplications extends InstrumentedFragment
private View mLoadingContainer;
private View mListContainer;
private RecyclerView mRecyclerView;
private SearchView mSearchView;
// Size resource used for packages whose size computation failed for some reason
@@ -220,7 +219,7 @@ public class ManageApplications extends InstrumentedFragment
@VisibleForTesting
FilterSpinnerAdapter mFilterAdapter;
@VisibleForTesting
View mContentContainer;
RecyclerView mRecyclerView;
private View mRootView;
private Spinner mFilterSpinner;
@@ -330,7 +329,6 @@ public class ManageApplications extends InstrumentedFragment
Bundle savedInstanceState) {
mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
mContentContainer = mRootView.findViewById(R.id.content_container);
mListContainer = mRootView.findViewById(R.id.list_container);
if (mListContainer != null) {
// Create adapter and list view here
@@ -861,14 +859,14 @@ public class ManageApplications extends InstrumentedFragment
// overlapped by floating filter.
if (hasFilter) {
mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
mManageApplications.mContentContainer.setPadding(0 /* left */,
mManageApplications.mRecyclerView.setPadding(0 /* left */,
mContext.getResources().getDimensionPixelSize(
R.dimen.app_bar_height) /* top */,
0 /* right */,
0 /* bottom */);
} else {
mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
mManageApplications.mContentContainer.setPadding(0 /* left */, 0 /* top */,
mManageApplications.mRecyclerView.setPadding(0 /* left */, 0 /* top */,
0 /* right */,
0 /* bottom */);
}