diff options
author | Keun young Park <keunyoung@google.com> | 2012-08-31 10:53:36 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-08-31 20:08:33 -0700 |
commit | 63f165fd6b86d04be94d4023e845e98560504a96 (patch) | |
tree | d7de956ab8adb8b6ebca7e086b3cf1577d0b73ee /services | |
parent | c39736088398a9b4367b30fc307ed7de96ac342e (diff) | |
download | frameworks_native-63f165fd6b86d04be94d4023e845e98560504a96.zip frameworks_native-63f165fd6b86d04be94d4023e845e98560504a96.tar.gz frameworks_native-63f165fd6b86d04be94d4023e845e98560504a96.tar.bz2 |
add libsurfaceflinger_ddmconnection for PDK build
- the library is dlopened from libsurfaceflinger
- the library built only when libnativehelper exists
Bug: 7089510
Change-Id: Ib3ea1029d7e8f6e055f4b759d0bf68f5123fa8a1
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/Android.mk | 16 | ||||
-rw-r--r-- | services/surfaceflinger/DdmConnection.cpp | 4 | ||||
-rw-r--r-- | services/surfaceflinger/DdmConnection.h | 3 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 25 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 1 |
5 files changed, 47 insertions, 2 deletions
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index dd0dc16..07002cc 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -52,3 +52,19 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_MODULE:= libsurfaceflinger include $(BUILD_SHARED_LIBRARY) + +############################################################### +# uses jni which may not be available in PDK +ifneq ($(wildcard libnativehelper/include),) +include $(CLEAR_VARS) +LOCAL_SRC_FILES:= \ + DdmConnection.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libdl + +LOCAL_MODULE:= libsurfaceflinger_ddmconnection + +include $(BUILD_SHARED_LIBRARY) +endif # libnativehelper diff --git a/services/surfaceflinger/DdmConnection.cpp b/services/surfaceflinger/DdmConnection.cpp index 433b38e..ece965c 100644 --- a/services/surfaceflinger/DdmConnection.cpp +++ b/services/surfaceflinger/DdmConnection.cpp @@ -23,6 +23,10 @@ namespace android { +void DdmConnection_start(const char* name) { + ALOGI("DdmConnection_start"); + DdmConnection::start(name); +} void DdmConnection::start(const char* name) { JavaVM* vm; diff --git a/services/surfaceflinger/DdmConnection.h b/services/surfaceflinger/DdmConnection.h index 91b737c..b6b088b 100644 --- a/services/surfaceflinger/DdmConnection.h +++ b/services/surfaceflinger/DdmConnection.h @@ -19,6 +19,9 @@ namespace android { +// wrapper for dlsym +extern "C" void DdmConnection_start(const char* name); + class DdmConnection { public: static void start(const char* name); diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 7124b0c..ee653f3 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -20,6 +20,7 @@ #include <sys/types.h> #include <errno.h> #include <math.h> +#include <dlfcn.h> #include <EGL/egl.h> #include <GLES/gl.h> @@ -108,9 +109,11 @@ SurfaceFlinger::SurfaceFlinger() property_get("debug.sf.ddms", value, "0"); mDebugDDMS = atoi(value); if (mDebugDDMS) { - DdmConnection::start(getServiceName()); + if (!startDdmConnection()) { + // start failed, and DDMS debugging not enabled + mDebugDDMS = 0; + } } - ALOGI_IF(mDebugRegion, "showupdates enabled"); ALOGI_IF(mDebugDDMS, "DDMS debugging enabled"); } @@ -2061,6 +2064,24 @@ void SurfaceFlinger::dumpAllLocked( hw->dump(result); } +bool SurfaceFlinger::startDdmConnection() +{ + void* libddmconnection_dso = + dlopen("libsurfaceflinger_ddmconnection.so", RTLD_NOW); + if (!libddmconnection_dso) { + return false; + } + void (*DdmConnection_start)(const char* name); + DdmConnection_start = + (typeof DdmConnection_start)dlsym(libddmconnection_dso, "DdmConnection_start"); + if (!DdmConnection_start) { + dlclose(libddmconnection_dso); + return false; + } + (*DdmConnection_start)(getServiceName()); + return true; +} + status_t SurfaceFlinger::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 50fef00..9db6b2d 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -388,6 +388,7 @@ private: void clearStatsLocked(const Vector<String16>& args, size_t& index, String8& result, char* buffer, size_t SIZE) const; void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const; + bool startDdmConnection(); /* ------------------------------------------------------------------------ * Attributes |