Loading res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ layouts we reduce this to an input-box adjacent to menu actions. --> <bool name="full_bar_search_view">true</bool> <string name="default_root_uri" translatable="false">content://com.android.providers.downloads.documents/root/downloads</string> <!-- New features must be added behind a boolean flag prefixed w/ "feature_". Please add them in alphabetical order. Same goes for accessor Loading src/com/android/documentsui/base/Shared.java +7 −4 Original line number Diff line number Diff line Loading @@ -216,10 +216,13 @@ public final class Shared { * Method can be overridden if the change of the behavior of the the child activity is needed. */ public static Uri getDefaultRootUri(Activity activity) { return shouldShowDocumentsRoot(activity) ? DocumentsContract.buildHomeUri() : DocumentsContract.buildRootUri( Providers.AUTHORITY_DOWNLOADS, Providers.ROOT_ID_DOWNLOADS); Uri defaultUri = Uri.parse(activity.getResources().getString(R.string.default_root_uri)); if (!DocumentsContract.isRootUri(activity, defaultUri)) { throw new RuntimeException("Default Root URI is not a valid root URI."); } return defaultUri; } public static boolean isHardwareKeyboardAvailable(Context context) { Loading tests/common/com/android/documentsui/testing/TestResources.java +5 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public abstract class TestResources extends Resources { // this little hack....QuickViewIntentBuilder will check for this value // and ignore res.setQuickViewerPackage(QuickViewIntentBuilder.IGNORE_DEBUG_PROP); res.setDefaultDocumentsUri(TestProvidersAccess.DOWNLOADS.getUri().toString()); return res; } Loading @@ -66,6 +67,10 @@ public abstract class TestResources extends Resources { strings.put(R.string.trusted_quick_viewer_package, packageName); } public void setDefaultDocumentsUri(String uri) { strings.put(R.string.default_root_uri, uri); } public void setProductivityDeviceEnabled(boolean enabled) { bools.put(R.bool.show_documents_root, enabled); } Loading tests/unit/com/android/documentsui/files/ActionHandlerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -368,6 +368,7 @@ public class ActionHandlerTest { @Test public void testInitLocation_DocumentsRootEnabled() throws Exception { mActivity.resources.bools.put(R.bool.show_documents_root, true); mActivity.resources.strings.put(R.string.default_root_uri, TestProvidersAccess.HOME.getUri().toString()); mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.HOME.getUri()); Loading tests/unit/com/android/documentsui/picker/ActionHandlerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class ActionHandlerTest { @Test public void testInitLocation_CopyDestination_DocumentsRootEnabled() throws Exception { mActivity.resources.bools.put(R.bool.show_documents_root, true); mActivity.resources.strings.put(R.string.default_root_uri, TestProvidersAccess.HOME.getUri().toString()); Intent intent = mActivity.getIntent(); intent.setAction(Shared.ACTION_PICK_COPY_DESTINATION); Loading Loading
res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ layouts we reduce this to an input-box adjacent to menu actions. --> <bool name="full_bar_search_view">true</bool> <string name="default_root_uri" translatable="false">content://com.android.providers.downloads.documents/root/downloads</string> <!-- New features must be added behind a boolean flag prefixed w/ "feature_". Please add them in alphabetical order. Same goes for accessor Loading
src/com/android/documentsui/base/Shared.java +7 −4 Original line number Diff line number Diff line Loading @@ -216,10 +216,13 @@ public final class Shared { * Method can be overridden if the change of the behavior of the the child activity is needed. */ public static Uri getDefaultRootUri(Activity activity) { return shouldShowDocumentsRoot(activity) ? DocumentsContract.buildHomeUri() : DocumentsContract.buildRootUri( Providers.AUTHORITY_DOWNLOADS, Providers.ROOT_ID_DOWNLOADS); Uri defaultUri = Uri.parse(activity.getResources().getString(R.string.default_root_uri)); if (!DocumentsContract.isRootUri(activity, defaultUri)) { throw new RuntimeException("Default Root URI is not a valid root URI."); } return defaultUri; } public static boolean isHardwareKeyboardAvailable(Context context) { Loading
tests/common/com/android/documentsui/testing/TestResources.java +5 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public abstract class TestResources extends Resources { // this little hack....QuickViewIntentBuilder will check for this value // and ignore res.setQuickViewerPackage(QuickViewIntentBuilder.IGNORE_DEBUG_PROP); res.setDefaultDocumentsUri(TestProvidersAccess.DOWNLOADS.getUri().toString()); return res; } Loading @@ -66,6 +67,10 @@ public abstract class TestResources extends Resources { strings.put(R.string.trusted_quick_viewer_package, packageName); } public void setDefaultDocumentsUri(String uri) { strings.put(R.string.default_root_uri, uri); } public void setProductivityDeviceEnabled(boolean enabled) { bools.put(R.bool.show_documents_root, enabled); } Loading
tests/unit/com/android/documentsui/files/ActionHandlerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -368,6 +368,7 @@ public class ActionHandlerTest { @Test public void testInitLocation_DocumentsRootEnabled() throws Exception { mActivity.resources.bools.put(R.bool.show_documents_root, true); mActivity.resources.strings.put(R.string.default_root_uri, TestProvidersAccess.HOME.getUri().toString()); mHandler.initLocation(mActivity.getIntent()); assertRootPicked(TestProvidersAccess.HOME.getUri()); Loading
tests/unit/com/android/documentsui/picker/ActionHandlerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class ActionHandlerTest { @Test public void testInitLocation_CopyDestination_DocumentsRootEnabled() throws Exception { mActivity.resources.bools.put(R.bool.show_documents_root, true); mActivity.resources.strings.put(R.string.default_root_uri, TestProvidersAccess.HOME.getUri().toString()); Intent intent = mActivity.getIntent(); intent.setAction(Shared.ACTION_PICK_COPY_DESTINATION); Loading