We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b090bc commit d77d60dCopy full SHA for d77d60d
sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java
@@ -78,8 +78,8 @@ public void onSensorChanged(final @NotNull SensorEvent event) {
78
float gX = event.values[0] / SensorManager.GRAVITY_EARTH;
79
float gY = event.values[1] / SensorManager.GRAVITY_EARTH;
80
float gZ = event.values[2] / SensorManager.GRAVITY_EARTH;
81
- double gForce = Math.sqrt(gX * gX + gY * gY + gZ * gZ);
82
- if (gForce > SHAKE_THRESHOLD_GRAVITY) {
+ double gForceSquared = gX * gX + gY * gY + gZ * gZ;
+ if (gForceSquared > SHAKE_THRESHOLD_GRAVITY * SHAKE_THRESHOLD_GRAVITY) {
83
long now = SystemClock.elapsedRealtime();
84
85
// Reset counter if outside the detection window
0 commit comments