Loading src/com/android/documentsui/AbstractActionHandler.java +5 −0 Original line number Diff line number Diff line Loading @@ -565,6 +565,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA } } protected final void loadDeviceRoot() { mActivity.onRootPicked( mProviders.getRootOneshot(Providers.AUTHORITY_STORAGE, Providers.ROOT_ID_DEVICE)); } protected final void loadHomeDir() { loadRoot(Shared.getDefaultRootUri(mActivity)); } Loading src/com/android/documentsui/picker/ActionHandler.java +3 −1 Original line number Diff line number Diff line Loading @@ -225,9 +225,11 @@ class ActionHandler<T extends FragmentActivity & Addons> extends AbstractActionH private void loadDefaultLocation() { switch (mState.action) { case ACTION_CREATE: case ACTION_OPEN_TREE: loadHomeDir(); break; case ACTION_OPEN_TREE: loadDeviceRoot(); break; case ACTION_GET_CONTENT: case ACTION_OPEN: loadRecent(); Loading tests/common/com/android/documentsui/testing/TestProvidersAccess.java +11 −7 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ public class TestProvidersAccess implements ProvidersAccess { DOWNLOADS.derivedType = RootInfo.TYPE_DOWNLOADS; DOWNLOADS.flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_RECENTS; HOME = new RootInfo(); Loading @@ -80,12 +79,14 @@ public class TestProvidersAccess implements ProvidersAccess { PICKLES.rootId = "pickles"; PICKLES.title = "Pickles"; RECENTS = new RootInfo() {{ RECENTS = new RootInfo() { { // Special root for recents derivedType = RootInfo.TYPE_RECENTS; flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_IS_CHILD; flags = Root.FLAG_LOCAL_ONLY; availableBytes = -1; }}; } }; RECENTS.title = "Recents"; INSPECTOR = new RootInfo(); Loading Loading @@ -118,6 +119,8 @@ public class TestProvidersAccess implements ProvidersAccess { EXTERNALSTORAGE.rootId = Providers.ROOT_ID_DEVICE; EXTERNALSTORAGE.title = "Device"; EXTERNALSTORAGE.derivedType = RootInfo.TYPE_LOCAL; EXTERNALSTORAGE.flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_IS_CHILD; } public final Map<String, Collection<RootInfo>> roots = new HashMap<>(); Loading @@ -128,6 +131,7 @@ public class TestProvidersAccess implements ProvidersAccess { add(HOME); add(HAMMY); add(PICKLES); add(EXTERNALSTORAGE); } private void add(RootInfo root) { Loading tests/unit/com/android/documentsui/picker/ActionHandlerTest.java +8 −4 Original line number Diff line number Diff line Loading @@ -218,13 +218,17 @@ public class ActionHandlerTest { } @Test public void testInitLocation_DefaultToDownloads_ActionOpenTree() throws Exception { testInitLocationDefaultToDownloadsOnAction(State.ACTION_OPEN_TREE); public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { testInitLocationDefaultToDownloadsOnAction(State.ACTION_CREATE); } @Test public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { testInitLocationDefaultToDownloadsOnAction(State.ACTION_CREATE); public void testInitLocation_DefaultToDeviceRoot_ActionOpenTree() throws Exception { mEnv.state.action = State.ACTION_OPEN_TREE; mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.EXTERNALSTORAGE.getUri()); } @Test Loading Loading
src/com/android/documentsui/AbstractActionHandler.java +5 −0 Original line number Diff line number Diff line Loading @@ -565,6 +565,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA } } protected final void loadDeviceRoot() { mActivity.onRootPicked( mProviders.getRootOneshot(Providers.AUTHORITY_STORAGE, Providers.ROOT_ID_DEVICE)); } protected final void loadHomeDir() { loadRoot(Shared.getDefaultRootUri(mActivity)); } Loading
src/com/android/documentsui/picker/ActionHandler.java +3 −1 Original line number Diff line number Diff line Loading @@ -225,9 +225,11 @@ class ActionHandler<T extends FragmentActivity & Addons> extends AbstractActionH private void loadDefaultLocation() { switch (mState.action) { case ACTION_CREATE: case ACTION_OPEN_TREE: loadHomeDir(); break; case ACTION_OPEN_TREE: loadDeviceRoot(); break; case ACTION_GET_CONTENT: case ACTION_OPEN: loadRecent(); Loading
tests/common/com/android/documentsui/testing/TestProvidersAccess.java +11 −7 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ public class TestProvidersAccess implements ProvidersAccess { DOWNLOADS.derivedType = RootInfo.TYPE_DOWNLOADS; DOWNLOADS.flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_RECENTS; HOME = new RootInfo(); Loading @@ -80,12 +79,14 @@ public class TestProvidersAccess implements ProvidersAccess { PICKLES.rootId = "pickles"; PICKLES.title = "Pickles"; RECENTS = new RootInfo() {{ RECENTS = new RootInfo() { { // Special root for recents derivedType = RootInfo.TYPE_RECENTS; flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_IS_CHILD; flags = Root.FLAG_LOCAL_ONLY; availableBytes = -1; }}; } }; RECENTS.title = "Recents"; INSPECTOR = new RootInfo(); Loading Loading @@ -118,6 +119,8 @@ public class TestProvidersAccess implements ProvidersAccess { EXTERNALSTORAGE.rootId = Providers.ROOT_ID_DEVICE; EXTERNALSTORAGE.title = "Device"; EXTERNALSTORAGE.derivedType = RootInfo.TYPE_LOCAL; EXTERNALSTORAGE.flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_IS_CHILD; } public final Map<String, Collection<RootInfo>> roots = new HashMap<>(); Loading @@ -128,6 +131,7 @@ public class TestProvidersAccess implements ProvidersAccess { add(HOME); add(HAMMY); add(PICKLES); add(EXTERNALSTORAGE); } private void add(RootInfo root) { Loading
tests/unit/com/android/documentsui/picker/ActionHandlerTest.java +8 −4 Original line number Diff line number Diff line Loading @@ -218,13 +218,17 @@ public class ActionHandlerTest { } @Test public void testInitLocation_DefaultToDownloads_ActionOpenTree() throws Exception { testInitLocationDefaultToDownloadsOnAction(State.ACTION_OPEN_TREE); public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { testInitLocationDefaultToDownloadsOnAction(State.ACTION_CREATE); } @Test public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { testInitLocationDefaultToDownloadsOnAction(State.ACTION_CREATE); public void testInitLocation_DefaultToDeviceRoot_ActionOpenTree() throws Exception { mEnv.state.action = State.ACTION_OPEN_TREE; mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.EXTERNALSTORAGE.getUri()); } @Test Loading