Each process runs under its own uid, so can only access files owned by that uid. If you want to read a file owned by another process/uid, you will need to have that other process do that for you -- by opening it itself and giving you the fd, making the file world readable, etc.
Fwiw, creating a text file somewhere with download progress information sounds to me fairly peculiar. Generally I would expect that information to be accessed through IPC or, as you seem to mention, as part of the structured data in a content provider. On Wed, Dec 24, 2008 at 10:41 PM, rktb <[email protected]> wrote: > > Hi freepine, > > I would like to read more about the permissions and access before > posting any educated question. Can you point me to any code or doc? If > not, read further for my questions :-) > > Though progressive download is a good example, the files that I am > referring to is not media content. The media content, I am almost > certain, should be accessed by content providers. What I am talking > about is a normal text file that, in this case, stores the state of > the download. And, a different app. needs access to this text file. > This is the required behavior. > > Thanks, > Ravi > > On Dec 25, 10:05 am, freepine <[email protected]> wrote: > > I think it depends:). > > Are you trying to implement something like progressive download in > opencore > > player? > > If so, I think you might not want to grant the access permission of > > downloaded files only to the default music player? > > > > Will it be played as ringtone or inserted to MMS? :) > > > > -freepine > > > > On Thu, Dec 25, 2008 at 12:49 PM, rktb <[email protected]> wrote: > > > > > Oh ok. Thanks freepine ! > > > > > So, can we summarize that the mediaserver cannot really create a file > > > in internal memory. And, the best way to provide a file access is to > > > pass it through a file descriptor from the application to the > > > mediaserver process. > > > > > -Ravi > > > > > On Dec 25, 9:11 am, freepine <[email protected]> wrote: > > > > I guess it's the java app you are using, i.e. com.android.music > > > > > > On Thu, Dec 25, 2008 at 9:57 AM, rktb <[email protected]> wrote: > > > > > > > Hi Dave, > > > > > > > Sorry...I did not understand completely. > > > > > > > What is the native app? > > > > > > > -Ravi > > > > > > > On Dec 25, 12:34 am, Dave Sparks <[email protected]> wrote: > > > > > > Hi Ravi, > > > > > > > > I think you need to have the native app create the file and pass > the > > > > > > open file descriptor to the media server. This is how rights are > > > > > > conferred from one process to another in the Android security > model. > > > > > > > > Dave > > > > > > > > On Dec 24, 12:58 am, rktb <[email protected]> wrote: > > > > > > > > > Hi, > > > > > > > > > Need some pointers about file access permissions: > > > > > > > > > Here is what I have tried: > > > > > > > > > From the Java app., I can create a file in /data/data/ > > > > > > > <my_package_name>/files/ using the API openFileOutput(). The > > > > > > > permissions of the file is as follows: > > > > > > > -rw-rw---- app_10 app_10 0 2008-12-23 09:17 > > > testFile1.txt > > > > > > > > > The files folder itself has the permissions: > > > > > > > drwxrwx--x app_10 app_10 2008-12-23 09:17 files > > > > > > > > > When I create a file using native code on /sdcard, the > permissions > > > are > > > > > > > as follows: > > > > > > > ----rw-rw- system system 0 2008-12-23 09:17 > > > > > > > fromNativeCode.txt > > > > > > > Is it right to say that native code process has "system" > rights? > > > > > > > > > Now, when I create a file using the Java layer, I can open the > same > > > > > > > file for "reading" through native code. But, I cannot open a > file > > > in > > > > > > > the same place using the native code with "writing" capability. > > > The > > > > > > > permissions of the "files" folder is "app_10", which is the > userID > > > of > > > > > > > the app. Right? Doesn't "system" trump "app_10" in terms of > > > > > > > permissions? > > > > > > > > > In other words, the objective that I am trying to achieve is to > > > create > > > > > > > a file inside native code at a place other than sdcard. > Preferably, > > > > > > > application specific location. > > > > > > > > > Any document that anybody could point that would detail more > about > > > > > > > security and permissions? I have already readhttp:// > > > > > code.google.com/android/devel/security.html. But, it does not > > > > > > > deal with native code details. > > > > > > > > > Thanks, > > > > > > > Ravi > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-framework?hl=en -~----------~----~----~----~------~----~------~--~---
