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

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

Merge "Support root Uris for EXTRA_INITIAL_URI"

parents 1e56a10e 01d2ff93
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -115,8 +115,8 @@ class ActionHandler<T extends FragmentActivity & Addons> extends AbstractActionH
            return;
        }

        if (mFeatures.isLaunchToDocumentEnabled() && launchToDocument(intent)) {
            if (DEBUG) Log.d(TAG, "Launched to a document.");
        if (mFeatures.isLaunchToDocumentEnabled() && launchToInitialUri(intent)) {
            if (DEBUG) Log.d(TAG, "Launched to initial uri.");
            return;
        }

@@ -143,11 +143,16 @@ class ActionHandler<T extends FragmentActivity & Addons> extends AbstractActionH
        return false;
    }

    private boolean launchToDocument(Intent intent) {
    private boolean launchToInitialUri(Intent intent) {
        Uri uri = intent.getParcelableExtra(DocumentsContract.EXTRA_INITIAL_URI);
        if (uri != null) {
            if (DocumentsContract.isRootUri(mActivity, uri)) {
                loadRoot(uri);
                return true;
            } else if (DocumentsContract.isDocumentUri(mActivity, uri)) {
                return launchToDocument(uri);
            }
        }

        return false;
    }