Search code examples
androidportingandroid-framework

Set default file/directory permissions for /data/sdcard in Android


I'm currently creating a custom build of Android-gingerbread for one of my device by making some modifications I need on the source-code of Android.

I wanted to know if there is any way by which I can set all files/directories being created under a specific path (i.e. /data/sdcard in my case) to always have rwxrwxrwx permission? I need this because I tried downloading a third-party app market and found that it creates a custom directory on /data/sdcard and downloads apk of apps to it and then tries to install 'em But this fails as that directory and apk have permission of rwx------ which causes PackageInstaller to be unable to access that apk and results in a parse error.

I've verified by modifying the file permission that the app can be installed!

Let me know if anyone can help me out with this.

Thanks.


Solution

  • You can set permissions in the file: system/core/include/private/android_filesystem_config.h However, I've just checked sdcard receives in stock Android rwxrwxrwx permissions:

    00777, AID_ROOT,   AID_ROOT,   "sdcard"
    

    I guess you work with custom ROM where this configuration has been overridden.

    If it is a custom folder under /data, created by the application, then you can use the approach I proposed.