summaryrefslogtreecommitdiff
path: root/jni/include
AgeCommit message (Collapse)Author
2021-09-24Change containsMount() to look for any user-id.Martijn Coenen
On devices with app cloning, we may be responsible for storage paths that represent a different user-id than the one that we are running as. Change containsMount() to accept any user-id. Bug: 200134631 Test: TEST_MAPPING, atest FuseUtilsTest Change-Id: I4387beeed5925b9e43c4f45d0f5e9ed2f6a196d5
2020-10-06Fix Redaction calculation.Narayan Kamath
The redaction code in the FUSE daemon made mistaken assumptions about the ranges returned by ExifInterface, particularly that they were inclusive of the end index. This sometimes leads to extra bytes being redacted. The code has now been revamped to be clearer and better tested.. Test: atest RedactionInfoTest Test: atest ScopedStorageTest Bug: 169389401 Change-Id: I7ff2107cb62629b3ec7d9beba898d688a3aa1add
2020-07-10Ignore case when checking if a given path contains mount.Corina
We used to check this on the node's build path, which should always have the correct case (changed in I84ec47ef6c5272f476ae4c8d63d21be0aa268db9). However, there is a small chance that path can also end up with different lower/upper case. Having the string comparison ignore case works in all cases. Bug: 160853399 Test: atest FuseUtilsTest && atest --iterations 100 ScopedStorageHostTest#testCaseInsensitivity Change-Id: I0ae1aa6b5e619ba1345442a65d15a5f3fd6b1f37
2020-06-23Match mounted paths using string comparisons instead of regex.Corina
BUG: 158067533 Test: atest FuseUtilsTest Change-Id: I209c24e553329f77fdf76589bcbf3f502369fba4
2020-01-14Const correctness handle / RedactionInfo.Narayan Kamath
Helps us CHECK that they're always constructed with valid RedactionInfo etc. Test: atest FuseDaemonHostTest Test: atest fuse_node_test Bug: 147274248 Change-Id: I2cc369574d14136521201b4c8b99fe22e7ec0463
2019-12-20List all directory names in FUSE readdirSahana Rao
Previously, FUSE readdir returned a filtered list of directory names. A directory name was returned only if the directory had at least one file in the directory tree to which calling package had access permissions. Also, readdir() skipped all empty directories since MediaProvider database doesn't include empty directories. Current implementation of readdir includes all directory names in the given directory. Directory names are obtained from lower file system to get unfiltered list of directory names and empty directories. File names are still filtered based on calling package's access permissions. This commit also removes extra code which handled readdir of external files and obb directories. These paths don't go through FUSE anymore. Bug: 144350275 Bug: 145287327 Bug: 142806973 Bug: 142475473 Test: atest -c FuseDaemonHostTest#testListDirectoriesWithMediaFiles atest -c FuseDaemonHostTest#testListDirectoriesWithNonMediaFiles atest -c MediaProviderTest#testRelativePathForInvalidDirectories atest -c MediaProviderTest#testRelativePathForValidDirectories Change-Id: I1f34d8faa29b2a507a3f981f3edb6a63c4331f04
2019-12-04Move readdir decision-making to MediaProvider.Sahana Rao
Directory entries are obtained from Media Provider database. If given path is not indexed by MediaProvider database, MediaProvider redirects readdir to lower file system. For app specific directories, directory entries are obtained from lower file system but MediaProvider checks for access permissions before redirecting the query to lower file system. Bug: b/142857833 Bug: b/142806973 Bug: b/142475473 Test: ls /storage/emulated/0/ -R, Returns a list of files and directories filtered based on the visibility of the app to the corresponding file/directory. Test: atest -c testListDirectoriesWithMediaFiles atest -c testListDirectoriesWithNonMediaFiles atest -c testListFilesFromExternalFilesDirectory atest -c testListFilesFromExternalMediaDirectory Change-Id: I3635e13f5c206111bcd90f994a0961a407980310
2019-11-27Implement FUSE readdir FunctionSahana Rao
Returns the buffer with directory entries. readdir gets most of the directory entries by querying MediaProvider database. Paths that are not indexed by MediaProvider database are handled by querying the lower file system. Bug: 142806973 Bug: 142475473 Test: ls -R /storage/emulated/0/ Returns a list of files and directories filtered based on the visibility of the app to the corresponding file/directory. Change-Id: Ic9840d71483d7abe1b950c90f06f96ef9895ca61
2019-10-11Delegate all JNI calls to a single threadshafik
Previously, JNI calls were performed on any thread that requires them. This required all of those threads to be attached to the JVM before the JNI call and then detached from it after it's done. To improve performance, this CL delegates all JNI calls to a specialised JNI threads. Switch to using ScopedLongArrayRO in getRedactionRangesInternal. Test: manual Bug: 140726584 Bug: 142314536 Change-Id: I64e40eb694d8291eda6b1e8b0035b72e79d737e7
2019-09-11Implement MediaProviderWrapper and redaction in fuse readsshafik
Add a layer, called MediaProviderWrapper, that simplifies the interaction between FuseDaemon and MediaProvider. This layer is responsible for: * JNI calls from FuseDaemon to MediaProvider * Packaging the data FuseDaemon wants in cpp friendly objects This layer does NOT directly manipulate FUSE replies and is not aware of the existence of FUSE. Also implement metadata redaction on read requests, where redaction is needed. MediaProvider is the ultimate source of truth regarding when and what to redact. Add test for RedactionInfo logic. Also add a LocalCallingIdentity implementation for adb shell when running as root, for debugging reasons. adbd's calling indentity behaviour can be controlled by setting the following system property: * persist.sys.fuse.shell-root.redaction-needed * default: false It has all other permissions. Bug: 140281217 Test: adb shell setprop persist.fuse.shell-root.redaction-needed true adb root adb pull <photo with location data, e.g. GPSLatitude> Observe location data has been removed Test: atest RedactionInfoTest Change-Id: I183bcf5ec3b6745d3d216dc840e46f5fd753fde7