diff options
-rw-r--r-- | examples/sensors/example-app/README | 4 | ||||
-rw-r--r-- | vendorsetup.sh | 40 |
2 files changed, 30 insertions, 14 deletions
diff --git a/examples/sensors/example-app/README b/examples/sensors/example-app/README index 6cbfebb..a8d2c61 100644 --- a/examples/sensors/example-app/README +++ b/examples/sensors/example-app/README @@ -20,3 +20,7 @@ Example files: accelerometer and custom sensor (defined in example_sensors.{h|cpp}). The accelerometer always returns random data. The custom sensor returns the hour for the local time. + + To use this HAL implementation, push the binary file sensors.example into + /system/lib/hw/ folder and rename it to sensors.default (make sure there is + no other sensors.* file under that folder). diff --git a/vendorsetup.sh b/vendorsetup.sh index 44442a0..40b992d 100644 --- a/vendorsetup.sh +++ b/vendorsetup.sh @@ -56,6 +56,22 @@ scan_for_brillo_devices eval "overridden_$(declare -f make)" # TODO(arihc): move all this functionality into brunch build. make() { + # TODO(arihc): This first part should be part of BDK install. + local T="$(gettop)" + local BRUNCH_LIB_DIR="${T}/tools/bdk/brunch/lib" + if [ -z "$PYTHONPATH" ]; then + export PYTHONPATH=${BRUNCH_LIB_DIR} + else + export PYTHONPATH=${BRUNCH_LIB_DIR}:${PYTHONPATH} + fi + # For now, assume that if the config file exists, + # the user has had a chance to opt in/out. Otherwise + # prompt them. + if [[ ! -e "${T}/.user_config.db" ]]; then + python "${BRUNCH_LIB_DIR}/tools/setup.py" + fi + + # Actually perform the build (and time it) local start_time=$(date +"%s") overridden_make "$@" local ret=$? @@ -72,19 +88,15 @@ make() { # * The user has opted in. # * The build was successful. # * The build was non-trivial. - local T="$(gettop)" - local BRUNCH_LIB_DIR="${T}/tools/bdk/brunch/lib" - # TODO(arihc) (b/24410633): Check the configuration file in the brunch dir - # for opt-in instead of using an environment variable. - if [[ "${BRILLO_ANALYTICS_OPT_IN}" -ne 0 && "$ret" -eq 0 && \ - "$tdiff" -gt 0 ]]; then - if [ -z "$PYTHONPATH" ]; then - export PYTHONPATH=${BRUNCH_LIB_DIR} - else - export PYTHONPATH=${BRUNCH_LIB_DIR}:${PYTHONPATH} - fi - local data_script="${BRUNCH_LIB_DIR}/metrics/send_build.py" - (python "${data_script}" "${make_type}" "$tdiff" & ) - fi + # TODO(arihc): Should be part of brunch build command. + (local check_opt_in_script="${BRUNCH_LIB_DIR}/metrics/check_opt_in.py" + python "${check_opt_in_script}" + local opt_in=$? + if [[ "${opt_in}" -eq 1 && "$ret" -eq 0 && \ + "$tdiff" -gt 0 ]]; then + local data_script="${BRUNCH_LIB_DIR}/metrics/send_build.py" + python "${data_script}" "${make_type}" "$tdiff" + fi & ) + return $ret } |