I was able to fix the GPS speed bug. All I had to to was to patch my framework.jar so that getSpeed function (belongs to Android location.manager) could return the correct value. That function, according to Google sources, should return the ground speed in m/s and it was returning the speed in knots (almost twice the speed).
The needed actions in order to patch framework are:
* Pull framework.jar from the phone
* Extract classes.dex from framework.jar (command: unzip framework.jar classes.dex)
* Unpack classes.dex with baksmali (command: java -jar baksmali-1.2.6.jar -o classes classes.dex)
* Remove bad classes.dex (not needed anymore)
* Edit file Location.smali under classes\android\location and replace getSpeed function from:
.method public getSpeed()F
.registers 2
.prologue
.line 591
iget v0, p0, Landroid/location/Location;->mSpeed:F
return v0
.end method
into:
.method public getSpeed()F
.registers 6
.prologue
const v1, 0x3F03B2A1
.line 591
iget v0, p0, Landroid/location/Location;->mSpeed:F
mul-float v2, v0, v1
return v2
.end method
* Repack classes.dex using smali (command: java -Xmx512M -jar smali-1.2.6.jar classes -o classes.dex)
* Add newly patched classes.dex into original framework.jar (command: zip -1 framework.jar classes.dex)
* Push newly patch framework.jar into the phone
Short explanation: speed was wrongly being acquired in knots (it should be in m/s). The code is writen in Dalvik bytecode and basically a register is set with the float 0,5144444 (1 knot in m/s), multiplied by the speed passed from the GPS driver and returned "corrected".