You cannot read USB devices anyway as android does not, without platform modifications, support USB host mode.
You can of course read the SD card when it is *not* mounted over USB to an external computer but is instead mounted locally by android, provided that your application is not running as the system uid. You should not need the system uid to *read* files under /system/lib - indeed, a lot of them are already memory mapped into your application when it is forked off of zygote. However, you should be aware that with few exceptions most of those files are considered unstable, private APIs and so should not be directly utilized by your application but only by intermediate java layers of the platform which present the public APIs to you. If for some reason you really needed to be the system uid and also to access the SD card, you would need to either use inter process communication between something that is the system uid and something that isn't which is accessing the SD card, modify the platform to remove the restriction on the SD card and the system UID, or run as a privileged user other than the system uid. On Nov 5, 11:32 am, xhy <[email protected]> wrote: > Thank you sir,I want to visit the file which is under the /system/lib,But > at the same time,I also want to read the USB device.So what can i do ? > > 2010/11/5 Chris Stratton <[email protected]> > > > > > If the sdcard gets unmounted, any process with an open file handle to > > it gets killed. > > > Letting the system process be killed was considered a bad thing. To > > avoid that, the system process (which is to say any system process) is > > not allowed to access the SD card. > > > FYI, you probably will not be able to install your apk with the system > > uid on most secured devices, unless you are in possession of the > > system certificate for the devices on which you want to deploy. > > > What exactly do you need to access in the /system folder? You do know > > it's mounted read-only, right? > > > Technically, anything regarding the system folder is beyond the bounds > > of discussion of android-developers which is supposed to be confined > > to the SDK APIs. > > > On Nov 4, 10:57 pm, xhy <[email protected]> wrote: > > > Hi all,Now I come across a question,I want to visit the system folder in > > the > > > android file system.So i add the > > "android:SharedUserId=android.uid.system" > > > in the manifest.xml,But I can not visit the USB device if that. > > > > -- > > > Hongyue Xu > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<android-developers%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Hongyue Xu -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en

