How to patch a framework?

Dr. H. Nikolaus Schaller hns at goldelico.com
Mon Jul 22 09:20:20 UTC 2013


Hi,
we have a minor issue with the GTA04 battery subsystem. The special situation is
that there may be two battery drivers in /sys/class/power_supply and if I understand
the code in frameworks/base/services/jni/com_android_server_BatteryService.cpp
correctly the batteries are picked up randomly and only one is processed.

Now the question is how we can patch replicant to provide our own 
com_android_server_BatteryService.cpp. I tried to add 

device/goldelico/gta04/overlay/frameworks/base/services/jni/com_android_server_BatteryService.cpp

but it appears that it is not compiled. Or do I have to run a make clean before?

The reason that we have two Battery drivers is that there are variants of the
GTA04 (e.g. Letux 3704) which don't have a HDQ battery while others have it.
And we want to have a single image for all these variants since maintaining
and developing such variants is a lot of work and preventing to simply swap
SD cards between them.

So the kernel/user-space code should be able to adapt to such small differences
like a HDQ driver (in kernel) reports 'no battery' and then switch to a backup
battery driver that simply estimates based on the battery voltage.

IMHO this can be achieved by patching 
int register_android_server_BatteryService(JNIEnv* env)

-- hns



More information about the Replicant mailing list