From c12b7ba81ec3b486f21394810d827258ba888ee4 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 26 May 2011 21:52:39 -0700 Subject: sensorservice can now be ran standalone Change-Id: I6e757f31f1e020046038e5ab84e71b8689a0aed3 --- cmds/sensorservice/Android.mk | 19 +++++++++++++++++++ cmds/sensorservice/main_sensorservice.cpp | 25 +++++++++++++++++++++++++ cmds/system_server/library/system_init.cpp | 7 +++++-- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 cmds/sensorservice/Android.mk create mode 100644 cmds/sensorservice/main_sensorservice.cpp diff --git a/cmds/sensorservice/Android.mk b/cmds/sensorservice/Android.mk new file mode 100644 index 000000000000..0811be57f61d --- /dev/null +++ b/cmds/sensorservice/Android.mk @@ -0,0 +1,19 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + main_sensorservice.cpp + +LOCAL_SHARED_LIBRARIES := \ + libsensorservice \ + libbinder \ + libutils + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../../services/sensorservice + +LOCAL_MODULE_TAGS := optional + +LOCAL_MODULE:= sensorservice + +include $(BUILD_EXECUTABLE) diff --git a/cmds/sensorservice/main_sensorservice.cpp b/cmds/sensorservice/main_sensorservice.cpp new file mode 100644 index 000000000000..8610627b80c3 --- /dev/null +++ b/cmds/sensorservice/main_sensorservice.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace android; + +int main(int argc, char** argv) { + SensorService::publishAndJoinThreadPool(); + return 0; +} diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp index b615764c029f..a19711e4794b 100644 --- a/cmds/system_server/library/system_init.cpp +++ b/cmds/system_server/library/system_init.cpp @@ -70,8 +70,11 @@ extern "C" status_t system_init() SurfaceFlinger::instantiate(); } - // Start the sensor service - SensorService::instantiate(); + property_get("system_init.startsensorservice", propBuf, "1"); + if (strcmp(propBuf, "1") == 0) { + // Start the sensor service + SensorService::instantiate(); + } // On the simulator, audioflinger et al don't get started the // same way as on the device, and we need to start them here -- cgit v1.2.3-59-g8ed1b