Welcome, Guest. Please Login.
Linuxslate.com Forums

<=== Back to the Linuxslate.com Homepage

Jul 17th, 2019, 12:24am
News: Welcome to the linuxslate.com forums. 16 Janruary 2015: Forum registration has been disabled due to recent advancements in bypassing captcha's and the resulting increase in spam on the forums. Registration will be re-enabled at a later date. In the meantime, if you need to register, or have relevant information, please email "john" at this domain, or request an account using the linuxslate.com Google+ Page: https://plus.google.com/+Linuxslate/


Pages: 1
Z1 Watch Phone GPS Speed Fix (Read 4345 times)
Administrator
Forum Administrator
*****


Administrator

Posts: 92
Gender: male
Z1 Watch Phone GPS Speed Fix
Jul 27th, 2012, 7:50am
 
dIt seems that the Speed reported by GPS apps in my Z1 Android Watch Phone is approximately 2x (twice) the correct value.
 
It seems that some other Chinese phones suffer the same GPS errors.  A quick Google search found this article:
http://club.dx.com/forums/Forums.dx/threadid.916565
(scroll down a few posts to DavidSzaloky's 2nd post.) -- originally from a Chinese site.
 
Apparently, the chipset in these devices is reporting speed in knots.  The rest of the Android OS expects it in m/s.  The fix is to simply multiply by .514444.
 
I have not done this fix to my phone yet.  This requires editing, and re-installing files that are critical to booting your phone.  A mistake, or bad information will render your device un-bootable and thus unusable.
 
UPDATE:  I can confirm that doing this in the Android Emulator produces a normally functioning system -- i.e. a working framework.jar.  I have not tested GPS in the emulator to see if the speed is approximately halved.  I'm not sure how/if to do that in the emulator, but the important test is that the system is still bootable.  Again, your brickage is your responsibility.
 
What follows is slightly modified from the referenced post.  It has been update to reflect the current version of smali/baksmali.
 
You need the Android SDK, and smali/baksmali
http://code.google.com/p/smali/
 
 
Code:
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.3.3.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.3.3.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
 


 
I can verify that the code in the Z1's framework.jar is the same as what is show, and that the commands appear valid.
 
One question:  Why does he use -1 on the zip command.  it is -6 by default, and other cases of re-packing the framework show -9.  The resulting framework.jar is much larger than the original one on the phone.
 
Until I either confirm that I am producing a valid framework.jar, or I have a valid backup firmware, and a way to install it, I will not do this to my Z1.
 
 
Back to top
 
« Last Edit: Jul 27th, 2012, 1:30pm by Administrator »  

Mobile Linux ?
Got That:
Z1 Android Watch Phone, Huawei Honor 2, Nexus 7 (2013), MUCH G2.
WWW   IP Logged
Pages: 1