add libsurfaceflinger_ddmconnection for PDK build
- the library is dlopened from libsurfaceflinger - the library built only when libnativehelper exists Bug: 7089510 Change-Id: Ib3ea1029d7e8f6e055f4b759d0bf68f5123fa8a1
This commit is contained in:
parent
c397360883
commit
63f165fd6b
|
@ -52,3 +52,19 @@ LOCAL_SHARED_LIBRARIES := \
|
||||||
LOCAL_MODULE:= libsurfaceflinger
|
LOCAL_MODULE:= libsurfaceflinger
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
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
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
|
void DdmConnection_start(const char* name) {
|
||||||
|
ALOGI("DdmConnection_start");
|
||||||
|
DdmConnection::start(name);
|
||||||
|
}
|
||||||
|
|
||||||
void DdmConnection::start(const char* name) {
|
void DdmConnection::start(const char* name) {
|
||||||
JavaVM* vm;
|
JavaVM* vm;
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
|
// wrapper for dlsym
|
||||||
|
extern "C" void DdmConnection_start(const char* name);
|
||||||
|
|
||||||
class DdmConnection {
|
class DdmConnection {
|
||||||
public:
|
public:
|
||||||
static void start(const char* name);
|
static void start(const char* name);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
|
@ -108,9 +109,11 @@ SurfaceFlinger::SurfaceFlinger()
|
||||||
property_get("debug.sf.ddms", value, "0");
|
property_get("debug.sf.ddms", value, "0");
|
||||||
mDebugDDMS = atoi(value);
|
mDebugDDMS = atoi(value);
|
||||||
if (mDebugDDMS) {
|
if (mDebugDDMS) {
|
||||||
DdmConnection::start(getServiceName());
|
if (!startDdmConnection()) {
|
||||||
|
// start failed, and DDMS debugging not enabled
|
||||||
|
mDebugDDMS = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGI_IF(mDebugRegion, "showupdates enabled");
|
ALOGI_IF(mDebugRegion, "showupdates enabled");
|
||||||
ALOGI_IF(mDebugDDMS, "DDMS debugging enabled");
|
ALOGI_IF(mDebugDDMS, "DDMS debugging enabled");
|
||||||
}
|
}
|
||||||
|
@ -2061,6 +2064,24 @@ void SurfaceFlinger::dumpAllLocked(
|
||||||
hw->dump(result);
|
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(
|
status_t SurfaceFlinger::onTransact(
|
||||||
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
|
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -388,6 +388,7 @@ private:
|
||||||
void clearStatsLocked(const Vector<String16>& args, size_t& index,
|
void clearStatsLocked(const Vector<String16>& args, size_t& index,
|
||||||
String8& result, char* buffer, size_t SIZE) const;
|
String8& result, char* buffer, size_t SIZE) const;
|
||||||
void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const;
|
void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const;
|
||||||
|
bool startDdmConnection();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------
|
||||||
* Attributes
|
* Attributes
|
||||||
|
|
Loading…
Reference in New Issue