Edify Scripting And Git Patches

I’ve been working on Edify scripting to create a flashable zip that allows me to patch a regular CM7 nightly build with a reverted libaudio.so and updated libcamera.so

There’s literally no documentation anywhere! There’s some very old posts about Amend scripts (update-script) on XDA but nothing about the newer Edify scripts (updater-script and update-binary) that CM7 uses.

My script is based on the script from gapps:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
ui_print("Mounting /system");
run_program("/sbin/busybox", "mount", "/system");
 
ui_print("Extracting libraries");
show_progress(0.100000, 0);
package_extract_file("libcamera.so", "/system/lib/libcamera.so");
package_extract_file("libaudio.so", "/system/lib/libaudio.so");
show_progress(0.100000, 10);
 
ui_print("Setting permissions");
show_progress(0.200000, 0);
set_perm(0, 0, 0644, "/system/lib/libcamera.so");
set_perm(0, 0, 0644, "/system/lib/libaudio.so");
show_progress(0.200000, 10);
 
run_program("/sbin/busybox", "umount", "/system");
ui_print("Installation complete!");

There’s not a huge amount of documentation about the folder structure of a zip or apk, but essentially its this:

libaudio.so
libcamera.so
META-INF/com/google/android/
   updater-script
   update-binary

You have to take update-binary from another zip file, such as a the CM7 zip itself.

There’s also very little documentation about signing zips. I found that the command to do that is:

java -jar signapk.jar testkey.x509.pem testkey.pk8 update.zip update-signed.zip

signapk.jar can be found in the out/host/linux-x86/framework/ directory of a compiled build and the AOSP signing keys can be found in the build/target/product/security/ directory of the Android source tree.

To make a patch to revert libaudio I had to diff against the version before HEAD for that whole directory – we have to do it this way as the previous commit is different for AudioHardware to AudioPolicyManager – this is “get the previous commit, whatever that may be”, not “get this specific commit for this specific file”:

cd device/zte/blade/libaudio/
git diff HEAD^ > ~/libaudio.patch

Then I can apply the patch to HEAD (optionally check for errors first):

git apply --check ~/libaudio.patch

No we have a patch to revert to a previous version, kind of the opposite of what patches are usually for!

I’ve created a new directory on my server for all the CM7 stuff like patches and KANG builds here, which includes this signed zip patch.

Commercial Android Apps

What is it with commercial apps for Android that just don’t work?!

First off you’ve got Plex whose developers just say “its a Cyanogenmod7 problem, get them to fix it”, and now Nessus for Android logs in but doesn’t actually do anything – no scans or reports are displayed!

I also found that the version of iGo 8.4.2 for Android that I was using has what I can only assume is a broken skin, as the co-ordinate input method is just not there. Downloaded the unofficial MotoGIS 2.4 skin and it works a treat!

I also upgraded the blog to WordPress version 3.1.3

Working Around Android Market Geographical Restrictions

I noticed that I had Google Books and Google Shopper in my Android Market account as “installed” however I guess that was from when I was running Froyo with my UK SIM card, as it won’t let me re-install it on Gingerbread with my French SIM.

So I stuck my UK SIM in and lo, I saw Shopper listed in Market on the phone! So I installed it and it works fine. My UK SIM also seemed to enable “SIM Toolkit” which apparently adds some localised functionality (maybe 3G stuff too?) as it didn’t work with the French SIM back in it and it was gone upon reboot – well actually I installed CM7 N84 and wiped data, so no wonder it went!

I thought that swapping SIM’s all the time is going to be a hassle just to install/update apps between countries, so I downloaded MarketEnabler which temporarily switches your gsm.sim.operator.numeric property to whatever you want. It comes with a list of pre-defined carriers such as T-Mobile USA and Orange UK. I installed Books using it, and it works fine too.

Don’t forget that to use Google Voice you just have to set your GMail language to English-US as described here, apparently if you have a USA GMail account (with billing address) you can even make/receive free calls outside the USA…..

SwiftKey beta

I’m typing this using the new SwiftKey beta.

I quite like the auto-completion and  correction but the feature into like best is that you can enter numbers and symbols by just long-pressing the keys instead of having to switch mode.

I also upgraded to Cyanogenmod nightly 80, which seems OK so far.

I finally figured out how to not show posts from Facebook friends who just seem to post the same old drivel or use FB entirely to advertise their business – hover over their post until the X appears on the right, click that and select “hide posts from…”

Update: I did a full wipe of data, factory reset and dalvik cache clear and re-flashed CM7 N81 and the old gapps-20110307 (apparently 20110503 doesn’t add anything on ARMv6) on my ZTE Blade using the new TPT v5 method – giving me a 160Mb /system partition as my 136Mb one only had a few KB free.

So after about 2 hours of restoring apps and settings manually (restoring using e.g. TitaniumBackup is a sure-fire way to introduce buggy settings so I don’t do it) I have a nice fresh installation with plenty of free onboard RAM, a slightly newer radio driver and properly working fastboot. Although I have had a couple of force-closes from ROMManager, LauncherPro+ and the Sense Clock Applet on boot and whilst using Market, which I’ve never had before…..

I’ve just applied the new libaudio.so patch which essentially reverts the SIP routing fix that created the speaker hiss and battery drain issues in the first place. So those issues are hopefully fixed, but it means using Skype with a headset won’t work again, it just directs it through the speaker.

Plex for Linux and Android

Today I’ve been playing with PMS (Plex Media Server) for Linux, and also Plex Mobile for Android. Both have been pretty disappointing!

The Linux server is closed-source and precompiled for vague platforms like 32-Bit Ubuntu 10.10, but happens to run with some work on 64-Bit, I got it working on 32-Bit 11.04 after some hacking.

It looks like a direct port of the Mac version though as there’s no init script and there are spaces and capital letters in filenames, which actually stops the server from starting (good QA there!)

Then it seems like too much hassle to point a Mac client to it, as you have to have the same NFS mountpoints or something odd, and you can’t manually select a server from the client, you have to rely on stupid ZeroConf/Avahi.

To my surprise though, I ran it in a VirtualBox VM and allocated 256Mb RAM to it and it worked fine – so why does PMS seem to bog down my 2Gb MacMini?

I thought I’d try the Android client. Well that’s the slowest app I’ve ever seen (and paid £3 for) and on Cyanogenmod it doesn’t even play video, only sound works – and no its not due to lack of Flash10!

The promised remote control functionality hasn’t been written yet, although you can see its a direct port of the iOS app as the remote icon is there, it just does nothing!

So once again it seems Plex is not serious about running client or server on non-Apple platforms.