[Fascinate Android Development] GizmoDroid:
Topics Covered in this Thread So Far (or "potential areas for investigation/improvement")

USB modes confusion, CD-ROM mounting bug, and how to make it useful

Hunting for buried treasure in system apk's

EFS backups

GPS

Wifi

Stuff About CDROM/USB Device Protocols

More Stuff About CDROM/USB Device Protocols

Stuff On EFS

Stuff On Hidden Options

GPS power toggle from Drop Down Menu

EVRC-B Phone Voice Codec

Background Noise Cancellation during call

Disabling of debugging stuff and additional code checking

PNG/ogg optimization and Zipaligning

libdvm.so Optimization

Battery Service Polling

RAM management

Disk Scheduler

A more complete nandroid solution

A better voodoo implementation

About scripting

Sleep of Death

Phone.apk mods

More EFS partition info

Info about other partition backups (backing up kernel and others)

Wakelocks/Timekeeping issues and fixing it at the kernel level

Partition mounting tweaks (noatime and such), power management, vm writeback time

More VM tweaks

SD card cache tweak

Reclaiming the Preinstall partition

So I'm going to be out of town for a week or so, and I know that with hacking, that means I could come back and nothing will have changed... or I could come back and everything will have changed (source, anyone?)

EDIT: I'm back... and everyone got thunderbolts! I swear, I leave for one week... :p

Unfortunately, I myself am a jack-of-all-trades (king of none, sadly), so I've got about 50 different little things I've been working on researching, and won't make much progress on if I keep on trying to do them all at once, since every single project requires that I learn an entirely new set of principles that I never knew about before. Because of this, I have decided to do a brain dump. Hopefully this is welcomed. Some of it will be stuff you already know, some will be dead leads that don't apply, but I hope that there are some nuggets of goodness that will inspire someone to investigate further.

Basically, I go hunting for things that catch my eye, and mark them to investigate later. Unfortunately, later on, I can't find it, so I have to find it again. Therefore, I'll try to present the most I can re-find about a given topic. Also, my memory is very shoddy, so beware of inaccuracies. I am not stating this as a gospel truth, but as a jump off point to maybe catch your interest to go investigate something further. I welcome any discussion, but if you take an idea and make it your own, feel free to start a new thread about it.

Part I:

USB modes confusion, CD-ROM mounting bug, and how to make it useful

Samsung integrates several different USB devices into that one little plug. I count the following:

1. UMS - Mass Storage Mode (looks like a jump drive)

2. MTP - For use with media players to transfer music/videos/pics (looks like a media player)

3. CDFS - Mounts an image onto a virtual device (looks like CD-ROM drive)

4. DUN - Used for Dial-up-networking (looks like a modem)

5. COM port - Used for programming using low level tools like QPST (looks like a serial port)

6. ADB bridge - communicate over adb to the phones through a terminal

With the possibility of TV-out over usb, USB On The Go, or USB Host, then there are probably more.

There is a lot of weirdities that happen because there are different parts of the phone that activates different "modes" which are usually a combination of the above. Try rebooting into CWM and then select to mount the USB. Depending on your set up, you will probably find your SD-drive mounted to the virtual CD-ROM device. Is it the kernel or recovery that's not set to the right usb mode? I don't know.

There are so many different areas that can change the USB device, so it can be confusing to know why you are seeing a certain thing, even though you have it set as something else from the menu. Just a few examples: In the Settings, you have Debugging, which will turn on UMS, CDFS and the ADB. Depending on what Settings.apk you use, there is an accessible Dial-up networking option to enable the modem. There are dialer codes that affect the enabled devices(**usbii which accesses the PhoneUtil.apk, **debug which allows you to change the port map, and toggle DUN). There is a persistent ADB property that can be stored in "/data/property/persist.service.adb.enable". There are system settings that can be added to the .prop files that load on boot, or set by "setprop somepropertyhere" using a terminal or script.

Have you ever plugged in your phone and gotten an autorun prompt that says something about verizon? On the stock roms, there is an ISO that is stored at "/system/etc/verizon_i500.iso". It contains the samsung usb drivers and a couple other things. When it works properly, this would let you install everything you need to get your phone connected to a new computer, without going through the hassle of finding the files. This is especially helpful if you only have internet access through your phone and cannot obtain the drivers elsewhere. All this seems to be handled by the kies service manager, which does really weird quirky things. For instance, you can manually mount the iso onto this virtual cd-rom device, but kies will unmount it after 15 seconds or so. This is why sometimes, if your sdcard gets mounted as a cd-rom, you can actually read the contents for a little while before it disappears.

Why does this matter to anyone? Well for one thing, it explains a lot of the bugs. There are so many different devices, that sometimes they get mixed up in scripts. This is especially true when porting from other software, or mixing and matching kernels and OS's and recoveries. If they aren't all in agreement, weird things will happen.

Secondly, it opens up a cool built in feature that could easily be utilized: emulated cd-rom drives! I haven't isolated the properties (but it doesn't seem too hard to figure out using the logs and such), but I have successfully mounted the memtest boot iso to the virtual CD-rom drive. Think about it: you have a 16gb sdcard in there. Throw on a live-linux iso, and if the computer was made in the last 5-10 years, it should be able to boot from it (not tested yet).

Right now, you can quickly verify this works by making a symlink from /system/etc/verizon_i500.iso to the iso on your sd card. Then, if you know how, enable the virtual cd-rom (I can't remember the exact variable but its as easy as "setprop cdfs.something enable"). There you go! Instant Virtual CD-ROM drive. You can use it to install stuff on your netbook that didn't come with one, or turn your local library PC into a hacking command center (that's a joke... don't do that).

Now obviously, this could be easily packaged up into a neat little apk that would enable the right USB mode, and then allow you to pick the ISO you want to mount. This would be the ultimate goal, not this dirty little demo. Even easier to implement would be to call it from a script, using a script shortcut program.