Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7be75226 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix storage page slow loading issue"

parents fa9e685f 47dcff42
Loading
Loading
Loading
Loading
+11 −8
Original line number Original line Diff line number Diff line
@@ -66,7 +66,6 @@ public class StorageDashboardFragment extends DashboardFragment
    private static final int STORAGE_JOB_ID = 0;
    private static final int STORAGE_JOB_ID = 0;
    private static final int ICON_JOB_ID = 1;
    private static final int ICON_JOB_ID = 1;
    private static final int VOLUME_SIZE_JOB_ID = 2;
    private static final int VOLUME_SIZE_JOB_ID = 2;
    private static final int OPTIONS_MENU_MIGRATE_DATA = 100;


    private VolumeInfo mVolume;
    private VolumeInfo mVolume;
    private PrivateStorageInfo mStorageInfo;
    private PrivateStorageInfo mStorageInfo;
@@ -139,6 +138,7 @@ public class StorageDashboardFragment extends DashboardFragment
    }
    }


    private void onReceivedSizes() {
    private void onReceivedSizes() {
        boolean stopLoading = false;
        if (mStorageInfo != null) {
        if (mStorageInfo != null) {
            long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
            long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
            mSummaryController.updateBytes(privateUsedBytes, mStorageInfo.totalBytes);
            mSummaryController.updateBytes(privateUsedBytes, mStorageInfo.totalBytes);
@@ -152,20 +152,23 @@ public class StorageDashboardFragment extends DashboardFragment
                    userController.setTotalSize(mStorageInfo.totalBytes);
                    userController.setTotalSize(mStorageInfo.totalBytes);
                }
                }
            }
            }
        }
            stopLoading = true;


        if (mAppsResult == null) {
            return;
        }
        }


        if (mAppsResult != null) {
            mPreferenceController.onLoadFinished(mAppsResult, UserHandle.myUserId());
            mPreferenceController.onLoadFinished(mAppsResult, UserHandle.myUserId());
            updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
            updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
            stopLoading = true;
        }


        // setLoading always causes a flicker, so let's avoid doing it.
        // setLoading always causes a flicker, so let's avoid doing it.
        if (stopLoading) {
            if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
            if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
                setLoading(false, true);
                setLoading(false, true);
            }
            }
        }
        }
    }


    @Override
    @Override
    public int getMetricsCategory() {
    public int getMetricsCategory() {