Saturday, March 10, 2012

When I said vibrate, you should do that

So I upgraded my old-ish P500 to ICS one or two weeks ago. Nothing complicated, step by step below

  1. Download the ROM here. The thread specifically mentioned "GEEK ONLY". At the time of this writing, the latest version is beta 4. It's quite solid. Good battery mileage. All fundamental modules are working with the exception of Camera.
  2. Reboot into recovery and flash it. Before trying ICS, I used CM7 + CMW so it should be easy. In case you are curious, I was using this ROM. I used version 6.6. Now it's a little out dated but when I tried it, it was the first and the only CM7 ROM for P500. 
  3. After the flash, not reading the instruction very carefully, I wiped basically everything and boot it up. OMG IT WORKED. Beautiful home screen and the new overall style. I was quite satisfied.
  4. Browsing around for a while then I tried to go to the Market only to realize I have no Google apps installed. This is a common thing so I wasn't surprised so much, just need to grab the latest gapps package and flash it together (the package is here). 
  5. Another problem: I have no signal whatever! Wifi is working very good (which is a rare thing with new ROM) but no phone signal. I started to freaked out a bit since this is the only phone I got and I need it to work as a phone (to call and text).
    1. Wiping didn't solve the problem.
    2. Reflashing didn't work out.
    3. Reading through the first few pages and last few pages didn't yield any useful piece of information. Nobody encountered this before me? Hmm, maybe there's some problem with Viettel network? Anyway, I stumbled upon a quoted post of the instruction, basically it said the ROM only supports new baseband. Hmm, did my phone have the new baseband? I didn't remember anything about updating baseband. Hmm, the baseband line in the info page showed "Unknown". Not a good thing at all so I went out and use this tool to update the baseband.
    4. The biggest problem is it's a Windows app. Lucky me, still have the old IBM T42 laying around so booting it up is not a big problem. Took a while to install the LGE drivers though. And then praying! The app is ridiculously slow! And then it failed! Scared the sh!t out of me!
    5. Booting the phone gave me a black screen with alien text. J/k, it was English but very unfriendly. Basically the boot sequence is fcuked up so the phone couldn't boot! Agrrrr!
    6. Searching around with the error message didn't help at all but at least I found out that the app actually saves a backup copy before it starts working so it should be possible to restore using the backup.
    7. And it worked! The phone booted normally again and with phone signal! LOL, I have no idea why it turned out like that. Actually, the app reported error messages after the restoration so I just guess that app is poorly coded or something like that.
  6. So now I have the shiny new ICS installed and working on my P500. Restoring apps with Titanium Backup is fast. Contacts and other stuff are restored from Google's servers. All is well... so far.
A few days in, I turned on 3G but the battery dies too fast so I have to use 2G only and it's better. 3G is known to kill battery so I don't complain anything. But then it hit me: the one important reason why I sticked with CM7 for so long is because the phone vibrates when I call and the receiver pick up. Because of that feature, I can press call then do something else instead of put the phone to my ear. This is simply a convenient thing, not that I think it will reduce cancer or else... I just love that feature and this ROM doesn't have it! Searched around and there are a few apps available but they all seems to be not good enough so I decided to modify the Phone app to make it vibrate! Again, step by step below
  1. Grab the CM9 source code (reading this).
    1. There is no instruction for P500 at the time so just use SGS instruction instead.
    2. I don't follow the instruction all the way though, I skipped steps that are too complicated or steps that I thought is not related (mostly because I'm lazy, LOL)
    3. In the "Install the repository" step, instead of the given "repo init" command, you should use this instead "repo init -u git:// -b ics" (to get the ICS branch)
    4. After "repo sync", go to step 2. You don't need to copy priority files and such
  2. Get the device files from here. You will need to create the directory /device/lge, step by step below (assuming you are at the disk root)
    1. cd device
    2. mkdir lge
    3. git clone p500
  3. Get the vendor files from here. Step by step (assuming you are at the disk root)
    1. cd vendor
    2. git clone lge
  4. I had to read quite a bit of code + do many experiments but in the end, the required change is just a few lines. I got the diff uploaded here.
  5. To build the Phone app, type this into Terminal (assuming you are at the disk root)
    1. lunch cm_p500-userdebug (I knew about this because I read the file device/lge/p500/, if you are building for other devices you will find the lunch combo in a similar place)
    2. make Phone
  6. To get it on your phone, it's a little bit complicated but here are the basic steps (assuming you are at disk root + have adb in your PATH)
    1. adb remount
    2. adb shell
      1. rm /system/app/Phone.apk 
      2. exit
    3. adb push out/target/product/p500/system/app/Phone.apk /system/app/Phone.apk (the built apk file path will be presented to you after it's generated)
That's it. I thought this is a short post but it's quite long actually. Sorry. Below are some search phrases that people may use to search for this kind of thing (like I did and found nothing!)
  • how to build android from source (hmm, this is too generic I think)
  • how to build cm for p500
  • how to build cm9 for lg (I cheated a bit here)
  • how to build individual app from android source (yeah, I searched for this)
  • how to build stock app for android
  • how to build android phone app (use "make Phone" like I did)
  • how to build android contacts app (use "make Contacts")
  • (I ran out of ideas, hehe)

No comments:

Post a Comment