I had my screen broken for about two months, I finally got a replacement and fixed the phone but now I'm strangely having permission issues to write to sdcard. I don't know why.
I don't have any problem writing to external sdcard. SELinux is set to Permissive as it was before. I tried restoring to stock Lollipop OS, the problem still persisted.
Apps can't write to sdcard, I can't take pictures with camera apps, can't delete or copy files from/to sdcard.
I can receive bluetooth files and play store seems to be the only app that can write to storage, I was able to install and update some apps.
I backed up my sdcard through adb with this command:
adb pull sdcard
Things I've tried with TWRP and failed:
1. Wiping all partitions but the sdcard and restoring the NANDROID backup.
2. Wiping everything, restoring NANDROID backup and copying back sdcard with adb in recovery.
Here's what worked:
3. Wiping everything, restoring NANDROID backup, booting into OS, the problem was gone, copied back sdcard with adb and rebooted, problem didn't come back
Here's the command I used to copy back the sdcard to phone:
adb push sdcard /