I work with File.java class. Most of its methods can throw SecurityException. But I don't find any information about cases in which it throws.
I look in android sources and find following: different File methods perform such call
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.e(path);
}
Or checkWrite() / checkDelete() In all this cases SecurityManager creates FilePermission object and validates it in Context.checkPermission()
public void checkRead(String file, Object context) {
checkPermission(new FilePermission(file, "read"), context);
}
Actually from this code I don't figure out when for current Context some file operation will deny and SecurityException will thrown (except trivial situation with not declared in manifest permissions). I guess it also thrown when app try to get access to protected directories, like "root" or "date". But when else?