mediascanner scan from system directory /data How can I make mediascanner scan phone memory, i.e. the /data directory? I want to test playing MP3s from this directory.

When I try to hack it by replacing the "pathStr" from /mnt/sdcard to /data before MediaScanner::doProcessDirectory(), it fails saying 

W/MediaScanner( 1713): Error opening directory '/data/', skipping: Permission denied.


And also crashed (probably in free).

I just want to play MP3s stored in phone memory and avoid reading the SD card for some experiments.
EDIT: This is rendered obsolete with Jelly Bean. Android 4.1+ has a unified /data/ and /sdcard section (the sdcard partition is emulated and really resides in /data/media, it's exposed via a special fuse layer to emulate FAT32 behaviour)

My thoughts on this:


The media scanner scans everything below /mnt
/data/* is protected, only individual apps can access their folder (/data/data/[app's package name])


To get it working the way you like:


You need root (obviously)
symlink /mnt/music to /data/data/your-music-location
you can also do a bind-mount instead of a symlink:
mount --bind /data/your-music-location /mnt/sdcard/your-music-location
Lift access rights accordingly (chmod -R ugo+rw /data/data/your-music-location)


Hope this works (the scanner should scan the whole /mnt as there's also /mnt/emmc and such). If not, you can also bind-mount a /data/data/* folder to /mnt/sdcard/your-music (as done with /mnt/sdcard/.android_secure (see the answer))