package com.dragonfruitstudios.brokenbonez.Input;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.util.Log;

public class Accelerometer {
    /**
     * Returns a value between -1 and 1 determining the strength of the bike tilting.
     */
    public static float calculateTiltStrength(SensorEvent event) {
        if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
            float accelY = event.values[1];
            return accelY / 9.81f;
        }
        return 0f;
    }
}
@@ -158,16 +158,41 @@
 stener;%0A
+import android.os.Build;%0A
 import a
@@ -208,16 +208,16 @@
 il.Log;%0A
-
 %0Apublic 
@@ -403,24 +403,170 @@
 nt event) %7B%0A
+        // TODO: The emulator gives incorrect accelerometer values for some reason.%0A        if (isEmulator()) %7B%0A            return 0f;%0A        %7D%0A%0A
         if (
@@ -709,16 +709,16 @@
       %7D%0A
-
         
@@ -733,10 +733,557 @@
 f;%0A    %7D
+%0A%0A    private static boolean isEmulator() %7B%0A        return Build.FINGERPRINT.startsWith(%22generic%22)%0A                %7C%7C Build.FINGERPRINT.startsWith(%22unknown%22)%0A                %7C%7C Build.MODEL.contains(%22google_sdk%22)%0A                %7C%7C Build.MODEL.contains(%22Emulator%22)%0A                %7C%7C Build.MODEL.contains(%22Android SDK built for x86%22)%0A                %7C%7C Build.MANUFACTURER.contains(%22Genymotion%22)%0A                %7C%7C (Build.BRAND.startsWith(%22generic%22) && Build.DEVICE.startsWith(%22generic%22))%0A                %7C%7C %22google_sdk%22.equals(Build.PRODUCT);%0A    %7D
 %0A%7D

Disable Acceloremeter in emulator.