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

Commit 4e6242ae authored by Tony Huang's avatar Tony Huang
Browse files

Make recent root as default root on browse mode

Current Downloads is default root on browse mode.
This patch will make recent root as default root but also keep
a config to let OEM can set other root as default.

Fix: 123319277
Test: atest DocumentsUITests
Test: atest DocumentsTest
Change-Id: I3baa95ebb0b492fc0c833e570872413961ee4245
parent 521a0147
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@
    <bool name="feature_virtual_files_sharing">true</bool>
    <bool name="feature_inspector">true</bool>
    <bool name="feature_debug_mode">false</bool>
    <!-- If this value is true, the default root on action browse will be the root from
    "default_root_uri". Otherwise, the default root will be the recent root.-->
    <bool name="feature_default_root_in_browse">false</bool>

    <!-- Indicates if internal storage is shown as default or not. -->
    <bool name="config_default_show_device_root">false</bool>
+5 −0
Original line number Diff line number Diff line
@@ -551,6 +551,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA
        loadRoot(Shared.getDefaultRootUri(mActivity));
    }

    protected final void loadRecent() {
        mState.stack.changeRoot(mProviders.getRecentsRoot());
        mActivity.refreshCurrentRootAndDirectory(AnimationView.ANIM_NONE);
    }

    protected MutableSelection<String> getStableSelection() {
        MutableSelection<String> selection = new MutableSelection<>();
        mSelectionMgr.copySelection(selection);
+6 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public interface Features {
    boolean isRemoteActionsEnabled();
    boolean isSystemKeyboardNavigationEnabled();
    boolean isVirtualFilesSharingEnabled();
    boolean isDefaultRootInBrowseEnabled();


    /**
@@ -166,5 +167,10 @@ public interface Features {
        public boolean isVirtualFilesSharingEnabled() {
            return isEnabled(R.bool.feature_virtual_files_sharing);
        }

        @Override
        public boolean isDefaultRootInBrowseEnabled() {
            return isEnabled(R.bool.feature_default_root_in_browse);
        }
    }
}
+6 −2
Original line number Diff line number Diff line
@@ -427,12 +427,16 @@ public class ActionHandler<T extends FragmentActivity & Addons> extends Abstract
        }

        if (DEBUG) Log.d(TAG, "Launching directly into Home directory.");
        loadHomeDir();
        launchToDefaultLocation();
    }

    @Override
    protected void launchToDefaultLocation() {
        if (mFeatures.isDefaultRootInBrowseEnabled()) {
            loadHomeDir();
        } else {
            loadRecent();
        }
    }

    // If EXTRA_STACK is not null in intent, we'll skip other means of loading
+1 −2
Original line number Diff line number Diff line
@@ -187,8 +187,7 @@ class ActionHandler<T extends FragmentActivity & Addons> extends AbstractActionH
            case ACTION_GET_CONTENT:
            case ACTION_OPEN:
            case ACTION_OPEN_TREE:
                mState.stack.changeRoot(mProviders.getRecentsRoot());
                mActivity.refreshCurrentRootAndDirectory(AnimationView.ANIM_NONE);
                loadRecent();
                break;
            default:
                throw new UnsupportedOperationException("Unexpected action type: " + mState.action);
Loading