March 14th, 2012, 02:13 PM
|
#3 (permalink)
|
|
Member
Join Date: Dec 2011
Location: Silicon Valley
Posts: 110
Device(s): few
Carrier: Not Provided
Thanks: 7
Thanked 32 Times in 29 Posts
|
Quote:
Originally Posted by Osidir
I'm developing an app that needs to know when the users wants to open some files, previusly configured in my app, and act before the file is served.
I assume I'll need to know when the user wants to open any file (and compare the file's name with my list) and the device must probably be rooted, but I can't find a way to know that a file is required for the user or for some application the user is using and requests the file.
I've thought about Broadcast receivers, but this option needs that 'open' generates a broadcast message, what I didn't find that is done.
Also I thought about the linux mods, that can be used to manage system calls, but I didn't find any way to include it (the linux instruction modprobe doesn't work on Android and I didn't found an equivalent one).
Any ideas? Is it impossible?
Thanks for your time!
|
Here's the way it is done - you need a stackable or user FS that mounted over all other FS's in the system, including root. Once you have that -
1: in vn_open check if you're interested in the file. vn_open does not have file name context so you'd need to get it from DNLC or maintain your own vnode/inode to file name mappings. Later is more suitable.
2: have user-space daemon that can be notified via up-call methods from your kernel module about "interesting file"
3: this daemon can notify any java observers via JNI about the file
sounds simple?
|
|
|