Fix flicker for AppDataUsage when zero usage

When the page is entered from the AppInfoDashboardFragment, there is no
way to know whether the cycle data is available before finished the
async loading. If it's zero usage, the cycle spinner will be removed,
which cause a flicker.

Temporarily disable the preference list's animator before initial
page updates can solve this issue.

This also fix another flicker on this page when the background data is
off.

Fix: 233963355
Test: manual visual test
Change-Id: I795ed95e15bb3216fa17adfd4f57faf5fd92fa00
This commit is contained in:
Chaohui Wang
2022-05-27 00:20:45 +08:00
parent f6ea9c99b3
commit c2dacf1b75
2 changed files with 34 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ import androidx.fragment.app.FragmentActivity;
import androidx.preference.Preference;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.applications.AppInfoBase;
import com.android.settings.testutils.FakeFeatureFactory;
@@ -240,6 +241,7 @@ public class AppDataUsageTest {
ReflectionHelpers.setField(mFragment, "mUnrestrictedData", unrestrictedDataPref);
ReflectionHelpers.setField(mFragment, "mDataSaverBackend", dataSaverBackend);
ReflectionHelpers.setField(mFragment.services, "mPolicyManager", networkPolicyManager);
when(mFragment.getListView()).thenReturn(mock(RecyclerView.class));
ShadowRestrictedLockUtilsInternal.setRestricted(true);
doReturn(NetworkPolicyManager.POLICY_NONE).when(networkPolicyManager)