Plumb owner pid into Layer
For shared timeline visualization, the pid of the process owning the
layer is needed to show the information in the respective process
tracks. This change stores the newly added METADATA_OWNER_PID
information sent as a part of the Layer creation args
Bug: 170911969
Test: pid section of `adb shell dumpsys SurfaceFlinger --frametimeline -<all/jank>`
Change-Id: Ib1cd9b6239501b0b92283dca19d7de3916fff604
diff --git a/services/surfaceflinger/FrameTimeline/FrameTimeline.h b/services/surfaceflinger/FrameTimeline/FrameTimeline.h
index 33821e5..e61567e 100644
--- a/services/surfaceflinger/FrameTimeline/FrameTimeline.h
+++ b/services/surfaceflinger/FrameTimeline/FrameTimeline.h
@@ -107,6 +107,7 @@
virtual nsecs_t getActualQueueTime() const = 0;
virtual PresentState getPresentState() const = 0;
virtual PredictionState getPredictionState() const = 0;
+ virtual pid_t getOwnerPid() const = 0;
virtual void setPresentState(PresentState state) = 0;
@@ -131,7 +132,7 @@
// Sets the PredictionState of SurfaceFrame.
// Debug name is the human-readable debugging string for dumpsys.
virtual std::unique_ptr<SurfaceFrame> createSurfaceFrameForToken(
- uid_t uid, std::string layerName, std::string debugName,
+ pid_t ownerPid, uid_t ownerUid, std::string layerName, std::string debugName,
std::optional<int64_t> token) = 0;
// Adds a new SurfaceFrame to the current DisplayFrame. Frames from multiple layers can be
@@ -190,7 +191,7 @@
class SurfaceFrame : public android::frametimeline::SurfaceFrame {
public:
- SurfaceFrame(uid_t uid, std::string layerName, std::string debugName,
+ SurfaceFrame(pid_t ownerPid, uid_t ownerUid, std::string layerName, std::string debugName,
PredictionState predictionState, TimelineItem&& predictions);
~SurfaceFrame() = default;
@@ -199,6 +200,11 @@
nsecs_t getActualQueueTime() const override;
PresentState getPresentState() const override;
PredictionState getPredictionState() const override { return mPredictionState; };
+ pid_t getOwnerPid() const override { return mOwnerPid; };
+ TimeStats::JankType getJankType() const;
+ nsecs_t getBaseTime() const;
+ uid_t getOwnerUid() const { return mOwnerUid; };
+ const std::string& getName() const { return mLayerName; };
void setActualStartTime(nsecs_t actualStartTime) override;
void setActualQueueTime(nsecs_t actualQueueTime) override;
@@ -206,14 +212,12 @@
void setPresentState(PresentState state) override;
void setActualPresentTime(nsecs_t presentTime);
void setJankInfo(TimeStats::JankType jankType, int32_t jankMetadata);
- TimeStats::JankType getJankType() const;
- nsecs_t getBaseTime() const;
- uid_t getOwnerUid() const;
- const std::string& getName() const;
+
// All the timestamps are dumped relative to the baseTime
void dump(std::string& result, const std::string& indent, nsecs_t baseTime);
private:
+ const pid_t mOwnerPid;
const uid_t mOwnerUid;
const std::string mLayerName;
const std::string mDebugName;
@@ -234,7 +238,7 @@
frametimeline::TokenManager* getTokenManager() override { return &mTokenManager; }
std::unique_ptr<frametimeline::SurfaceFrame> createSurfaceFrameForToken(
- uid_t ownerUid, std::string layerName, std::string debugName,
+ pid_t ownerPid, uid_t ownerUid, std::string layerName, std::string debugName,
std::optional<int64_t> token) override;
void addSurfaceFrame(std::unique_ptr<frametimeline::SurfaceFrame> surfaceFrame,
SurfaceFrame::PresentState state) override;