Loading src/com/android/documentsui/picker/ActionHandler.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -182,11 +182,11 @@ class ActionHandler<T extends FragmentActivity & Addons> extends AbstractActionH private void loadDefaultLocation() { private void loadDefaultLocation() { switch (mState.action) { switch (mState.action) { case ACTION_CREATE: case ACTION_CREATE: case ACTION_OPEN_TREE: loadHomeDir(); loadHomeDir(); break; break; case ACTION_GET_CONTENT: case ACTION_GET_CONTENT: case ACTION_OPEN: case ACTION_OPEN: case ACTION_OPEN_TREE: loadRecent(); loadRecent(); break; break; default: default: Loading src/com/android/documentsui/roots/ProvidersAccess.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -89,6 +89,12 @@ public interface ProvidersAccess { continue; continue; } } if (state.action == State.ACTION_OPEN_TREE && root.isRecents()) { if (VERBOSE) Log.v( tag, "Excluding recent root because: ACTION_OPEN_TREE."); continue; } if (!state.showAdvanced && root.isAdvanced()) { if (!state.showAdvanced && root.isAdvanced()) { if (VERBOSE) Log.v(tag, "Excluding root because: unwanted advanced device."); if (VERBOSE) Log.v(tag, "Excluding root because: unwanted advanced device."); continue; continue; Loading tests/unit/com/android/documentsui/picker/ActionHandlerTest.java +17 −10 Original line number Original line Diff line number Diff line Loading @@ -180,20 +180,13 @@ public class ActionHandlerTest { } } @Test @Test public void testInitLocation_DefaultToRecents_ActionOpenTree() throws Exception { public void testInitLocation_DefaultToDownloads_ActionOpenTree() throws Exception { testInitLocationDefaultToRecentsOnAction(State.ACTION_OPEN_TREE); testInitLocationDefaultToDownloadsOnAction(State.ACTION_OPEN_TREE); } } @Test @Test public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { mEnv.state.action = State.ACTION_CREATE; testInitLocationDefaultToDownloadsOnAction(State.ACTION_CREATE); mActivity.resources.bools.put(R.bool.show_documents_root, false); mActivity.refreshCurrentRootAndDirectory.assertNotCalled(); mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.DOWNLOADS.getUri()); } } @Test @Test Loading Loading @@ -509,6 +502,20 @@ public class ActionHandlerTest { mActivity.refreshCurrentRootAndDirectory.assertCalled(); mActivity.refreshCurrentRootAndDirectory.assertCalled(); } } private void testInitLocationDefaultToDownloadsOnAction(@ActionType int action) throws Exception { mEnv.state.action = action; mActivity.resources.bools.put(R.bool.show_documents_root, false); mActivity.resources.strings.put(R.string.default_root_uri, TestProvidersAccess.DOWNLOADS.getUri().toString()); mActivity.refreshCurrentRootAndDirectory.assertNotCalled(); mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.DOWNLOADS.getUri()); } private void assertRootPicked(Uri expectedUri) throws Exception { private void assertRootPicked(Uri expectedUri) throws Exception { mEnv.beforeAsserts(); mEnv.beforeAsserts(); Loading Loading
src/com/android/documentsui/picker/ActionHandler.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -182,11 +182,11 @@ class ActionHandler<T extends FragmentActivity & Addons> extends AbstractActionH private void loadDefaultLocation() { private void loadDefaultLocation() { switch (mState.action) { switch (mState.action) { case ACTION_CREATE: case ACTION_CREATE: case ACTION_OPEN_TREE: loadHomeDir(); loadHomeDir(); break; break; case ACTION_GET_CONTENT: case ACTION_GET_CONTENT: case ACTION_OPEN: case ACTION_OPEN: case ACTION_OPEN_TREE: loadRecent(); loadRecent(); break; break; default: default: Loading
src/com/android/documentsui/roots/ProvidersAccess.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -89,6 +89,12 @@ public interface ProvidersAccess { continue; continue; } } if (state.action == State.ACTION_OPEN_TREE && root.isRecents()) { if (VERBOSE) Log.v( tag, "Excluding recent root because: ACTION_OPEN_TREE."); continue; } if (!state.showAdvanced && root.isAdvanced()) { if (!state.showAdvanced && root.isAdvanced()) { if (VERBOSE) Log.v(tag, "Excluding root because: unwanted advanced device."); if (VERBOSE) Log.v(tag, "Excluding root because: unwanted advanced device."); continue; continue; Loading
tests/unit/com/android/documentsui/picker/ActionHandlerTest.java +17 −10 Original line number Original line Diff line number Diff line Loading @@ -180,20 +180,13 @@ public class ActionHandlerTest { } } @Test @Test public void testInitLocation_DefaultToRecents_ActionOpenTree() throws Exception { public void testInitLocation_DefaultToDownloads_ActionOpenTree() throws Exception { testInitLocationDefaultToRecentsOnAction(State.ACTION_OPEN_TREE); testInitLocationDefaultToDownloadsOnAction(State.ACTION_OPEN_TREE); } } @Test @Test public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { public void testInitLocation_DefaultsToDownloads_ActionCreate() throws Exception { mEnv.state.action = State.ACTION_CREATE; testInitLocationDefaultToDownloadsOnAction(State.ACTION_CREATE); mActivity.resources.bools.put(R.bool.show_documents_root, false); mActivity.refreshCurrentRootAndDirectory.assertNotCalled(); mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.DOWNLOADS.getUri()); } } @Test @Test Loading Loading @@ -509,6 +502,20 @@ public class ActionHandlerTest { mActivity.refreshCurrentRootAndDirectory.assertCalled(); mActivity.refreshCurrentRootAndDirectory.assertCalled(); } } private void testInitLocationDefaultToDownloadsOnAction(@ActionType int action) throws Exception { mEnv.state.action = action; mActivity.resources.bools.put(R.bool.show_documents_root, false); mActivity.resources.strings.put(R.string.default_root_uri, TestProvidersAccess.DOWNLOADS.getUri().toString()); mActivity.refreshCurrentRootAndDirectory.assertNotCalled(); mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.DOWNLOADS.getUri()); } private void assertRootPicked(Uri expectedUri) throws Exception { private void assertRootPicked(Uri expectedUri) throws Exception { mEnv.beforeAsserts(); mEnv.beforeAsserts(); Loading