Hi,
I have two questions about the accelerometer, screen size and
orientation in Android (froyo).
The width of my screen is large than the height (The appearance likes
pic 1).
It doesn't like smart phone or Galaxy tablet.
pic 1.
+================+
+ +
+ +
+================+
//***************
Q1: The following information is reported from my device.
I want to double check these behaviour follow
the standard of Android framework.
Is this information correct and follow the standard?
If it is not, what the standard is.
When the device lies flat on a table.
Driver of accelerometer output:
(x, y, z)
Pull up the left side of device : value y is changed from 0 to
negative
Pull up the right side of device : value y is changed from 0 to
positive
Pull up the top side of device : value x is changed from 0 to
negative
Pull up the bottom side of device : value x is changed from 0 to
positive
In the HAL of accelerometer, I rotate it to fit my device.
data->acceleration.y = -(x * CONVERT);
data->acceleration.x = y * CONVERT;
data->acceleration.z = z * CONVERT;
where data is pointer of type sensors_data_t and the values
of right hand side x,y,z are fetched from driver.
The log from calculateNewRotation function of
WindowOrientationListener.java of Android framework.
Initial value:
I/WindowOrientationListener( 111): 85, 60, 0
Pull up the left side of device:
I/WindowOrientationListener( 111): new rotation = 2
I/WindowOrientationListener( 111): 82, 59, 2
I/WindowOrientationListener( 111): 83, 60, 2
I/WindowOrientationListener( 111): 83, 57, 2
I/WindowOrientationListener( 111): 83, 55, 2
Pull up the right side of device:
I/WindowOrientationListener( 111): new rotation = 1
I/WindowOrientationListener( 111): 273, 49, 1
I/WindowOrientationListener( 111): 272, 46, 1
I/WindowOrientationListener( 111): 270, 45, 1
I/WindowOrientationListener( 111): 269, 41, 1
Pull up the top side of device:
I/WindowOrientationListener( 111): new rotation = 0
I/WindowOrientationListener( 111): 338, 50, 0
I/WindowOrientationListener( 111): 348, 43, 0
I/WindowOrientationListener( 111): 350, 27, 0
I/WindowOrientationListener( 111): 351, 27, 0
Pull up the bottom side of device:
I/WindowOrientationListener( 111): new rotation = 1
I/WindowOrientationListener( 111): 177, 44, 1
I/WindowOrientationListener( 111): 178, 34, 1
I/WindowOrientationListener( 111): 178, 34, 1
I/WindowOrientationListener( 111): 177, 30, 1
The output of the application uses sensor manager:
Pull up the left side of device : value x is changed from 0 to
negative
Pull up the right side of device : value x is changed from 0 to
positive
Pull up the top side of device : value y is changed from 0 to
positive
Pull up the bottom side of device : value y is changed from 0 to
negative
//***************
Q2: When I run the Gallery3D, the behaviour is incorrect.
Then I find in the GridInputProcessor.java of Gallery3D has
one line to determine which value of sensor will be used.
The code is in below.
float valueToUse = (mCamera.mWidth < mCamera.mHeight) ?
values[0] : -values[1];
So when I rotate my device around Y axis of my device, the
pictures of Gallery3D will be rotate around X axis.
When I rotate my device around X axis of my device, the pictures
of Gallery3D will be rotate around Y axis.
The other games (labyrinth and Amazed) also can't work correctly
in my device.
My question is:
If the question 1 follow the standard of Android framework.
Is there any method make all applications can work
correctly in my device?
Should I modify the framework? How to modify?
Or the applications should modify their behaviour to fit the
different device.
//***************
Thank you.
--
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting