#!/bin/sh
#
# launch location-service based on Android properties
#

if [ -x /usr/bin/getprop ] && [ "$(getprop custom.location.testing)" = "true" ]; then
    export TRUST_STORE_PERMISSION_MANAGER_IS_RUNNING_UNDER_TESTING="1"
fi

if [ -x /usr/bin/getprop ] && [ "$(getprop custom.location.fake)" = "true" ]; then
    lat="$(getprop custom.location.lat 51.505660)"
    lon="$(getprop custom.location.lon -0.099850)"
    # use just the dummy provider
    exec lomiri-location-serviced --bus system --provider dummy::Provider --dummy::Provider::ReferenceLocationLat="${lat}" --dummy::Provider::ReferenceLocationLon="${lon}"
else
    exec lomiri-location-serviced --bus system --provider gps::Provider --provider remote::Provider
fi
