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

Commit 071313e8 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Don't map root documents in DocumentLoader.

Root documents must be added by RootScanner.
Previously DocumentLoader unintentionally tries to load unmapped root
documents, which causes crash.

BUG=27731902

Change-Id: I8674473d80d6e7f758f6636d30148f5d2118bc25
parent b3383fda
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -9,5 +9,10 @@ LOCAL_PRIVILEGED_MODULE := true
LOCAL_JNI_SHARED_LIBRARIES := libappfuse_jni
LOCAL_PROGUARD_FLAG_FILES := proguard.flags

# Only enable asserts on userdebug/eng builds
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
LOCAL_JACK_FLAGS += -D jack.assert.policy=enable
endif

include $(BUILD_PACKAGE)
include $(call all-makefiles-under, $(LOCAL_PATH))
+4 −2
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ class DocumentLoader implements AutoCloseable {
     */
    synchronized Cursor queryChildDocuments(String[] columnNames, Identifier parent)
            throws IOException {
        Preconditions.checkArgument(parent.mDeviceId == mDevice.deviceId);
        assert parent.mDeviceId == mDevice.deviceId;

        LoaderTask task = mTaskList.findTask(parent);
        if (task == null) {
            if (parent.mDocumentId == null) {
@@ -256,7 +257,8 @@ class DocumentLoader implements AutoCloseable {

        LoaderTask(MtpManager manager, MtpDatabase database, int[] operationsSupported,
                Identifier identifier) {
            Preconditions.checkNotNull(operationsSupported);
            assert operationsSupported != null;
            assert identifier.mDocumentType != MtpDatabaseConstants.DOCUMENT_TYPE_DEVICE;
            mManager = manager;
            mDatabase = database;
            mOperationsSupported = operationsSupported;
+2 −1
Original line number Diff line number Diff line
@@ -617,6 +617,7 @@ class MtpDatabase {
        final String whereClosure =
                "parent." + COLUMN_DEVICE_ID + " = ? AND " +
                "parent." + COLUMN_ROW_STATE + " IN (?, ?) AND " +
                "parent." + COLUMN_DOCUMENT_TYPE + " != ? AND " +
                "child." + COLUMN_ROW_STATE + " = ?";
        try (final Cursor cursor = mDatabase.query(
                fromClosure,
@@ -626,7 +627,7 @@ class MtpDatabase {
                        "parent." + Document.COLUMN_DOCUMENT_ID,
                        "parent." + COLUMN_DOCUMENT_TYPE),
                whereClosure,
                strings(deviceId, ROW_STATE_VALID, ROW_STATE_INVALIDATED,
                strings(deviceId, ROW_STATE_VALID, ROW_STATE_INVALIDATED, DOCUMENT_TYPE_DEVICE,
                        ROW_STATE_DISCONNECTED),
                null,
                null,