[Fascinate Android Development] GizmoDroid:
Part II

Hunting for buried treasure

There are a lot of things hidden in the OS. Almost all of the APK's, if decompiled, have things that are hidden. Sometimes, the full code is there, but the ability to access it has been removed. To make it visible, you may only need to add the info to the layout xml, or remove a line of smali code (look for things like "removePreference" and such).

Other times, it's just a stub of the information. The great thing is, there are so many variations of our phone, almost anything missing can be inserted again if you can find it another device's code. Sometimes, this is a huge pain, because the dependencies can be spread over multiple files, requiring quite a bit of persistence and dedication. Other times, it's as simple as copy and pasting a line, or an entire method.

The i9000, Mesmerize, Captivate and Vibrant seem to have lots of our missing goodies, but a lot of them need to have the code adjusted, and I don't know what to work on first, since some of the easy stuff is worthless, and some of the valuable stuff is impossible. Here are just a few of the screen shots I've taken (yes, I realize a lot of them are probably not portable, but just showing you how much stuff can be hidden in an APK):

http://www.dropbox.com/gallery/22143517/1/Settings?h=7cc415

There are a lot of little APK's that can only be accessed by dialer codes or through a shortcut program. The useful features sometimes are very small and could either be hacked into the main Settings.apk, or called from it, or added into SpareParts.apk. There are a lot of dangerous things in there ("You want me to format your phone and your SD card?" "Nnnn-" "FORMATTIN YO SDCARD YEAAAAAY") so be careful exploring.

Which brings me to another big issue: EFS backups.

One night, before going to bed, I was poking around in a hidden menu (yep). I don't remember actually changing anything, but I lost a setting. Of course, I have no idea what the correct settings are, so I didn't know what to look for, and for 12 hours straight, my data connection would connect and disconnect every minute. I learned a lot about how poorly the os/radio/kernel/something handles the data connection, but I also learned about the EFS partition, and how this could have easily been fixed if I had a backup, and also how it could have been much, much worse.

If you wander through the i9000 forums, there are multiple warnings to backup your efs folder before messing with any settings. If you corrupt certain files, your phone will lose the ability to regenerate its EFS data, and you will lose your IMEI number. Meaning, your phone will not be activate-able. Meaning, your phone will have to be shipped to Samsung to get it fixed, so... good luck with that. If you think you are smart enough to avoid this, if I remember right, supercurio lost a device to this while trying to figure out the secret audio settings stuff.

It's simple to backup the entire partition using your favorite terminal command (I used dd to copy the efs dev/block device to the sdcard, don't know if this is the best method or not). However, it is virtually impossible to get it back once it is gone, if you don't have a backup. (There is someone charging for this service for i9000 phones).

My theory is that i9000's being used on different carriers causes lots of more people to play around with the EFS data, causing more people to corrupt it. Since the Fascinate is mostly only getting used on Verizon, then there aren't as many cases. However, one mistake in a mounting script in a recovery/kernel/os, and you're toast. Not only that, if you have a working backup and you go messing with the radio settings, then you will always have a backup that doesn't require you to activate another phone and then reactivate your's in order to get your phone working again. (All the while, watching in horror as your logcat fills with a continuous stream of data connection failures).

This is something I'd love to hear more from by someone who knows about it, and if it's as valid of a concern as it is on the i9000, then I'd really like to see more publicity about it's importance.