2009-03-04 03:31:44 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
#define LOG_TAG "ISurface"
|
|
|
|
|
2009-03-04 03:31:44 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2009-05-20 02:08:10 +00:00
|
|
|
#include <binder/Parcel.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2012-02-26 02:48:35 +00:00
|
|
|
#include <gui/ISurface.h>
|
2012-12-18 17:49:45 +00:00
|
|
|
#include <gui/IGraphicBufferProducer.h>
|
2010-02-10 01:46:37 +00:00
|
|
|
|
2009-03-04 03:31:44 +00:00
|
|
|
namespace android {
|
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2009-03-04 03:31:44 +00:00
|
|
|
class BpSurface : public BpInterface<ISurface>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BpSurface(const sp<IBinder>& impl)
|
|
|
|
: BpInterface<ISurface>(impl)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-12-18 17:49:45 +00:00
|
|
|
virtual sp<IGraphicBufferProducer> getSurfaceTexture() const {
|
2009-04-10 21:24:30 +00:00
|
|
|
Parcel data, reply;
|
|
|
|
data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
|
2011-04-20 21:20:59 +00:00
|
|
|
remote()->transact(GET_SURFACE_TEXTURE, data, &reply);
|
2012-12-18 17:49:45 +00:00
|
|
|
return interface_cast<IGraphicBufferProducer>(reply.readStrongBinder());
|
2010-05-07 22:58:44 +00:00
|
|
|
}
|
2009-03-04 03:31:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_META_INTERFACE(Surface, "android.ui.ISurface");
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
status_t BnSurface::onTransact(
|
|
|
|
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
|
|
|
|
{
|
|
|
|
switch(code) {
|
2011-04-20 21:20:59 +00:00
|
|
|
case GET_SURFACE_TEXTURE: {
|
2010-05-07 22:58:44 +00:00
|
|
|
CHECK_INTERFACE(ISurface, data, reply);
|
2011-04-20 21:20:59 +00:00
|
|
|
reply->writeStrongBinder( getSurfaceTexture()->asBinder() );
|
2010-05-07 22:58:44 +00:00
|
|
|
return NO_ERROR;
|
|
|
|
}
|
2009-03-04 03:31:44 +00:00
|
|
|
default:
|
|
|
|
return BBinder::onTransact(code, data, reply, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}; // namespace android
|