Am Montag, 4. Januar 2016 09:31:00 UTC+1 schrieb Larry Larry:
>
> Ok, this is ridiculous:
>
> SELinux basically gives NO READ ACCESS AT ALL to the app's own directory! 
>
> I unzipped the zip file into its own directory inside getFilesDir(), and 
> its still not happening.
>
>    //Unzipped Test.zip containing a "Test.json".    
> //fileName is Test.json.
>
>   String contentName = fileName.substring(0, fileName.length() - 5); 
> //".json" is 5 char.
>   Log.d("Target file is", sourceContext.getFilesDir() +"/"+ contentName +"/" 
> + fileName);
>
>   File file = new File(sourceContext.getFilesDir() + "/"+ contentName +"/" + 
> fileName); 
>
>
> Now it gives me
>
>
>   01-04 16:14:33.372 1046-1046/package_name D/DOH: 
> /data/user/0/package_name/files/Test/Test.json: open failed: EACCES 
> (Permission denied)
>   01-04 16:14:33.356 1046-1046/package_name W/package_name: type=1400 
> audit(0.0:22152): avc: denied { search } for name="Test" dev="mmcblk0p29" 
> ino=57184 scontext=u:r:untrusted_app:s0:c512,c768 
> tcontext=u:object_r:app_data_file:s0 tclass=dir permissive=0
>
>
> Once again the documentation for internal storage says I do not need to 
> give the app any permissions to read or write to the app's own 
> getFilesDir()  directory!  
> (
> http://developer.android.com/reference/android/content/Context.html#getFilesDir()
> )
>
> Any help?
>

This might be an old thread, but I recently faced the same issue, and I 
want to share my solution. The culprit turned out to be the /data/user/0, which 
is a symlink to /data/data. Calling file = file.getCanonicalFile(); on the 
file object fixed it for me.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/125d4adb-2a93-4d3f-a80c-59c182baf38f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to