[android-developers] Re: getRotationMatrixFromVector() broken on Note 3
On Wednesday, October 2, 2013 8:41:01 AM UTC-5, String wrote:
I've been getting error reports from users of the Note 3 that boil down to the following:
java.lang.
IllegalArgumentException: R array length must be 3 or 4 at android.hardware.
SensorManager. getRotationMatrixFromVector( SensorManager.java:1336)
This function, getRotationMatrixFro
mVector() , is documented as a "Helper function to convert a rotation vector to a rotation matrix. Given a rotation vector (presumably from a ROTATION_VECTOR sensor)". My typical call to this function looks like this:
SensorManager.
getRotationMatrixFromVector(R, rotationVector);
Where the rotationVector comes from the hardware accelerometer and gyroscope, and (despite the error message about R) it's with this parameter where the problem lies. It's directly passed from android.hardware.
SensorEventListener. for a Sensor.TYPE_ROTATION_VECTORonSensorChanged(SensorEvent event) event. The event parameter there has a values property that is passed as the rotationVector in the previous call. And according to the docs at
http://developer.android.com/reference/android/hardware/ , this array can legitimately have up to 5 elements - moreover, in Android 4.3, it should have all 5. However, passing an array of length 5 causes the Note 3 to crash on the aforementioned IllegalArgumentSensorEvent.html#values Exception ; it seems to expect 4 elements at most.
So, here's the summary: Android 4.3 passes an array with 5 elements to this hardware event, and the Note 3 throws an exception when passed that same array to the system-defined helper function for that event. This behavior does not happen on the other 4.3 devices I have at hand (Galaxy Nexus and Nexus 7); it appears to be a basic flaw in the Samsung implementation of 4.3.
And I know, this all looks like minutiae of a hyper-specific issue - but believe me, it's likely to be encountered by any app using the device's motion sensors. A Google search for getRotationMatrixFromVecto
r returns 51,400 results.
Any comment from Samsung on this would be most welcome, if unlikely.
String
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home