Search code examples
androidsensorsandroid-sensorsandroid-hardwaresensor-fusion

How are Android sensor TYPE_LINEAR_ACCELERATION and TYPE_ROTATION_VECTOR implemented?


I have been searching for quiet some time for the algorithm used by the Android API to fuse raw data from different sensors to produce virtual sensors.

How have they been implemented? Is the source code available somewhere?


Solution

  • Is the source code available somewhere?

    Unfortunately, the Fused Location Provider API is not a part of the Android Open Source Project but rather it's implemented as a part of Google Play Services which is a proprietary Google software and it's source code is not publicly available. In fact, the FusedLocationProviderApi.java interface implementations are purposedly obfuscated, for example:

    public class zzd implements FusedLocationProviderApi {
        public zzd() {
        }
    
        public Location getLastLocation(GoogleApiClient var1) {
            zzl var2 = LocationServices.zzj(var1);
    
            try {
                return var2.getLastLocation();
            } catch (Exception var4) {
                return null;
            }
        }
    ...
    

    How have they been implemented?

    Since the source is not available, we may only speculate on how exactly it's implemented.