boost::shared_ptr<RotoItem> RotoItem::getPreviousItemInLayer() const { boost::shared_ptr<RotoLayer> layer = getParentLayer(); if (!layer) { return boost::shared_ptr<RotoItem>(); } return getPreviousInLayer(layer, shared_from_this()); }
std::string RotoItem::getFullyQualifiedName() const { std::string name = getScriptName(); boost::shared_ptr<RotoLayer> parent = getParentLayer(); if (parent) { getScriptNameRecursive(parent.get(), &name); } return name; }
RotoItemPtr RotoItem::getPreviousItemInLayer() const { RotoLayerPtr layer = getParentLayer(); if (!layer) { return RotoItemPtr(); } return getPreviousInLayer( layer, shared_from_this() ); }
status_t Client::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { // these must be checked IPCThreadState* ipc = IPCThreadState::self(); const int pid = ipc->getCallingPid(); const int uid = ipc->getCallingUid(); const int self_pid = getpid(); // If we are called from another non root process without the GRAPHICS, SYSTEM, or ROOT // uid we require the sAccessSurfaceFlinger permission. // We grant an exception in the case that the Client has a "parent layer", as its // effects will be scoped to that layer. if (CC_UNLIKELY(pid != self_pid && uid != AID_GRAPHICS && uid != AID_SYSTEM && uid != 0) && (getParentLayer() == nullptr)) { // we're called from a different process, do the real check if (!PermissionCache::checkCallingPermission(sAccessSurfaceFlinger)) { ALOGE("Permission Denial: " "can't openGlobalTransaction pid=%d, uid<=%d", pid, uid); return PERMISSION_DENIED; } } return BnSurfaceComposerClient::onTransact(code, data, reply, flags); }
status_t Client::createSurface( const String8& name, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, const sp<IBinder>& parentHandle, uint32_t windowType, uint32_t ownerUid, sp<IBinder>* handle, sp<IGraphicBufferProducer>* gbp) { sp<Layer> parent = nullptr; if (parentHandle != nullptr) { parent = getLayerUser(parentHandle); if (parent == nullptr) { return NAME_NOT_FOUND; } } if (parent == nullptr) { bool parentDied; parent = getParentLayer(&parentDied); // If we had a parent, but it died, we've lost all // our capabilities. if (parentDied) { return NAME_NOT_FOUND; } } /* * createSurface must be called from the GL thread so that it can * have access to the GL context. */ class MessageCreateLayer : public MessageBase { SurfaceFlinger* flinger; Client* client; sp<IBinder>* handle; sp<IGraphicBufferProducer>* gbp; status_t result; const String8& name; uint32_t w, h; PixelFormat format; uint32_t flags; sp<Layer>* parent; uint32_t windowType; uint32_t ownerUid; public: MessageCreateLayer(SurfaceFlinger* flinger, const String8& name, Client* client, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, sp<IBinder>* handle, uint32_t windowType, uint32_t ownerUid, sp<IGraphicBufferProducer>* gbp, sp<Layer>* parent) : flinger(flinger), client(client), handle(handle), gbp(gbp), result(NO_ERROR), name(name), w(w), h(h), format(format), flags(flags), parent(parent), windowType(windowType), ownerUid(ownerUid) { } status_t getResult() const { return result; } virtual bool handler() { result = flinger->createLayer(name, client, w, h, format, flags, windowType, ownerUid, handle, gbp, parent); return true; } }; sp<MessageBase> msg = new MessageCreateLayer(mFlinger.get(), name, this, w, h, format, flags, handle, windowType, ownerUid, gbp, &parent); mFlinger->postMessageSync(msg); return static_cast<MessageCreateLayer*>( msg.get() )->getResult(); }