Loading res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -21,4 +21,8 @@ <!-- Intentionally unset. Vendors should set this in an overlay. --> <string name="trusted_quick_viewer_package" translatable="false"></string> <bool name="list_divider_inset_left">true</bool> <!-- Indicates if the home directory should be hidden in the roots list, that is presented in the drawer/left side panel ) --> <bool name="home_root_hidden">true</bool> </resources> src/com/android/documentsui/RootsFragment.java +11 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,10 @@ public class RootsFragment extends Fragment { for (final RootInfo root : roots) { final RootItem item = new RootItem(root); if (root.isLibrary()) { if (root.isHome() && isHomeRootHidden(context)) { continue; } else if (root.isLibrary()) { if (DEBUG) Log.d(TAG, "Adding " + root + " as library."); libraries.add(item); } else { Loading Loading @@ -367,6 +370,13 @@ public class RootsFragment extends Fragment { } } /* * Indicates if the home directory should be hidden in the roots list. */ private boolean isHomeRootHidden(Context context) { return context.getResources().getBoolean(R.bool.home_root_hidden); } @Override public View getView(int position, View convertView, ViewGroup parent) { final Item item = getItem(position); Loading tests/src/com/android/documentsui/FilesActivityUiTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -58,18 +58,23 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> { public void testRootsListed() throws Exception { initTestFiles(); bots.roots.openRoot(ROOT_0_ID); // Should also have Drive, but that requires pre-configuration of devices // We omit for now. bots.roots.assertHasRoots( bots.roots.assertRootsPresent( "Images", "Videos", "Audio", "Downloads", "Documents", ROOT_0_ID, ROOT_1_ID); // Separate logic for "Documents" root, which presence depends on the config setting boolean homeRootHidden = context.getResources().getBoolean(R.bool.home_root_hidden); if (homeRootHidden) { bots.roots.assertRootsAbsent("Documents"); } else { bots.roots.assertRootsPresent("Documents"); } } public void testFilesListed() throws Exception { Loading tests/src/com/android/documentsui/bots/RootsListBot.java +13 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public class RootsListBot extends BaseBot { mDevice.waitForIdle(); } public void assertHasRoots(String... labels) throws UiObjectNotFoundException { public void assertRootsPresent(String... labels) throws UiObjectNotFoundException { List<String> missing = new ArrayList<>(); for (String label : labels) { if (!findRoot(label).exists()) { Loading @@ -82,6 +82,18 @@ public class RootsListBot extends BaseBot { } } public void assertRootsAbsent(String... labels) throws UiObjectNotFoundException { List<String> unexpected = new ArrayList<>(); for (String label : labels) { if (findRoot(label).exists()) { unexpected.add(label); } } if (!unexpected.isEmpty()) { Assert.fail("Unexpected roots " + unexpected); } } public void assertHasFocus() { assertHasFocus(ROOTS_LIST_ID); } Loading Loading
res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -21,4 +21,8 @@ <!-- Intentionally unset. Vendors should set this in an overlay. --> <string name="trusted_quick_viewer_package" translatable="false"></string> <bool name="list_divider_inset_left">true</bool> <!-- Indicates if the home directory should be hidden in the roots list, that is presented in the drawer/left side panel ) --> <bool name="home_root_hidden">true</bool> </resources>
src/com/android/documentsui/RootsFragment.java +11 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,10 @@ public class RootsFragment extends Fragment { for (final RootInfo root : roots) { final RootItem item = new RootItem(root); if (root.isLibrary()) { if (root.isHome() && isHomeRootHidden(context)) { continue; } else if (root.isLibrary()) { if (DEBUG) Log.d(TAG, "Adding " + root + " as library."); libraries.add(item); } else { Loading Loading @@ -367,6 +370,13 @@ public class RootsFragment extends Fragment { } } /* * Indicates if the home directory should be hidden in the roots list. */ private boolean isHomeRootHidden(Context context) { return context.getResources().getBoolean(R.bool.home_root_hidden); } @Override public View getView(int position, View convertView, ViewGroup parent) { final Item item = getItem(position); Loading
tests/src/com/android/documentsui/FilesActivityUiTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -58,18 +58,23 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> { public void testRootsListed() throws Exception { initTestFiles(); bots.roots.openRoot(ROOT_0_ID); // Should also have Drive, but that requires pre-configuration of devices // We omit for now. bots.roots.assertHasRoots( bots.roots.assertRootsPresent( "Images", "Videos", "Audio", "Downloads", "Documents", ROOT_0_ID, ROOT_1_ID); // Separate logic for "Documents" root, which presence depends on the config setting boolean homeRootHidden = context.getResources().getBoolean(R.bool.home_root_hidden); if (homeRootHidden) { bots.roots.assertRootsAbsent("Documents"); } else { bots.roots.assertRootsPresent("Documents"); } } public void testFilesListed() throws Exception { Loading
tests/src/com/android/documentsui/bots/RootsListBot.java +13 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public class RootsListBot extends BaseBot { mDevice.waitForIdle(); } public void assertHasRoots(String... labels) throws UiObjectNotFoundException { public void assertRootsPresent(String... labels) throws UiObjectNotFoundException { List<String> missing = new ArrayList<>(); for (String label : labels) { if (!findRoot(label).exists()) { Loading @@ -82,6 +82,18 @@ public class RootsListBot extends BaseBot { } } public void assertRootsAbsent(String... labels) throws UiObjectNotFoundException { List<String> unexpected = new ArrayList<>(); for (String label : labels) { if (findRoot(label).exists()) { unexpected.add(label); } } if (!unexpected.isEmpty()) { Assert.fail("Unexpected roots " + unexpected); } } public void assertHasFocus() { assertHasFocus(ROOTS_LIST_ID); } Loading