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

Commit 01d2ff93 authored by Amin Shaikh's avatar Amin Shaikh
Browse files

Support root Uris for EXTRA_INITIAL_URI

TODO: add logging for using open document tree with a document vs. a
root uri

Change-Id: I34d8f72cd51b55c02b5803275ef761a7b5c987f1
Bug: 119519300
Test: manually using ApiDemos Content > Storage > Documents
parent a9cfc1c5
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;
    }