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

Commit 612cfa13 authored by Diksha Gohlyan's avatar Diksha Gohlyan Committed by Automerger Merge Worker
Browse files

Check if cursor is closed for staleDataException am: 56e7a5f9 am: d55deb36

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/DocumentsUI/+/12586926

Change-Id: Iebfa334cdeb4b7444e096b7b9b456d6ff0b0e1b1
parents 37d767e2 d55deb36
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -314,20 +314,20 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {
    }

    private boolean checkIfCursorStale(DirectoryResult result) {
        if (mResult == null) {
        if (result == null || result.cursor == null || result.cursor.isClosed()) {
            return true;
        }
        Cursor cursor = result.cursor;
        try {
            cursor.moveToPosition(-1);
            for (int pos = 0; pos < cursor.getCount(); ++pos) {
            try {
                if (!cursor.moveToNext()) {
                    return true;
                }
            }
        } catch (Exception e) {
            return true;
        }
        }
        return false;
    }
}
+6 −6
Original line number Diff line number Diff line
@@ -458,20 +458,20 @@ public abstract class MultiRootDocumentsLoader extends AsyncTaskLoader<Directory
    }

    private boolean checkIfCursorStale(DirectoryResult result) {
        if (mResult == null) {
        if (result == null || result.cursor == null || result.cursor.isClosed()) {
            return true;
        }
        Cursor cursor = result.cursor;
        try {
            cursor.moveToPosition(-1);
            for (int pos = 0; pos < cursor.getCount(); ++pos) {
            try {
                if (!cursor.moveToNext()) {
                    return true;
                }
            }
        } catch (Exception e) {
            return true;
        }
        }
        return false;
    }
}