[HD2 Android Themes and Apps] Axel85:
After searching for 2 days in any language i ve found the solution in a old xda thread.This is the only solution that work for me to recalibrate the gsensor for all the system,not only in gpsstatus or level programs.Since this thread has 450 views,i think that other peoples has my same problem.This is the thread link:

http://xdaforums.com/showthread.php?t=803242

and this is the solution

If your orientation is off when you lay your phone on a level surface and can't calibrate it in Android (because many people found it gets corrupted after auto calibration), this is one way to do so. (Winmo g-sensor calibration does not seem to affect android orientation)

Install an app that displays sensor information along with pitch and roll. (such as SensorDebug from Android market)

Put your phone on a level surface such as the floor or a table.

Note your pitch and roll values.

Use rootexplorer or similar file manager to edit /data/misc/AK8973Prms.txt file. (open in text editor) (For ASTRO CHECK POST 70 in page 7)

You will see AOFFSET.x and AOFFSET.y at the bottom. (May be on top if you autocalibrated previously)

y affects pitch and x affects roll, there is about 4 to 1 ratio.

What you are trying to do is make pitch and roll 0 with minimum flicker.

Press and hold home button to switch between rootexplorer and sensordebug. Your changes will be reflected in realtime (with most builds). Go back and forth a few times to get perfect result. (You can press and hold home button to go back and forth) If you think changing values don't have an affect, try to temprorarily change AOFFSET.x=90 and return to your app. When phone is on the table, your leveling bubble or pitch/roll must be way off. This way you can see if with your build changes are reflected in realtime or not. If not try restarting, use different sensor app and give feedback please. (After that revert AOFFSET.x to 0 or other value your want to fix back orientation)

For example:

If pitch is 3 and roll is -1

you may start by

AOFFSET.x=4

AOFFSET.y=-12

Then adjust with 1 increments to get rid of flicker.

It is best to adjust one value at a time.

EDIT: IF YOU WANT TO CALIBRATE Z AXIS, CHECK POST 61 in page 7

Calibrated AOFFSET values for my phone are x=2 y=-9 z=12

You can use gpsstatus or bubble app (to find bubble app search the market for bz.ktk.bubble and enable "show angle" from bubble apps settings.) for visual check of orientation calibration. Because of the protruding camera lens of hd2, there can be 1 degree difference between sideways and normal orientation. (It seems you can adjust in about 0.25 degree increments by each 1 increment of AOFFSET and compansate by lowering AOFFSET=y by 2 that gives 0 degrees in both normal and sideways orientation in bubble app)

- You don't need to reboot for most builds (if there is no affect check post 11)

- You don't need to kill/restart akmd

- You don't even need to close sensor app

- Because of not perfect kernel/build support for sensors, you may see them freeze when you move the phone (TS will also freeze). With evo kernels, just wait a few seconds and it will resume. (With nexus kernels they may freeze until sleep/wakeup) Interestingly the values of AK8973Prms.txt affect shake/move freezes. I wrote about this in post 10 and 11.

IT IS A GOOD IDEA TO BACKUP COMPLETE ANDROID FOLDER BEFOREHAND just in case something goes wrong. Chefs say you shouldn't auto calibrate your g-sensor under Android because with many people it gets messed up. Also good idea to backup your /data/misc/AK8973Prms.txt

You may have trouble accessing data folder with a file manager other than rootexplorer. Your build must be rooted. (most are) It is a good idea to update your su binary inside superuser app settings TWICE. If you change permissions of /data /data/misc folders you may access them even with standart astro file manager. Try chmod 777 /data from terminal emulator.

This procedure is also possible with adb or droidexplorer. But my way of doing is practical and it is in realtime. If your build has different file name, please tell us.

This IS a development thread, please don't tell me to post in generic section or clutter.

This is manual workaround for non-working auto calibration. If auto-calibration works in the future, it may very well fix your freezes.

Values of AK8973Prms.txt file may solve touch screen/sensor freeze problems with your games. Feedbacks are always welcome. We should find out what the other values do exactly. Also check post 10 & 11

I had to try many times,but finally i ve found the right value for my device.With thyphoon rom you have to reboot after any change to take effect,so the process takes a little long...But great,now i can play asphalt 6 and use google sky map without any issue

It would be cool if someone with,programming experience,could build a program to make this process more user friendly,so we don t need to use a sense rom to calibrate the full system

I wish i helped with this post all the user with my same problem.I m sorry for my english,if it s not soo good