Loading libs/gui/LayerState.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -509,7 +509,8 @@ status_t CaptureArgs::write(Parcel& output) const { status_t status = output.writeInt32(static_cast<int32_t>(pixelFormat)) ?: output.write(sourceCrop) ?: output.writeFloat(frameScale) ?: output.writeBool(captureSecureLayers); output.writeBool(captureSecureLayers) ?: output.writeInt32(uid); return status; } Loading @@ -518,7 +519,8 @@ status_t CaptureArgs::read(const Parcel& input) { status_t status = input.readInt32(&format) ?: input.read(sourceCrop) ?: input.readFloat(&frameScale) ?: input.readBool(&captureSecureLayers); input.readBool(&captureSecureLayers) ?: input.readInt32(&uid); pixelFormat = static_cast<ui::PixelFormat>(format); return status; Loading libs/gui/include/gui/LayerState.h +2 −0 Original line number Diff line number Diff line Loading @@ -314,12 +314,14 @@ static inline int compare_type(const DisplayState& lhs, const DisplayState& rhs) bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* functionName); struct CaptureArgs { const static int32_t UNSET_UID = -1; virtual ~CaptureArgs() = default; ui::PixelFormat pixelFormat{ui::PixelFormat::RGBA_8888}; Rect sourceCrop; float frameScale{1}; bool captureSecureLayers{false}; int32_t uid{UNSET_UID}; virtual status_t write(Parcel& output) const; virtual status_t read(const Parcel& input); Loading services/surfaceflinger/Layer.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include <gui/LayerDebugInfo.h> #include <gui/Surface.h> #include <math.h> #include <private/android_filesystem_config.h> #include <renderengine/RenderEngine.h> #include <stdint.h> #include <stdlib.h> Loading Loading @@ -139,6 +140,14 @@ Layer::Layer(const LayerCreationArgs& args) mCallingPid = args.callingPid; mCallingUid = args.callingUid; if (mCallingUid == AID_GRAPHICS || mCallingUid == AID_SYSTEM) { // If the system didn't send an ownerUid, use the callingUid for the ownerUid. mOwnerUid = args.metadata.getInt32(METADATA_OWNER_UID, mCallingUid); } else { // A create layer request from a non system request cannot specify the owner uid mOwnerUid = mCallingUid; } } void Layer::onFirstRef() { Loading Loading @@ -1669,8 +1678,8 @@ void Layer::dumpFrameEvents(std::string& result) { } void Layer::dumpCallingUidPid(std::string& result) const { StringAppendF(&result, "Layer %s (%s) pid:%d uid:%d\n", getName().c_str(), getType(), mCallingPid, mCallingUid); StringAppendF(&result, "Layer %s (%s) callingPid:%d callingUid:%d ownerUid:%d\n", getName().c_str(), getType(), mCallingPid, mCallingUid, mOwnerUid); } void Layer::onDisconnect() { Loading Loading @@ -2343,6 +2352,8 @@ void Layer::writeToProtoCommonState(LayerProto* layerInfo, LayerVector::StateSet } layerInfo->set_is_relative_of(state.isRelativeOf); layerInfo->set_owner_uid(mOwnerUid); } if (traceFlags & SurfaceTracing::TRACE_INPUT) { Loading services/surfaceflinger/Layer.h +7 −3 Original line number Diff line number Diff line Loading @@ -436,9 +436,7 @@ public: // Deprecated, please use compositionengine::Output::belongsInOutput() // instead. // TODO(lpique): Move the remaining callers (screencap) to the new function. bool belongsToDisplay(uint32_t layerStack, bool isPrimaryDisplay) const { return getLayerStack() == layerStack && (!mPrimaryDisplayOnly || isPrimaryDisplay); } bool belongsToDisplay(uint32_t layerStack) const { return getLayerStack() == layerStack; } FloatRect getBounds(const Region& activeTransparentRegion) const; FloatRect getBounds() const; Loading Loading @@ -967,6 +965,8 @@ public: */ virtual bool needsInputInfo() const { return hasInputInfo(); } uid_t getOwnerUid() { return mOwnerUid; } protected: compositionengine::OutputLayer* findOutputLayerForDisplay(const DisplayDevice*) const; Loading Loading @@ -1089,6 +1089,10 @@ private: pid_t mCallingPid; uid_t mCallingUid; // The owner of the layer. If created from a non system process, it will be the calling uid. // If created from a system process, the value can be passed in. uid_t mOwnerUid; // The current layer is a clone of mClonedFrom. This means that this layer will update it's // properties based on mClonedFrom. When mClonedFrom latches a new buffer for BufferLayers, // this layer will update it's buffer. When mClonedFrom updates it's drawing state, children, Loading services/surfaceflinger/RegionSamplingThread.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -429,7 +429,7 @@ void RegionSamplingThread::captureSample() { bounds.top, bounds.right, bounds.bottom); visitor(layer); }; mFlinger.traverseLayersInLayerStack(layerStack, filterVisitor); mFlinger.traverseLayersInLayerStack(layerStack, CaptureArgs::UNSET_UID, filterVisitor); }; sp<GraphicBuffer> buffer = nullptr; Loading Loading
libs/gui/LayerState.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -509,7 +509,8 @@ status_t CaptureArgs::write(Parcel& output) const { status_t status = output.writeInt32(static_cast<int32_t>(pixelFormat)) ?: output.write(sourceCrop) ?: output.writeFloat(frameScale) ?: output.writeBool(captureSecureLayers); output.writeBool(captureSecureLayers) ?: output.writeInt32(uid); return status; } Loading @@ -518,7 +519,8 @@ status_t CaptureArgs::read(const Parcel& input) { status_t status = input.readInt32(&format) ?: input.read(sourceCrop) ?: input.readFloat(&frameScale) ?: input.readBool(&captureSecureLayers); input.readBool(&captureSecureLayers) ?: input.readInt32(&uid); pixelFormat = static_cast<ui::PixelFormat>(format); return status; Loading
libs/gui/include/gui/LayerState.h +2 −0 Original line number Diff line number Diff line Loading @@ -314,12 +314,14 @@ static inline int compare_type(const DisplayState& lhs, const DisplayState& rhs) bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* functionName); struct CaptureArgs { const static int32_t UNSET_UID = -1; virtual ~CaptureArgs() = default; ui::PixelFormat pixelFormat{ui::PixelFormat::RGBA_8888}; Rect sourceCrop; float frameScale{1}; bool captureSecureLayers{false}; int32_t uid{UNSET_UID}; virtual status_t write(Parcel& output) const; virtual status_t read(const Parcel& input); Loading
services/surfaceflinger/Layer.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include <gui/LayerDebugInfo.h> #include <gui/Surface.h> #include <math.h> #include <private/android_filesystem_config.h> #include <renderengine/RenderEngine.h> #include <stdint.h> #include <stdlib.h> Loading Loading @@ -139,6 +140,14 @@ Layer::Layer(const LayerCreationArgs& args) mCallingPid = args.callingPid; mCallingUid = args.callingUid; if (mCallingUid == AID_GRAPHICS || mCallingUid == AID_SYSTEM) { // If the system didn't send an ownerUid, use the callingUid for the ownerUid. mOwnerUid = args.metadata.getInt32(METADATA_OWNER_UID, mCallingUid); } else { // A create layer request from a non system request cannot specify the owner uid mOwnerUid = mCallingUid; } } void Layer::onFirstRef() { Loading Loading @@ -1669,8 +1678,8 @@ void Layer::dumpFrameEvents(std::string& result) { } void Layer::dumpCallingUidPid(std::string& result) const { StringAppendF(&result, "Layer %s (%s) pid:%d uid:%d\n", getName().c_str(), getType(), mCallingPid, mCallingUid); StringAppendF(&result, "Layer %s (%s) callingPid:%d callingUid:%d ownerUid:%d\n", getName().c_str(), getType(), mCallingPid, mCallingUid, mOwnerUid); } void Layer::onDisconnect() { Loading Loading @@ -2343,6 +2352,8 @@ void Layer::writeToProtoCommonState(LayerProto* layerInfo, LayerVector::StateSet } layerInfo->set_is_relative_of(state.isRelativeOf); layerInfo->set_owner_uid(mOwnerUid); } if (traceFlags & SurfaceTracing::TRACE_INPUT) { Loading
services/surfaceflinger/Layer.h +7 −3 Original line number Diff line number Diff line Loading @@ -436,9 +436,7 @@ public: // Deprecated, please use compositionengine::Output::belongsInOutput() // instead. // TODO(lpique): Move the remaining callers (screencap) to the new function. bool belongsToDisplay(uint32_t layerStack, bool isPrimaryDisplay) const { return getLayerStack() == layerStack && (!mPrimaryDisplayOnly || isPrimaryDisplay); } bool belongsToDisplay(uint32_t layerStack) const { return getLayerStack() == layerStack; } FloatRect getBounds(const Region& activeTransparentRegion) const; FloatRect getBounds() const; Loading Loading @@ -967,6 +965,8 @@ public: */ virtual bool needsInputInfo() const { return hasInputInfo(); } uid_t getOwnerUid() { return mOwnerUid; } protected: compositionengine::OutputLayer* findOutputLayerForDisplay(const DisplayDevice*) const; Loading Loading @@ -1089,6 +1089,10 @@ private: pid_t mCallingPid; uid_t mCallingUid; // The owner of the layer. If created from a non system process, it will be the calling uid. // If created from a system process, the value can be passed in. uid_t mOwnerUid; // The current layer is a clone of mClonedFrom. This means that this layer will update it's // properties based on mClonedFrom. When mClonedFrom latches a new buffer for BufferLayers, // this layer will update it's buffer. When mClonedFrom updates it's drawing state, children, Loading
services/surfaceflinger/RegionSamplingThread.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -429,7 +429,7 @@ void RegionSamplingThread::captureSample() { bounds.top, bounds.right, bounds.bottom); visitor(layer); }; mFlinger.traverseLayersInLayerStack(layerStack, filterVisitor); mFlinger.traverseLayersInLayerStack(layerStack, CaptureArgs::UNSET_UID, filterVisitor); }; sp<GraphicBuffer> buffer = nullptr; Loading