[Android] StenaviN:
Kitchen plugin

Hello guys!

INTRODUCTION

I have faced with a problem, that applications, which contains native code (*.so files in lib/ directory) don't work, if they are installed on DATA partition. I have asked about solution, but no one replied my question. Later, lovethyEVO asked the same question and NilsP suggested installing *.so files into /system/lib/ directory. I think, it is not good idea because if application will be updated, it will write its libraries into /data/data/package.name/lib/ directory, but those libraries in /system/lib/ directory remain. Second, you need to do it manually and each time verify newly added applications.

So, I decided to write a plugin for dsixda's kitchen in order to automate this process.

EXPLANATION

Unfortunately, there is no way to add such libraries into /data/data/package.name/lib/ directory during flashing a ROM. I think, /data/data/ directory is populated by the actual data during first boot. Android sets different owners for each /data/data/package.name/ directory, where applications will store their data. So, I decided to add required libs after the ROM is already flashed and device was booted first time. The only thing we have to do is reboot into recovery and flash one more update-zip with our libraries.

TECH DETAILS

There are applications, which provide libraries for different processor architecture (ARMv5TE and ARMv7-A) and there are, which provides libraries, targeted for ARMv5TE architecture only. If the library is targeted for ARMv5TE, it will work on all ARM-based devices, in opposite to libraries, which are targeted for ARMv7-A architecture - they will work only on devices, that have a compatible CPU. So, it safe to use libraries for ARMv5 always, but ARMv7 architecture has additional instructions set, and developers, probably used them to increase performance etc. More details can be found here.

So, you can always select v5 architecture, or you can find architecture of your CPU, using Android System Info application. It available for free on Market (com.electricsheep.asi.apk).

Next, also we have to know package name in order to put our libraries into the correct directory. So, we need aapt tool, which come with Android SDK. Put aapt executable in kitchen\tools\ directory of you kitchen and the plugin will use it automatically. Be ready, the plugin will ask you about location of this tool, if it is unable to find the tool automatically.

If you use cygwin on Windows and aapt tool is not in kitchen\tools\ directory of your kitchen, enter full path to aapt.exe:

/cygdrive/X/path/aapt.exe

where X - is your drive letter (C, or D for example), path - full path to aapt.exe

If you use Linux, I'm sure, you know, what you have to do :)

INSTALLATION

Download attached plugin and extract it into plugins directory of the kitchen (scripts/plugins/).

USAGE

Make your ROM as usual. Launch VerifyAppsOnDataPartition plugin from advanced menu of the kitchen. Follow by displayed instructions. As a result, you will get InstallLibs_*.zip file in OUTPUT_ZIP directory.

Flash your ROM (wipe, if required)

Boot and setup your device

Reboot in Recovery

Flash update-zip with libraries

Enjoy!

I successfully used this plugin myself and have working applications with libraries on DATA partition (Ex.: Adobe Flashplayer, EStrongs File Manager, Google Goggles, Angrybirds, Shazam, Skype, Connect Bot etc.)

Feel free to ask me if you have any questions or you find a bug.