Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 838aa45b authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "fix [4026375] SensorManager quaternion functions can call sqrt with a...

Merge "fix [4026375] SensorManager quaternion functions can call sqrt with a negative number" into honeycomb-mr1
parents c8a4b11e 0eab8214
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -2051,8 +2051,8 @@ public class SensorManager
        if (rv.length == 4) {
        if (rv.length == 4) {
            Q[0] = rv[3];
            Q[0] = rv[3];
        } else {
        } else {
            //In this case, the w component of the quaternion is known to be a positive number
            Q[0] = 1 - rv[0]*rv[0] - rv[1]*rv[1] - rv[2]*rv[2];
            Q[0] = (float)Math.sqrt(1 - rv[0]*rv[0] - rv[1]*rv[1] - rv[2]*rv[2]);
            Q[0] = (Q[0] > 0) ? (float)Math.sqrt(Q[0]) : 0;
        }
        }
        Q[1] = rv[0];
        Q[1] = rv[0];
        Q[2] = rv[1];
        Q[2] = rv[1];