Environment
- App: Amaze File Manager (
com.amaze.filemanager)
- Branch:
master
- File:
HybridFile.java
The Issue
While reviewing the HybridFile implementation, I noticed a potential main-thread blocking risk when dealing with SMB connections.
Currently, HybridFile.exists() directly creates an SmbFile and calls its exists() method synchronously:
public boolean exists() {
boolean exists = false;
// ...
} else if (isSmb()) {
try {
SmbFile smbFile = getSmbFile(2000);
exists = smbFile != null && smbFile.exists(); // <-- Synchronous network I/O
} catch (SmbException e) {
// ...
}
}
// ...
return exists;
}
Because jcifs.smb.SmbFile.exists() is a network-backed operation, it will block the calling thread while connecting, negotiating, or waiting on an unresponsive server.
The Risk & Impact
If HybridFile.exists() is ever reached via a UI-thread call path (e.g., inside an onClick, a menu callback, or a RecyclerView adapter binding), it will freeze the UI. Depending on the device and server state, this can lead to severe UI jank, ANRs, or a NetworkOnMainThreadException.
We know this module family is susceptible to this pattern, as a nearly identical issue caused crashes in the past (see Issue #3982: NetworkOnMainThreadException on HybridFile.getUsableSpace).
Next Steps / Verification Required
I have not tracked down a confirmed production path that calls this specifically on the main thread, but because this is a core utility method, it is highly vulnerable to being misused in UI callbacks.
Environment
com.amaze.filemanager)masterHybridFile.javaThe Issue
While reviewing the
HybridFileimplementation, I noticed a potential main-thread blocking risk when dealing with SMB connections.Currently,
HybridFile.exists()directly creates anSmbFileand calls itsexists()method synchronously:Because
jcifs.smb.SmbFile.exists()is a network-backed operation, it will block the calling thread while connecting, negotiating, or waiting on an unresponsive server.The Risk & Impact
If
HybridFile.exists()is ever reached via a UI-thread call path (e.g., inside anonClick, a menu callback, or aRecyclerViewadapter binding), it will freeze the UI. Depending on the device and server state, this can lead to severe UI jank, ANRs, or aNetworkOnMainThreadException.We know this module family is susceptible to this pattern, as a nearly identical issue caused crashes in the past (see Issue #3982:
NetworkOnMainThreadExceptiononHybridFile.getUsableSpace).Next Steps / Verification Required
I have not tracked down a confirmed production path that calls this specifically on the main thread, but because this is a core utility method, it is highly vulnerable to being misused in UI callbacks.