summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2010-08-08 00:29:51 -0400
committerSteve Kondik <shade@chemlab.org>2010-08-08 16:26:10 -0400
commit41066ed56592a4348220f9b292cf623bcb79f3c9 (patch)
tree0be6e24053a5dccbf2daeb83c819ffaaa8dc3748 /core
parent8009c68c573be61877641ce878b7dfe53f647ae0 (diff)
downloadframeworks_base-41066ed56592a4348220f9b292cf623bcb79f3c9.zip
frameworks_base-41066ed56592a4348220f9b292cf623bcb79f3c9.tar.gz
frameworks_base-41066ed56592a4348220f9b292cf623bcb79f3c9.tar.bz2
HACK: Allow use of Eclair MemoryDealer for compatibility.
Take #2.
Diffstat (limited to 'core')
-rw-r--r--core/jni/Android.mk4
-rw-r--r--core/jni/CursorWindow.cpp19
-rw-r--r--core/jni/CursorWindow.h12
3 files changed, 30 insertions, 5 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 6edc45f..bd0f307 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -185,8 +185,8 @@ LOCAL_SHARED_LIBRARIES := \
ifneq ($(BOARD_USES_ECLAIR_LIBCAMERA),true)
LOCAL_SHARED_LIBRARIES += \
- libsurfaceflinger_client \
- libcamera_client
+ libsurfaceflinger_client \
+ libcamera_client
endif
ifeq ($(BOARD_HAVE_BLUETOOTH),true)
diff --git a/core/jni/CursorWindow.cpp b/core/jni/CursorWindow.cpp
index 7877921..f089583 100644
--- a/core/jni/CursorWindow.cpp
+++ b/core/jni/CursorWindow.cpp
@@ -18,9 +18,12 @@
#define LOG_TAG "CursorWindow"
#include <utils/Log.h>
+#ifdef USE_ECLAIR_MEMORYDEALER
+#include <binder/MemoryDealer.h>
+#else
#include <binder/MemoryHeapBase.h>
#include <binder/MemoryBase.h>
-
+#endif
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -38,7 +41,11 @@ CursorWindow::CursorWindow(size_t maxSize) :
{
}
+#ifdef USE_ECLAIR_MEMORYDEALER
+bool CursorWindow::setMemory(sp<IMemory> memory)
+#else
bool CursorWindow::setMemory(const sp<IMemory>& memory)
+#endif
{
mMemory = memory;
mData = (uint8_t *) memory->pointer();
@@ -48,6 +55,9 @@ bool CursorWindow::setMemory(const sp<IMemory>& memory)
mHeader = (window_header_t *) mData;
// Make the window read-only
+#ifdef USE_ECLAIR_MEMORYDEALER
+ mHeap = NULL;
+#endif
ssize_t size = memory->size();
mSize = size;
mMaxSize = size;
@@ -59,11 +69,16 @@ LOG_WINDOW("Created CursorWindow from existing IMemory: mFreeOffset = %d, numRow
bool CursorWindow::initBuffer(bool localOnly)
{
//TODO Use a non-memory dealer mmap region for localOnly
-
+#ifdef USE_ECLAIR_MEMORYDEALER
+ mHeap = new MemoryDealer(new SharedHeap(mMaxSize, 0, "CursorWindow"));
+ if (mHeap != NULL) {
+ mMemory = mHeap->allocate(mMaxSize);
+#else
sp<MemoryHeapBase> heap;
heap = new MemoryHeapBase(mMaxSize, 0, "CursorWindow");
if (heap != NULL) {
mMemory = new MemoryBase(heap, 0, mMaxSize);
+#endif
if (mMemory != NULL) {
mData = (uint8_t *) mMemory->pointer();
if (mData) {
diff --git a/core/jni/CursorWindow.h b/core/jni/CursorWindow.h
index 3fcb560..f5d791a 100644
--- a/core/jni/CursorWindow.h
+++ b/core/jni/CursorWindow.h
@@ -21,9 +21,12 @@
#include <stddef.h>
#include <stdint.h>
+#ifdef USE_ECLAIR_MEMORYDEALER
+#include <binder/MemoryDealer.h>
+#else
#include <binder/IMemory.h>
#include <utils/RefBase.h>
-
+#endif
#include <jni.h>
#define DEFAULT_WINDOW_SIZE 4096
@@ -101,7 +104,11 @@ class CursorWindow
public:
CursorWindow(size_t maxSize);
CursorWindow(){}
+#ifdef USE_ECLAIR_MEMORYDEALER
+ bool setMemory(sp<IMemory>);
+#else
bool setMemory(const sp<IMemory>&);
+#endif
~CursorWindow();
bool initBuffer(bool localOnly);
@@ -189,6 +196,9 @@ private:
size_t mSize;
size_t mMaxSize;
window_header_t * mHeader;
+#ifdef USE_ECLAIR_MEMORYDEALER
+ sp<MemoryDealer> mHeap;
+#endif
sp<IMemory> mMemory;
/**