From b6df7d0e4c2117ca476662bd52b6745b3d8a305f Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 9 May 2013 14:53:35 -0700 Subject: [PATCH] make all libsurfaceflinger and libsensorservice symbols's visibility hidden we only export the main entry-point. this saves about 150KB. Change-Id: I55eb2b6705386fdfa43860deb62f9cdd2a0982aa --- include/binder/BinderService.h | 19 ++++++++++--------- services/sensorservice/Android.mk | 7 +++---- services/sensorservice/SensorService.h | 15 +++++++-------- services/surfaceflinger/Android.mk | 2 ++ services/surfaceflinger/SurfaceFlinger.h | 4 ++-- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/include/binder/BinderService.h b/include/binder/BinderService.h index 5ac36d901..ef703bda9 100644 --- a/include/binder/BinderService.h +++ b/include/binder/BinderService.h @@ -42,19 +42,20 @@ public: } static void publishAndJoinThreadPool(bool allowIsolated = false) { - sp sm(defaultServiceManager()); - sm->addService( - String16(SERVICE::getServiceName()), - new SERVICE(), allowIsolated); - ProcessState::self()->startThreadPool(); - ProcessState::self()->giveThreadPoolName(); - IPCThreadState::self()->joinThreadPool(); + publish(allowIsolated); + joinThreadPool(); } static void instantiate() { publish(); } - static status_t shutdown() { - return NO_ERROR; + static status_t shutdown() { return NO_ERROR; } + +private: + static void joinThreadPool() { + sp ps(ProcessState::self()); + ps->startThreadPool(); + ps->giveThreadPoolName(); + IPCThreadState::self()->joinThreadPool(); } }; diff --git a/services/sensorservice/Android.mk b/services/sensorservice/Android.mk index dd698c562..14a4e55e0 100644 --- a/services/sensorservice/Android.mk +++ b/services/sensorservice/Android.mk @@ -12,11 +12,12 @@ LOCAL_SRC_FILES:= \ SensorDevice.cpp \ SensorFusion.cpp \ SensorInterface.cpp \ - SensorService.cpp \ - + SensorService.cpp LOCAL_CFLAGS:= -DLOG_TAG=\"SensorService\" +LOCAL_CFLAGS += -fvisibility=hidden + LOCAL_SHARED_LIBRARIES := \ libcutils \ libhardware \ @@ -27,8 +28,6 @@ LOCAL_SHARED_LIBRARIES := \ libui \ libgui - - LOCAL_MODULE:= libsensorservice include $(BUILD_SHARED_LIBRARY) diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h index 25e5f764b..ff3b555f5 100644 --- a/services/sensorservice/SensorService.h +++ b/services/sensorservice/SensorService.h @@ -50,12 +50,13 @@ class SensorService : public BnSensorServer, protected Thread { - friend class BinderService; + friend class BinderService; - static const nsecs_t MINIMUM_EVENTS_PERIOD = 1000000; // 1000 Hz - static const char* WAKE_LOCK_NAME; + static const nsecs_t MINIMUM_EVENTS_PERIOD = 1000000; // 1000 Hz + static const char* WAKE_LOCK_NAME; - SensorService(); + static char const* getServiceName() ANDROID_API { return "sensorservice"; } + SensorService() ANDROID_API; virtual ~SensorService(); virtual void onFirstRef(); @@ -116,9 +117,9 @@ class SensorService : void registerSensor(SensorInterface* sensor); void registerVirtualSensor(SensorInterface* sensor); status_t cleanupWithoutDisable(const sp& connection, - int handle); + int handle); void cleanupAutoDisabledSensor(const sp& connection, - sensors_event_t const* buffer, const int count); + sensors_event_t const* buffer, const int count); // constants Vector mSensorList; @@ -138,8 +139,6 @@ class SensorService : KeyedVector mLastEventSeen; public: - static char const* getServiceName() { return "sensorservice"; } - void cleanupConnection(SensorEventConnection* connection); status_t enable(const sp& connection, int handle); status_t disable(const sp& connection, int handle); diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index ec296d333..71b235a1b 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -41,6 +41,8 @@ ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),) LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS) endif +LOCAL_CFLAGS += -fvisibility=hidden + LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 66c2d42fb..e7745b8ca 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -79,11 +79,11 @@ class SurfaceFlinger : public BinderService, private HWComposer::EventHandler { public: - static char const* getServiceName() { + static char const* getServiceName() ANDROID_API { return "SurfaceFlinger"; } - SurfaceFlinger(); + SurfaceFlinger() ANDROID_API; enum { EVENT_VSYNC = HWC_EVENT_VSYNC