summaryrefslogtreecommitdiffstats
path: root/libs/gui/ISurfaceComposer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui/ISurfaceComposer.cpp')
-rw-r--r--libs/gui/ISurfaceComposer.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index ebb687a..78886d5 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -51,9 +51,10 @@ public:
{
}
+ virtual ~BpSurfaceComposer();
+
virtual sp<ISurfaceComposerClient> createConnection()
{
- uint32_t n;
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply);
@@ -62,7 +63,6 @@ public:
virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc()
{
- uint32_t n;
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
remote()->transact(BnSurfaceComposer::CREATE_GRAPHIC_BUFFER_ALLOC, data, &reply);
@@ -76,23 +76,18 @@ public:
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- {
- Vector<ComposerState>::const_iterator b(state.begin());
- Vector<ComposerState>::const_iterator e(state.end());
- data.writeInt32(state.size());
- for ( ; b != e ; ++b ) {
- b->write(data);
- }
+
+ data.writeUint32(static_cast<uint32_t>(state.size()));
+ for (const auto& s : state) {
+ s.write(data);
}
- {
- Vector<DisplayState>::const_iterator b(displays.begin());
- Vector<DisplayState>::const_iterator e(displays.end());
- data.writeInt32(displays.size());
- for ( ; b != e ; ++b ) {
- b->write(data);
- }
+
+ data.writeUint32(static_cast<uint32_t>(displays.size()));
+ for (const auto& d : displays) {
+ d.write(data);
}
- data.writeInt32(flags);
+
+ data.writeUint32(flags);
remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
}
@@ -113,12 +108,12 @@ public:
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
data.writeStrongBinder(display);
- data.writeStrongBinder(producer->asBinder());
+ data.writeStrongBinder(IInterface::asBinder(producer));
data.write(sourceCrop);
- data.writeInt32(reqWidth);
- data.writeInt32(reqHeight);
- data.writeInt32(minLayerZ);
- data.writeInt32(maxLayerZ);
+ data.writeUint32(reqWidth);
+ data.writeUint32(reqHeight);
+ data.writeUint32(minLayerZ);
+ data.writeUint32(maxLayerZ);
data.writeInt32(static_cast<int32_t>(useIdentityTransform));
data.writeInt32(static_cast<int32_t>(rotation));
remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply);
@@ -137,7 +132,7 @@ public:
"interface descriptor: %s (%d)", strerror(-err), -err);
return false;
}
- err = data.writeStrongBinder(bufferProducer->asBinder());
+ err = data.writeStrongBinder(IInterface::asBinder(bufferProducer));
if (err != NO_ERROR) {
ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
"strong binder to parcel: %s (%d)", strerror(-err), -err);
@@ -226,7 +221,7 @@ public:
remote()->transact(BnSurfaceComposer::GET_DISPLAY_CONFIGS, data, &reply);
status_t result = reply.readInt32();
if (result == NO_ERROR) {
- size_t numConfigs = static_cast<size_t>(reply.readInt32());
+ size_t numConfigs = reply.readUint32();
configs->clear();
configs->resize(numConfigs);
for (size_t c = 0; c < numConfigs; ++c) {
@@ -289,6 +284,10 @@ public:
}
};
+// Out-of-line virtual method definition to trigger vtable emission in this
+// translation unit (see clang warning -Wweak-vtables)
+BpSurfaceComposer::~BpSurfaceComposer() {}
+
IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer");
// ----------------------------------------------------------------------
@@ -299,46 +298,49 @@ status_t BnSurfaceComposer::onTransact(
switch(code) {
case CREATE_CONNECTION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> b = createConnection()->asBinder();
+ sp<IBinder> b = IInterface::asBinder(createConnection());
reply->writeStrongBinder(b);
return NO_ERROR;
}
case CREATE_GRAPHIC_BUFFER_ALLOC: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> b = createGraphicBufferAlloc()->asBinder();
+ sp<IBinder> b = IInterface::asBinder(createGraphicBufferAlloc());
reply->writeStrongBinder(b);
return NO_ERROR;
}
case SET_TRANSACTION_STATE: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- size_t count = data.readInt32();
+
+ size_t count = data.readUint32();
if (count > data.dataSize()) {
return BAD_VALUE;
}
ComposerState s;
Vector<ComposerState> state;
state.setCapacity(count);
- for (size_t i=0 ; i<count ; i++) {
+ for (size_t i = 0; i < count; i++) {
if (s.read(data) == BAD_VALUE) {
return BAD_VALUE;
}
state.add(s);
}
- count = data.readInt32();
+
+ count = data.readUint32();
if (count > data.dataSize()) {
return BAD_VALUE;
}
DisplayState d;
Vector<DisplayState> displays;
displays.setCapacity(count);
- for (size_t i=0 ; i<count ; i++) {
+ for (size_t i = 0; i < count; i++) {
if (d.read(data) == BAD_VALUE) {
return BAD_VALUE;
}
displays.add(d);
}
- uint32_t flags = data.readInt32();
- setTransactionState(state, displays, flags);
+
+ uint32_t stateFlags = data.readUint32();
+ setTransactionState(state, displays, stateFlags);
return NO_ERROR;
}
case BOOT_FINISHED: {
@@ -353,12 +355,12 @@ status_t BnSurfaceComposer::onTransact(
interface_cast<IGraphicBufferProducer>(data.readStrongBinder());
Rect sourceCrop;
data.read(sourceCrop);
- uint32_t reqWidth = data.readInt32();
- uint32_t reqHeight = data.readInt32();
- uint32_t minLayerZ = data.readInt32();
- uint32_t maxLayerZ = data.readInt32();
+ uint32_t reqWidth = data.readUint32();
+ uint32_t reqHeight = data.readUint32();
+ uint32_t minLayerZ = data.readUint32();
+ uint32_t maxLayerZ = data.readUint32();
bool useIdentityTransform = static_cast<bool>(data.readInt32());
- uint32_t rotation = data.readInt32();
+ int32_t rotation = data.readInt32();
status_t res = captureScreen(display, producer,
sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ,
@@ -378,7 +380,7 @@ status_t BnSurfaceComposer::onTransact(
case CREATE_DISPLAY_EVENT_CONNECTION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IDisplayEventConnection> connection(createDisplayEventConnection());
- reply->writeStrongBinder(connection->asBinder());
+ reply->writeStrongBinder(IInterface::asBinder(connection));
return NO_ERROR;
}
case CREATE_DISPLAY: {
@@ -409,7 +411,7 @@ status_t BnSurfaceComposer::onTransact(
status_t result = getDisplayConfigs(display, &configs);
reply->writeInt32(result);
if (result == NO_ERROR) {
- reply->writeInt32(static_cast<int32_t>(configs.size()));
+ reply->writeUint32(static_cast<uint32_t>(configs.size()));
for (size_t c = 0; c < configs.size(); ++c) {
memcpy(reply->writeInplace(sizeof(DisplayInfo)),
&configs[c], sizeof(DisplayInfo));
@@ -469,8 +471,6 @@ status_t BnSurfaceComposer::onTransact(
return BBinder::onTransact(code, data, reply, flags);
}
}
- // should be unreachable
- return NO_ERROR;
}
// ----------------------------------------------------------------------------