Merge "Fix flaky case testManageExternalStorageCanCreateFilesAnywhere" into rvc-dev
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 06b2f38..7af0ca8 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -22,6 +22,9 @@
},
{
"name": "FuseDaemonHostTest"
+ },
+ {
+ "name": "fuse_node_test"
}
]
}
diff --git a/jni/FuseDaemon.cpp b/jni/FuseDaemon.cpp
index 58d3f71..f960a9a 100644
--- a/jni/FuseDaemon.cpp
+++ b/jni/FuseDaemon.cpp
@@ -74,10 +74,8 @@
using std::vector;
// logging macros to avoid duplication.
-#define TRACE LOG(DEBUG)
-#define TRACE_VERBOSE LOG(VERBOSE)
-#define TRACE_FUSE(__fuse) TRACE << "[" << __fuse->path << "] "
-#define TRACE_FUSE_VERBOSE(__fuse) TRACE_VERBOSE << "[" << __fuse->path << "] "
+#define TRACE_NODE(__node) \
+ LOG(DEBUG) << __FUNCTION__ << " : " << #__node << " = [" << safe_name(__node) << "] "
#define ATRACE_NAME(name) ScopedTrace ___tracer(name)
#define ATRACE_CALL() ATRACE_NAME(__FUNCTION__)
@@ -319,8 +317,8 @@
std::unordered_set<const node*> inode_tracker_;
};
-static inline const char* safe_name(node* n) {
- return n ? n->GetName().c_str() : "?";
+static inline string safe_name(node* n) {
+ return n ? n->BuildSafePath() : "?";
}
static inline __u64 ptr_to_id(void* ptr) {
@@ -336,7 +334,6 @@
*/
static int set_file_lock(int fd, bool for_read, const std::string& path) {
std::string lock_str = (for_read ? "read" : "write");
- TRACE_VERBOSE << "Setting " << lock_str << " lock for path " << path;
struct flock fl{};
fl.l_type = for_read ? F_RDLCK : F_WRLCK;
@@ -344,10 +341,9 @@
int res = fcntl(fd, F_OFD_SETLK, &fl);
if (res) {
- PLOG(ERROR) << "Failed to set " << lock_str << " lock on path " << path;
+ PLOG(WARNING) << "Failed to set lock: " << lock_str;
return res;
}
- TRACE_VERBOSE << "Successfully set " << lock_str << " lock on path " << path;
return res;
}
@@ -361,20 +357,17 @@
* Returns true if fd may have a lock, false otherwise
*/
static bool is_file_locked(int fd, const std::string& path) {
- TRACE_VERBOSE << "Checking if file is locked " << path;
-
struct flock fl{};
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
int res = fcntl(fd, F_OFD_GETLK, &fl);
if (res) {
- PLOG(ERROR) << "Failed to check lock for file " << path;
+ PLOG(WARNING) << "Failed to check lock";
// Assume worst
return true;
}
bool locked = fl.l_type != F_UNLCK;
- TRACE_VERBOSE << "File " << path << " is " << (locked ? "locked" : "unlocked");
return locked;
}
@@ -424,6 +417,7 @@
fuse->NodeCreated(node);
}
+ TRACE_NODE(node);
// This FS is not being exported via NFS so just a fixed generation number
// for now. If we do need this, we need to increment the generation ID each
// time the fuse daemon restarts because that's what it takes for us to
@@ -474,12 +468,10 @@
const struct fuse_ctx* ctx = fuse_req_ctx(req);
node* parent_node = fuse->FromInode(parent);
string parent_path = parent_node->BuildPath();
-
- TRACE_FUSE_VERBOSE(fuse) << "LOOKUP " << name << " @ " << parent << " ("
- << safe_name(parent_node) << ")";
-
string child_path = parent_path + "/" + name;
+ TRACE_NODE(parent_node);
+
std::smatch match;
std::regex_search(child_path, match, storage_emulated_regex);
if (match.size() == 2 && std::to_string(getuid() / PER_USER_RANGE) != match[1].str()) {
@@ -505,7 +497,7 @@
static void do_forget(struct fuse* fuse, fuse_ino_t ino, uint64_t nlookup) {
node* node = fuse->FromInode(ino);
- TRACE_FUSE(fuse) << "FORGET #" << nlookup << " @ " << ino << " (" << safe_name(node) << ")";
+ TRACE_NODE(node);
if (node) {
// This is a narrowing conversion from an unsigned 64bit to a 32bit value. For
// some reason we only keep 32 bit refcounts but the kernel issues
@@ -545,7 +537,7 @@
const struct fuse_ctx* ctx = fuse_req_ctx(req);
node* node = fuse->FromInode(ino);
string path = node->BuildPath();
- TRACE_FUSE(fuse) << "GETATTR @ " << ino << " (" << safe_name(node) << ")";
+ TRACE_NODE(node);
if (!node) fuse_reply_err(req, ENOENT);
@@ -570,7 +562,7 @@
string path = node->BuildPath();
struct timespec times[2];
- TRACE_FUSE(fuse) << "SETATTR valid=" << to_set << " @ " << ino << "(" << safe_name(node) << ")";
+ TRACE_NODE(node);
if (!node) {
fuse_reply_err(req, ENOENT);
@@ -611,8 +603,8 @@
// times[1].tv_nsec = attr->st_mtime.tv_nsec;
}
}
- TRACE_FUSE(fuse) << "Calling utimensat on " << path << " with atime " << times[0].tv_sec
- << " mtime=" << times[1].tv_sec;
+
+ TRACE_NODE(node);
if (utimensat(-1, path.c_str(), times, 0) < 0) {
fuse_reply_err(req, errno);
return;
@@ -646,8 +638,7 @@
node* parent_node = fuse->FromInode(parent);
string parent_path = parent_node->BuildPath();
- TRACE_FUSE(fuse) << "MKNOD " << name << " 0" << std::oct << mode << " @ " << parent << " ("
- << safe_name(parent_node) << ")";
+ TRACE_NODE(parent_node);
if (!parent_node) {
fuse_reply_err(req, ENOENT);
@@ -681,8 +672,7 @@
node* parent_node = fuse->FromInode(parent);
const string parent_path = parent_node->BuildPath();
- TRACE_FUSE(fuse) << "MKDIR " << name << " 0" << std::oct << mode << " @ " << parent << " ("
- << safe_name(parent_node) << ")";
+ TRACE_NODE(parent_node);
const string child_path = parent_path + "/" + name;
@@ -715,7 +705,7 @@
node* parent_node = fuse->FromInode(parent);
const string parent_path = parent_node->BuildPath();
- TRACE_FUSE(fuse) << "UNLINK " << name << " @ " << parent << "(" << safe_name(parent_node) << ")";
+ TRACE_NODE(parent_node);
const string child_path = parent_path + "/" + name;
@@ -726,6 +716,7 @@
}
node* child_node = parent_node->LookupChildByName(name, false /* acquire */);
+ TRACE_NODE(child_node);
if (child_node) {
child_node->SetDeleted();
}
@@ -740,7 +731,7 @@
node* parent_node = fuse->FromInode(parent);
const string parent_path = parent_node->BuildPath();
- TRACE_FUSE(fuse) << "RMDIR " << name << " @ " << parent << "(" << safe_name(parent_node) << ")";
+ TRACE_NODE(parent_node);
const string child_path = parent_path + "/" + name;
@@ -756,6 +747,7 @@
}
node* child_node = parent_node->LookupChildByName(name, false /* acquire */);
+ TRACE_NODE(child_node);
if (child_node) {
child_node->SetDeleted();
}
@@ -776,7 +768,6 @@
const struct fuse_ctx* ctx = fuse_req_ctx(req);
if (flags != 0) {
- LOG(ERROR) << "One or more rename flags not supported";
return EINVAL;
}
@@ -792,11 +783,11 @@
return 0;
}
- TRACE_FUSE(fuse) << "RENAME " << name << " -> " << new_name << " @ " << parent << " ("
- << safe_name(old_parent_node) << ") -> " << new_parent << " ("
- << safe_name(new_parent_node) << ")";
+ TRACE_NODE(old_parent_node);
+ TRACE_NODE(new_parent_node);
node* child_node = old_parent_node->LookupChildByName(name, true /* acquire */);
+ TRACE_NODE(child_node) << "old_child";
const string old_child_path = child_node->BuildPath();
const string new_child_path = new_parent_path + "/" + new_name;
@@ -808,6 +799,7 @@
if (res == 0) {
child_node->Rename(new_name, new_parent_node);
}
+ TRACE_NODE(child_node) << "new_child";
child_node->Release(1);
return res;
@@ -834,8 +826,7 @@
node* node = fuse->FromInode(ino);
const string path = node->BuildPath();
- TRACE_FUSE(fuse) << "OPEN 0" << std::oct << fi->flags << " @ " << ino << " (" << safe_name(node)
- << ")";
+ TRACE_NODE(node) << (is_requesting_write(fi->flags) ? "write" : "read");
if (!node) {
fuse_reply_err(req, ENOENT);
@@ -847,7 +838,6 @@
fi->direct_io = true;
}
- TRACE_FUSE(fuse) << "OPEN " << path;
int status = fuse->mp->IsOpenAllowed(path, ctx->uid, is_requesting_write(fi->flags));
if (status) {
fuse_reply_err(req, status);
@@ -896,14 +886,7 @@
// b. Reading from a FUSE fd with caching enabled may not see the latest writes using the
// lower fs fd because those writes did not go through the FUSE layer and reads from FUSE
// after that write may be served from cache
- if (ri->isRedactionNeeded()) {
- TRACE_FUSE(fuse) << "Using direct io for " << path << " because redaction is needed.";
- } else {
- TRACE_FUSE(fuse) << "Using direct io for " << path << " because the file is locked.";
- }
fi->direct_io = true;
- } else {
- TRACE_FUSE(fuse) << "Using cache for " << path;
}
handle* h = new handle(path, fd, ri.release(), /*owner_uid*/ -1, !fi->direct_io);
@@ -1097,7 +1080,7 @@
struct fuse_file_info* fi) {
ATRACE_CALL();
struct fuse* fuse = get_fuse(req);
- TRACE_FUSE(fuse) << "FLUSH is a noop";
+ TRACE_NODE(nullptr) << "noop";
fuse_reply_err(req, 0);
}
@@ -1109,14 +1092,15 @@
node* node = fuse->FromInode(ino);
handle* h = reinterpret_cast<handle*>(fi->fh);
- TRACE_FUSE(fuse) << "RELEASE "
- << "0" << std::oct << fi->flags << " " << h << "(" << h->fd << ")";
+ TRACE_NODE(node);
fuse->fadviser.Close(h->fd);
if (node) {
- if (h->owner_uid != -1) {
- fuse->mp->ScanFile(h->path, h->owner_uid);
- }
+ // TODO(b/145737191) Legacy apps don't expect FuseDaemon to update database.
+ // Inserting/deleting the database entry might break app's functionality.
+ // if (h->owner_uid != -1) {
+ // fuse->mp->ScanFile(h->path, h->owner_uid);
+ // }
node->DestroyHandle(h);
}
@@ -1160,7 +1144,7 @@
node* node = fuse->FromInode(ino);
const string path = node->BuildPath();
- TRACE_FUSE(fuse) << "OPENDIR @ " << ino << " (" << safe_name(node) << ")" << path;
+ TRACE_NODE(node);
if (!node) {
fuse_reply_err(req, ENOENT);
@@ -1207,7 +1191,7 @@
node* node = fuse->FromInode(ino);
const string path = node->BuildPath();
- TRACE_FUSE(fuse) << "READDIR @" << ino << " " << path << " at offset " << off;
+ TRACE_NODE(node);
// Get all directory entries from MediaProvider on first readdir() call of
// directory handle. h->next_off = 0 indicates that current readdir() call
// is first readdir() call for the directory handle, Avoid multiple JNI calls
@@ -1294,7 +1278,7 @@
node* node = fuse->FromInode(ino);
dirhandle* h = reinterpret_cast<dirhandle*>(fi->fh);
- TRACE_FUSE(fuse) << "RELEASEDIR " << h;
+ TRACE_NODE(node);
if (node) {
node->DestroyDirHandle(h);
}
@@ -1342,7 +1326,7 @@
node* node = fuse->FromInode(ino);
const string path = node->BuildPath();
- TRACE_FUSE_VERBOSE(fuse) << "ACCESS " << path;
+ TRACE_NODE(node);
int res = access(path.c_str(), F_OK);
fuse_reply_err(req, res ? errno : 0);
@@ -1359,14 +1343,12 @@
node* parent_node = fuse->FromInode(parent);
const string parent_path = parent_node->BuildPath();
- TRACE_FUSE(fuse) << "CREATE " << name << " 0" << std::oct << fi->flags << " @ " << parent
- << " (" << safe_name(parent_node) << ")";
+ TRACE_NODE(parent_node);
const string child_path = parent_path + "/" + name;
int mp_return_code = fuse->mp->InsertFile(child_path.c_str(), ctx->uid);
if (mp_return_code) {
- PLOG(DEBUG) << "Could not create file: " << child_path;
fuse_reply_err(req, mp_return_code);
return;
}
@@ -1401,6 +1383,7 @@
int error_code = 0;
struct fuse_entry_param e;
node* node = make_node_entry(req, parent_node, name, child_path, &e, &error_code);
+ TRACE_NODE(node);
if (node) {
node->AddHandle(h);
fuse_reply_create(req, &e, fi);
@@ -1462,21 +1445,17 @@
*/
static struct fuse_lowlevel_ops ops{
- .init = pf_init,
- .destroy = pf_destroy,
- .lookup = pf_lookup, .forget = pf_forget, .getattr = pf_getattr,
- .setattr = pf_setattr,
- .canonical_path = pf_canonical_path,
- .mknod = pf_mknod, .mkdir = pf_mkdir, .unlink = pf_unlink,
- .rmdir = pf_rmdir,
+ .init = pf_init, .destroy = pf_destroy, .lookup = pf_lookup, .forget = pf_forget,
+ .getattr = pf_getattr, .setattr = pf_setattr, .canonical_path = pf_canonical_path,
+ .mknod = pf_mknod, .mkdir = pf_mkdir, .unlink = pf_unlink, .rmdir = pf_rmdir,
/*.symlink = pf_symlink,*/
.rename = pf_rename,
/*.link = pf_link,*/
.open = pf_open, .read = pf_read,
/*.write = pf_write,*/
- .flush = pf_flush, .release = pf_release, .fsync = pf_fsync,
- .opendir = pf_opendir, .readdir = pf_readdir, .releasedir = pf_releasedir,
- .fsyncdir = pf_fsyncdir, .statfs = pf_statfs,
+ .flush = pf_flush,
+ .release = pf_release, .fsync = pf_fsync, .opendir = pf_opendir, .readdir = pf_readdir,
+ .releasedir = pf_releasedir, .fsyncdir = pf_fsyncdir, .statfs = pf_statfs,
/*.setxattr = pf_setxattr,
.getxattr = pf_getxattr,
.listxattr = pf_listxattr,
@@ -1517,32 +1496,26 @@
}
bool FuseDaemon::ShouldOpenWithFuse(int fd, bool for_read, const std::string& path) {
- TRACE_VERBOSE << "Checking if file should be opened with FUSE " << path;
bool use_fuse = false;
if (active.load(std::memory_order_acquire)) {
const node* node = node::LookupAbsolutePath(fuse->root, path);
if (node && node->HasCachedHandle()) {
- TRACE << "Should open " << path << " with FUSE. Reason: cache";
use_fuse = true;
} else {
// If we are unable to set a lock, we should use fuse since we can't track
// when all fd references (including dups) are closed. This can happen when
// we try to set a write lock twice on the same file
use_fuse = set_file_lock(fd, for_read, path);
- TRACE << "Should open " << path << (use_fuse ? " with" : " without")
- << " FUSE. Reason: lock";
}
} else {
- TRACE << "FUSE daemon is inactive. Should not open " << path << " with FUSE";
+ LOG(WARNING) << "FUSE daemon is inactive. Cannot open file with FUSE";
}
return use_fuse;
}
void FuseDaemon::InvalidateFuseDentryCache(const std::string& path) {
- TRACE_VERBOSE << "Invalidating dentry for path " << path;
-
if (active.load(std::memory_order_acquire)) {
string name;
fuse_ino_t parent;
@@ -1558,10 +1531,10 @@
if (!name.empty() &&
fuse_lowlevel_notify_inval_entry(fuse->se, parent, name.c_str(), name.size())) {
- LOG(ERROR) << "Failed to invalidate dentry for path " << path;
+ LOG(WARNING) << "Failed to invalidate dentry for path";
}
} else {
- TRACE << "FUSE daemon is inactive. Cannot invalidate dentry for " << path;
+ LOG(WARNING) << "FUSE daemon is inactive. Cannot invalidate dentry";
}
}
@@ -1577,12 +1550,12 @@
struct stat stat;
if (lstat(path.c_str(), &stat)) {
- LOG(ERROR) << "ERROR: failed to stat source " << path;
+ PLOG(ERROR) << "ERROR: failed to stat source " << path;
return;
}
if (!S_ISDIR(stat.st_mode)) {
- LOG(ERROR) << "ERROR: source is not a directory";
+ PLOG(ERROR) << "ERROR: source is not a directory";
return;
}
diff --git a/jni/node-inl.h b/jni/node-inl.h
index 921dfe2..2aa3b13 100644
--- a/jni/node-inl.h
+++ b/jni/node-inl.h
@@ -22,6 +22,7 @@
#include <list>
#include <memory>
#include <mutex>
+#include <sstream>
#include <string>
#include <vector>
@@ -114,6 +115,10 @@
// associated with its descendants.
std::string BuildPath() const;
+ // Builds the full PII safe path associated with this node, including all path segments
+ // associated with its descendants.
+ std::string BuildSafePath() const;
+
// Looks up a direct descendant of this node by name. If |acquire| is true,
// also Acquire the node before returning a reference to it.
node* LookupChildByName(const std::string& name, bool acquire) const {
@@ -262,9 +267,9 @@
}
}
- // A helper function to recursively construct the absolute path of a given
- // node.
- static void BuildPathForNodeRecursive(node* node, std::string* path);
+ // A helper function to recursively construct the absolute path of a given node.
+ // If |safe| is true, builds a PII safe path instead
+ void BuildPathForNodeRecursive(bool safe, const node* node, std::stringstream* path) const;
// The name of this node. Non-const because it can change during renames.
std::string name_;
diff --git a/jni/node.cpp b/jni/node.cpp
index 8898b7b..6187774 100644
--- a/jni/node.cpp
+++ b/jni/node.cpp
@@ -41,20 +41,37 @@
namespace fuse {
// Assumes that |node| has at least one child.
-void node::BuildPathForNodeRecursive(node* node, std::string* path) {
- if (node->parent_) BuildPathForNodeRecursive(node->parent_, path);
+void node::BuildPathForNodeRecursive(bool safe, const node* node, std::stringstream* path) const {
+ if (node->parent_) {
+ BuildPathForNodeRecursive(safe, node->parent_, path);
+ }
- (*path) += node->GetName() + "/";
+ if (safe && node->parent_) {
+ (*path) << reinterpret_cast<uintptr_t>(node);
+ } else {
+ (*path) << node->GetName();
+ }
+
+ if (node != this) {
+ // Must not add a '/' to the last segment
+ (*path) << "/";
+ }
}
std::string node::BuildPath() const {
std::lock_guard<std::recursive_mutex> guard(*lock_);
- std::string path;
+ std::stringstream path;
- path.reserve(PATH_MAX);
- if (parent_) BuildPathForNodeRecursive(parent_, &path);
- path += name_;
- return path;
+ BuildPathForNodeRecursive(false, this, &path);
+ return path.str();
+}
+
+std::string node::BuildSafePath() const {
+ std::lock_guard<std::recursive_mutex> guard(*lock_);
+ std::stringstream path;
+
+ BuildPathForNodeRecursive(true, this, &path);
+ return path.str();
}
const node* node::LookupAbsolutePath(const node* root, const std::string& absolute_path) {
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index e48eea1..a534194 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -1468,12 +1468,16 @@
* However, we update database entries for renamed files to keep the database consistent.
*/
private int renameUncheckedForFuse(String oldPath, String newPath) {
- if (new File(oldPath).isFile()) {
- return renameFileUncheckedForFuse(oldPath, newPath);
- } else {
- return renameDirectoryUncheckedForFuse(oldPath, newPath,
- getAllFilesForRenameDirectory(oldPath));
- }
+
+ return renameInLowerFs(oldPath, newPath);
+ // TODO(b/145737191) Legacy apps don't expect FuseDaemon to update database.
+ // Inserting/deleting the database entry might break app functionality.
+ //if (new File(oldPath).isFile()) {
+ // return renameFileUncheckedForFuse(oldPath, newPath);
+ // } else {
+ // return renameDirectoryUncheckedForFuse(oldPath, newPath,
+ // getAllFilesForRenameDirectory(oldPath));
+ // }
}
/**
@@ -5667,6 +5671,12 @@
final LocalCallingIdentity token =
clearLocalCallingIdentity(LocalCallingIdentity.fromExternal(getContext(), uid));
try {
+ if (shouldBypassFuseRestrictions(/*forWrite*/ true, path)) {
+ // TODO(b/145737191) Legacy apps don't expect FuseDaemon to update database.
+ // Inserting/deleting the database entry might break app functionality.
+ return deleteFileUnchecked(path);
+ }
+
// Check if app is deleting a file under an app specific directory
final String appSpecificDir = extractPathOwnerPackageName(path);
@@ -5680,12 +5690,9 @@
}
}
- final boolean shouldBypass = shouldBypassFuseRestrictions(/*forWrite*/ true,
- path);
-
// Legacy apps that made is this far don't have the right storage permission and hence
// are not allowed to access anything other than their external app directory
- if (!shouldBypass && isCallingPackageRequestingLegacy()) {
+ if (isCallingPackageRequestingLegacy()) {
return OsConstants.EPERM;
}
@@ -5699,12 +5706,6 @@
final String[] whereArgs = {sanitizedPath};
if (delete(contentUri, where, whereArgs) == 0) {
- if (shouldBypass) {
- // For apps that bypass scoped storage restrictions, delete() should only fail
- // if the file is not in database. This shouldn't stop these apps from deleting
- // a file, hence delete the file in the lower file system.
- return deleteFileUnchecked(path);
- }
return OsConstants.ENOENT;
} else if (!path.equals(sanitizedPath)) {
// delete() doesn't delete the file in lower file system if sanitized path is
diff --git a/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/FuseDaemonHostTest.java b/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/FuseDaemonHostTest.java
index 6af8a3a..a4ab22b 100644
--- a/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/FuseDaemonHostTest.java
+++ b/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/FuseDaemonHostTest.java
@@ -24,6 +24,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -118,6 +119,7 @@
runDeviceTest("testListFilesFromExternalMediaDirectory");
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testListUnsupportedFileType() throws Exception {
final ITestDevice device = getDevice();
@@ -194,21 +196,25 @@
runDeviceTest("testSystemGalleryAppHasNoFullAccessToAudio");
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testSystemGalleryCanRenameImagesAndVideos() throws Exception {
runDeviceTest("testSystemGalleryCanRenameImagesAndVideos");
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testManageExternalStorageCanCreateFilesAnywhere() throws Exception {
runDeviceTest("testManageExternalStorageCanCreateFilesAnywhere");
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testManageExternalStorageCanDeleteOtherAppsContents() throws Exception {
runDeviceTest("testManageExternalStorageCanDeleteOtherAppsContents");
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testManageExternalStorageCanRenameOtherAppsContents() throws Exception {
runDeviceTest("testManageExternalStorageCanRenameOtherAppsContents");
diff --git a/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/LegacyAccessHostTest.java b/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/LegacyAccessHostTest.java
index 0502aed..ba574b7 100644
--- a/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/LegacyAccessHostTest.java
+++ b/tests/jni/FuseDaemonTest/host/src/com/android/tests/fused/host/LegacyAccessHostTest.java
@@ -25,6 +25,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -153,6 +154,7 @@
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testCanRename_hasRW() throws Exception {
runDeviceTest("testCanRename_hasRW");
@@ -182,11 +184,13 @@
}
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testCanDeleteAllFiles_hasRW() throws Exception {
runDeviceTest("testCanDeleteAllFiles_hasRW");
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testLegacyAppCanOwnAFile_hasW() throws Exception {
runDeviceTest("testLegacyAppCanOwnAFile_hasW");
diff --git a/tests/jni/FuseDaemonTest/legacy/src/com/android/tests/fused/legacy/LegacyFileAccessTest.java b/tests/jni/FuseDaemonTest/legacy/src/com/android/tests/fused/legacy/LegacyFileAccessTest.java
index 8e0a0d9..8dfbb4d 100644
--- a/tests/jni/FuseDaemonTest/legacy/src/com/android/tests/fused/legacy/LegacyFileAccessTest.java
+++ b/tests/jni/FuseDaemonTest/legacy/src/com/android/tests/fused/legacy/LegacyFileAccessTest.java
@@ -53,6 +53,7 @@
import com.android.tests.fused.lib.ReaddirTestHelper;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -277,6 +278,7 @@
* Test that rename for legacy app with WRITE_EXTERNAL_STORAGE permission bypasses rename
* restrictions imposed by MediaProvider
*/
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testCanRename_hasRW() throws Exception {
pollForPermission(Manifest.permission.READ_EXTERNAL_STORAGE, /*granted*/ true);
@@ -389,6 +391,7 @@
* Test that legacy app with WRITE_EXTERNAL_STORAGE can delete all files, and corresponding
* database entry is deleted on deleting the file.
*/
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testCanDeleteAllFiles_hasRW() throws Exception {
pollForPermission(Manifest.permission.READ_EXTERNAL_STORAGE, /*granted*/ true);
@@ -428,6 +431,7 @@
* Test that file created by legacy app is inserted to MediaProvider database. And,
* MediaColumns.OWNER_PACKAGE_NAME is updated with calling package's name.
*/
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testLegacyAppCanOwnAFile_hasW() throws Exception {
pollForPermission(Manifest.permission.READ_EXTERNAL_STORAGE, /*granted*/ true);
diff --git a/tests/jni/FuseDaemonTest/src/com/android/tests/fused/FilePathAccessTest.java b/tests/jni/FuseDaemonTest/src/com/android/tests/fused/FilePathAccessTest.java
index 9f44a96..b905bf5 100644
--- a/tests/jni/FuseDaemonTest/src/com/android/tests/fused/FilePathAccessTest.java
+++ b/tests/jni/FuseDaemonTest/src/com/android/tests/fused/FilePathAccessTest.java
@@ -74,7 +74,6 @@
import android.system.OsConstants;
import android.util.Log;
-import androidx.annotation.Nullable;
import androidx.test.runner.AndroidJUnit4;
import com.android.cts.install.lib.TestApp;
@@ -83,6 +82,7 @@
import com.google.common.io.ByteStreams;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -666,6 +666,7 @@
/**
* Test that readdir lists unsupported file types in default directories.
*/
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testListUnsupportedFileType() throws Exception {
final File pdfFile = new File(DCIM_DIR, NONMEDIA_FILE_NAME);
@@ -972,6 +973,7 @@
}
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testSystemGalleryCanRenameImagesAndVideos() throws Exception {
final File otherAppVideoFile = new File(DCIM_DIR, "other_" + VIDEO_FILE_NAME);
@@ -1256,6 +1258,7 @@
}
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testManageExternalStorageCanCreateFilesAnywhere() throws Exception {
final File topLevelPdf = new File(EXTERNAL_STORAGE_DIR, NONMEDIA_FILE_NAME);
@@ -1296,6 +1299,7 @@
}
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testManageExternalStorageCanDeleteOtherAppsContents() throws Exception {
final File otherAppPdf = new File(DOWNLOAD_DIR, "other" + NONMEDIA_FILE_NAME);
@@ -1328,6 +1332,7 @@
}
}
+ @Ignore("Re-enable as part of b/145737191")
@Test
public void testManageExternalStorageCanRenameOtherAppsContents() throws Exception {
final File otherAppPdf = new File(DOWNLOAD_DIR, "other" + NONMEDIA_FILE_NAME);