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

Commit 259ce801 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Extract mapping operations to partial class of MtpDatabase.

Change-Id: I5fda6d5754206528ad5953bcc179a0ffe0b4982d
parent 9e8a4fa7
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -255,10 +255,10 @@ class DocumentLoader {
                return;
            }
            if (mNumLoaded == 0) {
                mDatabase.startAddingChildDocuments(mIdentifier.mDocumentId);
                mDatabase.getMapper().startAddingChildDocuments(mIdentifier.mDocumentId);
            }
            try {
                mDatabase.putChildDocuments(
                mDatabase.getMapper().putChildDocuments(
                        mIdentifier.mDeviceId, mIdentifier.mDocumentId, objectInfoList);
                mNumLoaded += objectInfoList.length;
            } catch (SQLiteException exp) {
@@ -266,7 +266,7 @@ class DocumentLoader {
                mNumLoaded = 0;
            }
            if (getState() != STATE_LOADING) {
                mDatabase.stopAddingChildDocuments(mIdentifier.mDocumentId);
                mDatabase.getMapper().stopAddingChildDocuments(mIdentifier.mDocumentId);
            }
        }

@@ -275,7 +275,7 @@ class DocumentLoader {
            mError = message;
            mNumLoaded = 0;
            if (lastState == STATE_LOADING) {
                mDatabase.stopAddingChildDocuments(mIdentifier.mDocumentId);
                mDatabase.getMapper().stopAddingChildDocuments(mIdentifier.mDocumentId);
            }
        }

+513 −0

File changed and moved.

Preview size limit exceeded, changes collapsed.

+217 −226

File changed.

Preview size limit exceeded, changes collapsed.

+0 −2
Original line number Diff line number Diff line
@@ -22,10 +22,8 @@ import android.os.ParcelFileDescriptor;
import android.util.Log;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

+4 −3
Original line number Diff line number Diff line
@@ -113,13 +113,14 @@ final class RootScanner {
                for (int deviceId : deviceIds) {
                    try {
                        final MtpRoot[] roots = mManager.getRoots(deviceId);
                        mDatabase.startAddingRootDocuments(deviceId);
                        mDatabase.getMapper().startAddingRootDocuments(deviceId);
                        try {
                            if (mDatabase.putRootDocuments(deviceId, mResources, roots)) {
                            if (mDatabase.getMapper().putRootDocuments(
                                    deviceId, mResources, roots)) {
                                changed = true;
                            }
                        } finally {
                            if (mDatabase.stopAddingRootDocuments(deviceId)) {
                            if (mDatabase.getMapper().stopAddingRootDocuments(deviceId)) {
                                changed = true;
                            }
                        }
Loading