summaryrefslogtreecommitdiff
path: root/core/java/android/provider/DocumentsContract.java
Commit message (Collapse)AuthorAgeFilesLines
* Make getExternalStorageMountMode as SystemApiAbhijeet Kaur2021-03-231-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Secondary volumes are FUSE mounted, whereas Android/data and Android/obb on primary volumes are not FUSE mounted. Access to these private app directories on primary volumes is restricted using the mount modes, but access for these on secondary volumes need to be regulated by MediaProvider. Make getExternalStorageMountMode as SystemApi so that MediaProvider can leverage the same mount logic for Secondary volumes. Expose relevant mount modes as SystemApi as well. This change saves us the maintenance overhead for Secondary volumes for Android S+. Otherwise we would have to check if an app is a signature app through APIs which would basically be the duplication for the logic in StorageManagerService.java. Expose ExternalStorageProvider and downloads Authority for MediaProvider to rely only on APIs. This is also required for CDD modifications that these 2 providers are given exceptional access to private app dirs. Bug: 175796984 Bug: 173505864 Bug: 173505864 Test: atest DownloadProviderTest Test: atest CtsScopedStorageHostTest Test: atest android.scopedstorage.cts.host.PublicVolumeHostTest#testCheckInstallerAppAccessToObbDirs Test: atest android.scopedstorage.cts.host.PublicVolumeHostTest#testCantAccessOtherAppsExternalDirs Change-Id: I51bc7bd3f355fadd9de56ac267469c2352eb0ffa
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-3/+3
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-3/+3
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-3/+3
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* Remove @TestApi from @SystemApi symbolsAnton Hansson2020-10-201-3/+0
| | | | | | | | | | | | | I ran these commands: cd frameworks/base grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \ 's/\@SystemApi[\s\n]+(\@\w+[\s\n]+)?\@TestApi/\@SystemApi\1/gs' grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \ 's/\@TestApi[\s\n]+(\@\w+[\s\n]+)?\@SystemApi/\1\@SystemApi/gs' Bug: 171179806 Test: m checkapi Change-Id: I772790b783b0a8730b8bf680c9e569a886b8d789
* Add @Nullable annotation to the parameter of Object.equals() methods.Roman Kalukiewicz2020-10-151-1/+1
| | | | | | | | | | | | | | | | | | Those annotations could be inferred by some tools (like Kotlin), but the https://checkerframework.org/ doesn't check inherited annotations complaining about all equals() invocations that get nullable argument. The change was generated by running find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /' in the frameworks/base directory and by automatically adding and formatting required imports if needed. No manual edits. Bug: 170883422 Test: Annotation change only. Should have not impact. Exempt-From-Owner-Approval: Mechanical change not specific to any component. Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
* Merge "Fix broken @see tags in public documentation."Andrew Sapperstein2020-05-011-13/+12
|\
| * Fix broken @see tags in public documentation.Andrew Sapperstein2020-04-281-13/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were previously being suppressed by doclava but with this change, all failures are fixed and the suppression logic has been removed. To fix the issues, there were a few possible changes made: - broken reference to a public API (such as incorrect parameters): fixed - unnecessary @link inside an @see tag: fixed - @see referring to an @hide or @SystemApi: reference removed - broken references to inner class constructors - worked around by fully qualifying the constructor Bug: 6963924 Test: make doc-comment-check-docs Change-Id: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
* | Remove exposed hidden apis in Point.javaAlec Mouri2020-04-071-2/+3
|/ | | | | | | | | | | | | | | | | | | | Point is moving into the UI/graphics module, so hidden apis need to be cleaned up: * printShortString is now publicly exposed and renamed to Point#dump, to mirror already public APIs such as TokenWatcher#dump * The two convert methods have very few users and their implementations are both trivial and only rely on the existing public API, so they are in-lined directly in the callers. * Introduce a GraphicsProtos utility class living outside of the module that just converts Graphics parcelables into protobuf objects. Currently WindowManager and the view system dump protobuf representations for debugging. Accordingly GraphicsProtos is a hidden public class, as the protobuf representation of the graphics classes are not publicly exposed and should be considered an implementation detail of the system. Bug: 152804266 Test: boots, builds Change-Id: I5e25dbbe47b3c690d7d763a0082beb8d8a9c86d3
* More CTS for APIs used by Mainline.Jeff Sharkey2020-03-091-0/+3
| | | | | | | | | Bug: 150641862, 150641715, 150641138, 150640123 Test: atest cts/tests/tests/content/src/android/content/cts/ContentResolverTest.java Test: atest cts/tests/tests/os/src/android/os/cts/BinderTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/DocumentsContractTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/media/MediaStoreTest.java Change-Id: I6f9ae1dcffd79fd6c422962d9ca64d4b98841766
* Do not use @SystemApi(client = MODULE_APPS) (documents/settings)Makoto Onuki2020-01-311-3/+1
| | | | | | | | | | | | There will be no special protection mechanisms around MODULE_APPS, so we're going to remove it for now. All the MODULE_APPS should be protected with a permission, etc, so the change should be safe. Bug: 148177503 Test: Build / treehugger Change-Id: I76328c2d5aaa3f171bf8afde5b3d1accad8c2e2b
* Add system API for building document URI with user ID.Alex Kershaw2020-01-201-0/+18
| | | | | | | | | | This is required for the direct tabbed DocsUI experience that doesn't involve the up-front disambig (that always only has one app in it). Bug: 145895146 Bug: 147900456 Test: atest CtsProviderTestCases:android.provider.cts.DocumentsContractTest Change-Id: Ic44b592382d880cdd76df2885ca8c52b1b697697
* Update FLAG_DIR_BLOCK_TREE to FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREEIvan Chiang2020-01-151-2/+2
| | | | | | Test: m -j Bug: 144764129 Change-Id: I0653fa1e16869db8a2ccc4425d368677c27873bc
* Merge "Update java doc for FLAG_DIR_BLOCKS_TREE"TreeHugger Robot2020-01-091-1/+3
|\
| * Update java doc for FLAG_DIR_BLOCKS_TREEIvan Chiang2019-12-181-1/+3
| | | | | | | | | | | | Test: m -j Change-Id: I7793a60ff60a609222d931fd011e051578a96bbe Fix: 144764129
* | Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-071-1/+1
|/ | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
* Allow providers block folders in ACTION_OPEN_DOCUMENT_TREEIvan Chiang2019-10-021-4/+28
| | | | | | | | | | | | DocumentsContract - Add new flag FLAG_DIR_BLOCKS_TREE in Document ExternalStorageProvider - Add flag into DocumentInfo for blocking folder Change-Id: Ib557fe99d330788a3bd968bffd43b6658761514f Bug: 32370759 Test: atest DocumentsTest
* Fix thumbnail's orienation issueIvan Chiang2019-05-201-31/+19
| | | | | | | | | | | - If we do full file decoding, we should not handle orientation by ourselves. - If we decode the thumbnail from ExifInterface.getThumbnailBytes() or MediaMetadataRetriever, we should handle the orientation. Change-Id: I632b0b0ed41710401192dfb12f407eaf74c480ba Fix: 130446058 Test: manual
* Revoke prior uri grants when MediaProvider db gets recreated.Sudheer Shanka2019-05-151-1/+10
| | | | | | | Bug: 132084545 Test: manual Test: atest --test-mapping packages/providers/MediaProvider Change-Id: Ibf2f2357d712a212f25b3bd005572ac74fe524fd
* Fix can't create thumbnail and wrong orientation issueIvan Chiang2019-04-291-0/+13
| | | | | | | | | | | | | | | | | | | | - When MediaMetadataRetriever can't create the thumbnail of some HEIF files, attempt decoding it from ExifInterface. - ImageDecoder can't create the thumbnail with getThumbnailBytes from ExifInterface in some cases. It will occur DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error. Attempt to decoding the full image in these cases. - Use orientation from ExifInterface to transform the thumbnail to right orientation. Test: manual Test: atest ThumbnailUtilsTest Bug: 130775874 Fix: 130446058 Change-Id: Icd0726ec49fe85651150736199c3caa184fa1a3f
* Update Nullability of ApisIvan Chiang2019-03-061-2/+4
| | | | | | | | | | | Update Nullability of apis in DocumentsContract, DocumentsProvider. Test: make Change-Id: Icc81333707bbeb9fe6d410ee35ade761e2d3b254 Fix: 126700626 Fix: 126702360 Fix: 126700352
* All Parcelable CREATOR fields are @NonNull.Jeff Sharkey2019-02-281-1/+1
| | | | | | | | | If they were null, then the Parcelable would fail to work. Bug: 126726802 Test: manual Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014 Exempt-From-Owner-Approval: Trivial API annotations
* Replace ContentInterface with wrapping.Jeff Sharkey2019-02-151-94/+26
| | | | | | | | | After much discussion, we can't safely introduce ContentInterface, so instead offer ContentResolver.wrap() methods. Bug: 120974438 Test: manual Change-Id: I0b399192a19948a8986146efa916375022c38b59
* Make DocumentsContract#PATH_TREE private.Amin Shaikh2019-02-071-3/+1
| | | | | | | | Since scoped directory access has been deleted, this is no longer need. Change-Id: I2bd0626957f4a324fbbe88907311344a0c700764 Fixes: 72055774 Test: make
* Merge "Add new column into Root to get the supported query args"Ivan Chiang2019-01-231-0/+24
|\
| * Add new column into Root to get the supported query argsIvan Chiang2019-01-211-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DocumentsContract: - Add @Public column Root#COLUMN_QUERY_ARGS - Update java doc DocumentsProvider: - Update java doc FileSystemProvider & ExternalStorageProvider - Add supported query args into Roots Bug: 121234248 Test: manual Change-Id: Ia944200ee1a44d75c9ad683564218e3d0dcef885
* | Merge "Fix CTS test fail for isTreeUri check in findDocumentPath method"Ivan Chiang2019-01-231-3/+0
|\ \
| * | Fix CTS test fail for isTreeUri check in findDocumentPath methodIvan Chiang2019-01-211-3/+0
| |/ | | | | | | | | | | | | | | Remove the isTreeUri check Test: atest DocumentsTest Change-Id: I19108a3dfac4963e8c700bb15273ce3051cabae8 Fix: 121342931
* / Add nullability annotations for some apis and update java docIvan Chiang2019-01-221-8/+20
|/ | | | | | | | | - Add nullability annotations for some methods - Update the java doc of isRootsUri to make it more clear Change-Id: I8b065d526e11fe8d71bb1aec223918e7559967e0 Fix: 122549058 Test: make
* Add StorageVolume#createOpenDocumentTreeIntentAmin Shaikh2018-12-181-10/+3
| | | | | | Change-Id: I6894bad24fa7757dee1028a31ba0b07701baa7b3 Fixes: 119519300 Test: manually using ApiDemos Content > Storage > Documents
* This is a giant mess.Jeff Sharkey2018-12-131-12/+12
| | | | | | Bug: 120846329 Test: none Change-Id: Ide0325d9f8e6accc961f456296125f3306aaca54
* Merge "People still need the old method signatures."Jeff Sharkey2018-12-121-0/+71
|\
| * People still need the old method signatures.Jeff Sharkey2018-12-111-0/+71
| | | | | | | | | | | | | | | | | | Keep the old methods around for code that expects to find them with the ContentResolver type. Bug: 120846329 Test: manual Change-Id: Id9c10525e63ecc8fbf9a249bfe7a5de755a0ceb4
* | Surface tree statistics through metadata.Jeff Sharkey2018-12-111-3/+19
|/ | | | | | | | | | | | | As part of storage privacy work in Q, we're trying to help users understand the impact of OPEN_DOCUMENT_TREE choices, and the best way is to show statistics about what's actually contained inside a tree. Define "count" and "size" statistics, and populate them for all FileSystemProvider instances. Bug: 117975747 Test: atest android.provider.cts.DocumentsContractTest Change-Id: Ib3f8f208c619141c26abaee0137641f12b009c8f
* Make DocumentsContract methods more general.Jeff Sharkey2018-12-081-305/+124
| | | | | | | | | | | | | | | | Accepting only ContentResolver arguments was quite limiting, so use the newly created super-interface ContentInterface, which lets callers use a ContentResolver, and ContentProviderClient, or even a specific ContentProvider. This is a safe API change, since we're accepting a more-general argument, and existing API users can continue passing ContentResolver to these methods. Bug: 117635768 Test: atest DocumentsUITests Test: atest android.appsecurity.cts.DocumentsTest Change-Id: I8f0cd1335c9b763dd81eeb237fb0517e9073b625
* Expose @SystemApi and @Public for unbundling DocumentsUIIvan Chiang2018-12-051-38/+91
| | | | | | | | | | | | | 1. Expose @Public for query arguments and flags. 2. Expose @SystemApi for related manageMode apis and some related storage flag in Root. 3. Add new isChildDocument method to support ContentResolver parameter and expose it @Public. 4. Expose @Public for getDocumentMetadata related methods. Bug: 117634543 Test: make, make api-stubs-docs-update-current-api, Change-Id: Ib172d46ba9727c35277fb285d3a09380fe106697
* Add query argument QUERY_ARG_EXCLUDE_MEDIAIvan Chiang2018-12-051-0/+17
| | | | | | | | | | Use the argument to decide whether the files that have been added to MediaStore should be excluded. If the value is true, exclude them. Otherwise, include them. Bug: 119390918 Test: manual Change-Id: I245e4303a265a95b30400083841c593b66c4d960
* Use ALLOCATOR_SOFTWARE with ImageDecoderLeon Scroggins III2018-11-191-1/+1
| | | | | | | | | | Bug: 119510493 Test: atest FrameworksCoreTests:android.content.ContentResolverTest An app may want to draw this thumbnail to a software canvas, so use the software allocator to support that. Change-Id: Ib789e0bf98c3638c61c43fe6cd7d504cdfe02ced
* Extend DocumentsContract search to accept mime typesIvan Chiang2018-11-141-12/+143
| | | | | | | | | | | | 1. Add the key of query arguments and match method in DocumentsContract. 2. Implement new querySearchDocuments method in DocumentsProvider, ExternalStoragProvider and FileSystemProvider. Bug: 111786939 Test: Manual Test Change-Id: I04e9f2be971f10ac1e9584a3486c948aaddea0a4
* Reroute Uri conversions though MediaProvider.Jeff Sharkey2018-10-241-0/+2
| | | | | | | | | | | | | | Upcoming changes will prevent apps from reading "_data" columns directly, which is required to convert between DocumentsProvider and MediaProvider Uris. To solve this, delegate the call() through MediaProvider, where it can perform the "_data" lookup on behalf of the caller. Also add new getMediaUri() call to offer symmetry. Bug: 111960973, 117627072, 110961701 Test: atest android.provider.cts.MediaStoreUiTest Change-Id: I53c640704d86047d7a4bf1702aca027873395abf
* Convenience method for obtaining thumbnails.Jeff Sharkey2018-10-181-72/+10
| | | | | | | | | | | | | | | | | | | Obtaining a thumbnail for a Uri requires opening it with the slightly obscure openTypedAssetFileDescriptor(), passing in "image/*" with the right Bundle of EXTRA_SIZE to hint the target area on screen, and defensively scaling any returned results. This is pretty tedious to get right, so offer a convenience method that does all this for the developer. Internally uses ImageDecoder to follow best-practices, and replaces older getDocumentThumbnail() implementation by delegating to this one. A future CL will teach ImageDecoder about how to read any embedded EXIF thumbnails, including any required rotation. Bug: 111268862 Test: atest FrameworksCoreTests:android.content.ContentResolverTest Change-Id: I5c9c09ddf9b480f3b5c6ade0a078cccb68de2f2b
* Add isRootsUri method to check whether the roots uri is validIvan Chiang2018-09-271-6/+27
| | | | | | | | | Base on the buildRootsUri method to provide isRootsUri to check whether the uri is valid. Change-Id: I626de4a67670d165436ae51154fc7fec3c9b424b Fix: 116180469 Test: atest ActionHandlerTest
* docs: fixed instances of typo in 'overridden' am: debd4ee72dkopriva2018-09-131-1/+1
|\ | | | | | | | | | | am: 9b641cbc71 Change-Id: I071643e73656a2a17a3c0ab89ffacda9c1bfec80
| * docs: fixed instances of typo in 'overridden'kopriva2018-09-131-1/+1
| |\ | | | | | | | | | | | | | | | am: debd4ee72d Change-Id: Idde6240486463dee51cdc27b8cd066a80fb869e0
| | * docs: fixed instances of typo in 'overridden'kopriva2018-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This affects several files beyond those mentioned in the bug. I didn't fix some instances because the files had code problems that blocked presubmit checks. Test: make ds-docs Bug: 37094741 Change-Id: I642f0384fef2b267ebc970bae1b4fb90bae667e7 Exempt-From-Owner-Approval: Docs-only change
| * | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-101-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For packages: android.providers.settings android.provider This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I993adf36dc31a5e224e88217c9e8dc140b6ba880 Merged-In: I3865ac184fcb6f52c6bfab9729611b065b27722e
* | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For packages: android.providers.settings android.provider This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I3865ac184fcb6f52c6bfab9729611b065b27722e
* | Utility methods useful for working with files.Jeff Sharkey2018-07-111-1/+2
| | | | | | | | | | | | | | | | Part of getting DocumentsUI ready for building against public API. Test: builds Bug: 110959821 Change-Id: I7cc0acd5ac3bcc89790cb49f34291ae523e44019
* | Fix broken links in @see tags in framework docs.Aurimas Liutikas2018-06-041-3/+1
|/ | | | | | | | | | doclava was accidentally suppressing all these broken links in @see tags. This CL fixes issues so we can start enfocing checks for broken @see links. Test: make docs Change-Id: If7830ece85f8d1f27c991eae282230814726e115 Exempt-From-Owner-Approval: Fixing @see javadoc link issues that are currently completely broken
* Internal Framework changes needed by DocumentUI's ScopedAccessProvider:Felipe Leme2018-01-251-1/+3
| | | | | | | | | | | | - Changed AM.getGrantedUriPermissions() API. - Made DocumentsContract.PATH_TREE public. Also fixed related AM methods to use explicit for on some loops. Bug: 63720392 Test: manual verification Change-Id: I33bdcb949f4301534bd8467c8018d6f03b4588a4