I have an App that copies and modifies permissions of a file. But then when I try to read said file I get permission denied.
java.io.FileNotFoundException: /data/data/com.lstupenengo.primeraapp/files/xx: open failed: EACCES (Permission denied)
How can I know when RootTools is finished?
My code:
RootTools.copyFile("/data/data/com.xxx/" + file, getFilesDir() +"/"+ file, true, false);
CommandCapture cmd = new CommandCapture(0,"chmod 777 "+getFilesDir()+"/"+file);
try {
RootTools.getShell(true).add(cmd);
} catch (TimeoutException | RootDeniedException | IOException e) {
e.printStackTrace();
Log.e("Root "+file, "Fallo");
}
File fts = new File(getFilesDir()+"/"+file);
FileInputStream fis = new FileInputStream(fts); //Here I get my error.
Logcat
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ java.io.FileNotFoundException: /data/data/com.lstupenengo.primeraapp/files/xx: open failed: EACCES (Permission denied)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:418)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at java.io.FileInputStream.<init>(FileInputStream.java:78)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at com.lstupenengo.primeraapp.myFTP.upload(myFTP.java:80)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at com.lstupenengo.primeraapp.FirstRunService.upload(FirstRunService.java:75)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at com.lstupenengo.primeraapp.FirstRunService.onHandleIntent(FirstRunService.java:47)
Added this code and now I get an exeption on the Chmod but it works.