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

Commit fd2b4dc0 authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski
Browse files

More clean up for sharing virtual files.

Follow up for Steve.

Test: Unit tests.
Bug: 28409713
Change-Id: Ieeffbb276c5ccf62c366b08e3afe6c1e8bd4135e
(cherry picked from commit 9693b4a4)
parent e8b547f1
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.documentsui.base.DocumentInfo.getCursorInt;
import static com.android.documentsui.base.DocumentInfo.getCursorString;
import static com.android.documentsui.base.Shared.DEBUG;
import static com.android.documentsui.base.Shared.VERBOSE;
import static com.android.documentsui.base.Shared.ENABLE_OMC_API_FEATURES;

import android.annotation.IntDef;
import android.database.Cursor;
@@ -54,11 +55,16 @@ import java.util.function.Predicate;
public class Model {

    /**
     * Filter that passes (returns true) all non-partial files and non-archived files.
     * Filter that passes (returns true) for all files which can be shared.
     */
    public static final Predicate<Cursor> SHARABLE_FILE_FILTER = (Cursor c) -> {
        int flags = getCursorInt(c, Document.COLUMN_FLAGS);
        String authority = getCursorString(c, RootCursorWrapper.COLUMN_AUTHORITY);
        if (!ENABLE_OMC_API_FEATURES) {
            return (flags & Document.FLAG_PARTIAL) == 0
                    && (flags & Document.FLAG_VIRTUAL_DOCUMENT) == 0
                    && !ArchivesProvider.AUTHORITY.equals(authority);
        }
        return (flags & Document.FLAG_PARTIAL) == 0
                && !ArchivesProvider.AUTHORITY.equals(authority);
    };
+2 −1
Original line number Diff line number Diff line
@@ -321,7 +321,8 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        intent.addCategory(Intent.CATEGORY_DEFAULT);

        if (mScope.model.hasDocuments(selection, Model.VIRTUAL_DOCUMENT_FILTER)) {
        if (Shared.ENABLE_OMC_API_FEATURES
                && mScope.model.hasDocuments(selection, Model.VIRTUAL_DOCUMENT_FILTER)) {
            intent.addCategory(Intent.CATEGORY_TYPED_OPENABLE);
        }