Add a compatibility symbol for the MemoryBase constructor.
Third-party libraries are currently trying to use the MemoryBase constructor but failing because we fixed the definition of ssize_t. This is a stop-gap for users of this private API until we can get them fixed. Bug: 8253769 Change-Id: I8a19770f3252d88ee87023fde625cc6289924b0d
This commit is contained in:
parent
ba8abb517d
commit
7f974ff2f3
@ -40,6 +40,9 @@ protected:
|
|||||||
const sp<IMemoryHeap>& getHeap() const { return mHeap; }
|
const sp<IMemoryHeap>& getHeap() const { return mHeap; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Backwards compatibility for libdatabase_sqlcipher (http://b/8253769).
|
||||||
|
MemoryBase(const sp<IMemoryHeap>& heap, long offset, unsigned int size);
|
||||||
|
|
||||||
size_t mSize;
|
size_t mSize;
|
||||||
ssize_t mOffset;
|
ssize_t mOffset;
|
||||||
sp<IMemoryHeap> mHeap;
|
sp<IMemoryHeap> mHeap;
|
||||||
|
@ -298,11 +298,11 @@ void BpMemoryHeap::assertReallyMapped() const
|
|||||||
uint32_t flags = reply.readInt32();
|
uint32_t flags = reply.readInt32();
|
||||||
uint32_t offset = reply.readInt32();
|
uint32_t offset = reply.readInt32();
|
||||||
|
|
||||||
ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)",
|
ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%d, err=%d (%s)",
|
||||||
asBinder().get(), parcel_fd, size, err, strerror(-err));
|
asBinder().get(), parcel_fd, size, err, strerror(-err));
|
||||||
|
|
||||||
int fd = dup( parcel_fd );
|
int fd = dup( parcel_fd );
|
||||||
ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)",
|
ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%d, err=%d (%s)",
|
||||||
parcel_fd, size, err, strerror(errno));
|
parcel_fd, size, err, strerror(errno));
|
||||||
|
|
||||||
int access = PROT_READ;
|
int access = PROT_READ;
|
||||||
@ -315,7 +315,7 @@ void BpMemoryHeap::assertReallyMapped() const
|
|||||||
mRealHeap = true;
|
mRealHeap = true;
|
||||||
mBase = mmap(0, size, access, MAP_SHARED, fd, offset);
|
mBase = mmap(0, size, access, MAP_SHARED, fd, offset);
|
||||||
if (mBase == MAP_FAILED) {
|
if (mBase == MAP_FAILED) {
|
||||||
ALOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)",
|
ALOGE("cannot map BpMemoryHeap (binder=%p), size=%d, fd=%d (%s)",
|
||||||
asBinder().get(), size, fd, strerror(errno));
|
asBinder().get(), size, fd, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LOG_TAG "MemoryBase"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -31,6 +32,14 @@ MemoryBase::MemoryBase(const sp<IMemoryHeap>& heap,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MemoryBase::MemoryBase(const sp<IMemoryHeap>& heap,
|
||||||
|
long offset, unsigned int size)
|
||||||
|
: mSize(size), mOffset(offset), mHeap(heap)
|
||||||
|
{
|
||||||
|
ALOGW("Using temporary compatibility workaround for usage of MemoryBase "
|
||||||
|
"private API. Please fix your application!");
|
||||||
|
}
|
||||||
|
|
||||||
sp<IMemoryHeap> MemoryBase::getMemory(ssize_t* offset, size_t* size) const
|
sp<IMemoryHeap> MemoryBase::getMemory(ssize_t* offset, size_t* size) const
|
||||||
{
|
{
|
||||||
if (offset) *offset = mOffset;
|
if (offset) *offset = mOffset;
|
||||||
|
Loading…
Reference in New Issue
Block a user