Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14727,6 +14727,7 @@ package android.graphics { method public float getTranslationX(); method public float getTranslationY(); method public float getTranslationZ(); method public long getUniqueId(); method public int getWidth(); method public boolean hasDisplayList(); method public boolean hasIdentityMatrix(); core/jni/android_view_RenderNode.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -468,6 +468,10 @@ static jboolean android_view_RenderNode_getAllowForceDark(jlong renderNodePtr) { return reinterpret_cast<RenderNode*>(renderNodePtr)->stagingProperties().getAllowForceDark(); } static jlong android_view_RenderNode_getUniqueId(jlong renderNodePtr) { return reinterpret_cast<RenderNode*>(renderNodePtr)->uniqueId(); } // ---------------------------------------------------------------------------- // RenderProperties - Animations // ---------------------------------------------------------------------------- Loading Loading @@ -694,6 +698,7 @@ static const JNINativeMethod gMethods[] = { { "nGetHeight", "(J)I", (void*) android_view_RenderNode_getHeight }, { "nSetAllowForceDark", "(JZ)Z", (void*) android_view_RenderNode_setAllowForceDark }, { "nGetAllowForceDark", "(J)Z", (void*) android_view_RenderNode_getAllowForceDark }, { "nGetUniqueId", "(J)J", (void*) android_view_RenderNode_getUniqueId }, }; int register_android_view_RenderNode(JNIEnv* env) { Loading graphics/java/android/graphics/RenderNode.java +19 −0 Original line number Diff line number Diff line Loading @@ -1173,6 +1173,22 @@ public final class RenderNode { return nGetAllowForceDark(mNativeRenderNode); } /** * Returns the unique ID that identifies this RenderNode. This ID is unique for the * lifetime of the process. IDs are reset on process death, and are unique only within * the process. * * This ID is intended to be used with debugging tools to associate a particular * RenderNode across different debug dumping & inspection tools. For example * a View layout inspector should include the unique ID for any RenderNodes that it owns * to associate the drawing content with the layout content. * * @return the unique ID for this RenderNode */ public long getUniqueId() { return nGetUniqueId(mNativeRenderNode); } /////////////////////////////////////////////////////////////////////////// // Animations /////////////////////////////////////////////////////////////////////////// Loading Loading @@ -1479,4 +1495,7 @@ public final class RenderNode { @CriticalNative private static native boolean nGetAllowForceDark(long renderNode); @CriticalNative private static native long nGetUniqueId(long renderNode); } libs/hwui/RenderNode.cpp +41 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <SkPathOps.h> #include <algorithm> #include <atomic> #include <sstream> #include <string> Loading @@ -47,8 +48,14 @@ private: TreeInfo* mTreeInfo; }; static int64_t generateId() { static std::atomic<int64_t> sNextId{1}; return sNextId++; } RenderNode::RenderNode() : mDirtyPropertyFields(0) : mUniqueId(generateId()) , mDirtyPropertyFields(0) , mNeedsDisplayListSync(false) , mDisplayList(nullptr) , mStagingDisplayList(nullptr) Loading Loading @@ -444,5 +451,38 @@ const SkPath* RenderNode::getClippedOutline(const SkRect& clipRect) const { return &mClippedOutlineCache.clippedOutline; } using StringBuffer = FatVector<char, 128>; template <typename... T> static void format(StringBuffer& buffer, const std::string_view& format, T... args) { buffer.resize(buffer.capacity()); while (1) { int needed = snprintf(buffer.data(), buffer.size(), format.data(), std::forward<T>(args)...); if (needed < 0) { buffer[0] = '\0'; buffer.resize(1); return; } if (needed < buffer.size()) { buffer.resize(needed + 1); return; } buffer.resize(buffer.size() * 2); } } void RenderNode::markDrawStart(SkCanvas& canvas) { StringBuffer buffer; format(buffer, "RenderNode(id=%d, name='%s')", uniqueId(), getName()); canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr); } void RenderNode::markDrawEnd(SkCanvas& canvas) { StringBuffer buffer; format(buffer, "/RenderNode(id=%d, name='%s')", uniqueId(), getName()); canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr); } } /* namespace uirenderer */ } /* namespace android */ libs/hwui/RenderNode.h +6 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,11 @@ public: UsageHint usageHint() const { return mUsageHint; } int64_t uniqueId() const { return mUniqueId; } void markDrawStart(SkCanvas& canvas); void markDrawEnd(SkCanvas& canvas); private: void computeOrderingImpl(RenderNodeOp* opState, std::vector<RenderNodeOp*>* compositedChildrenOfProjectionSurface, Loading @@ -233,6 +238,7 @@ private: void incParentRefCount() { mParentCount++; } void decParentRefCount(TreeObserver& observer, TreeInfo* info = nullptr); const int64_t mUniqueId; String8 mName; sp<VirtualLightRefBase> mUserContext; Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14727,6 +14727,7 @@ package android.graphics { method public float getTranslationX(); method public float getTranslationY(); method public float getTranslationZ(); method public long getUniqueId(); method public int getWidth(); method public boolean hasDisplayList(); method public boolean hasIdentityMatrix();
core/jni/android_view_RenderNode.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -468,6 +468,10 @@ static jboolean android_view_RenderNode_getAllowForceDark(jlong renderNodePtr) { return reinterpret_cast<RenderNode*>(renderNodePtr)->stagingProperties().getAllowForceDark(); } static jlong android_view_RenderNode_getUniqueId(jlong renderNodePtr) { return reinterpret_cast<RenderNode*>(renderNodePtr)->uniqueId(); } // ---------------------------------------------------------------------------- // RenderProperties - Animations // ---------------------------------------------------------------------------- Loading Loading @@ -694,6 +698,7 @@ static const JNINativeMethod gMethods[] = { { "nGetHeight", "(J)I", (void*) android_view_RenderNode_getHeight }, { "nSetAllowForceDark", "(JZ)Z", (void*) android_view_RenderNode_setAllowForceDark }, { "nGetAllowForceDark", "(J)Z", (void*) android_view_RenderNode_getAllowForceDark }, { "nGetUniqueId", "(J)J", (void*) android_view_RenderNode_getUniqueId }, }; int register_android_view_RenderNode(JNIEnv* env) { Loading
graphics/java/android/graphics/RenderNode.java +19 −0 Original line number Diff line number Diff line Loading @@ -1173,6 +1173,22 @@ public final class RenderNode { return nGetAllowForceDark(mNativeRenderNode); } /** * Returns the unique ID that identifies this RenderNode. This ID is unique for the * lifetime of the process. IDs are reset on process death, and are unique only within * the process. * * This ID is intended to be used with debugging tools to associate a particular * RenderNode across different debug dumping & inspection tools. For example * a View layout inspector should include the unique ID for any RenderNodes that it owns * to associate the drawing content with the layout content. * * @return the unique ID for this RenderNode */ public long getUniqueId() { return nGetUniqueId(mNativeRenderNode); } /////////////////////////////////////////////////////////////////////////// // Animations /////////////////////////////////////////////////////////////////////////// Loading Loading @@ -1479,4 +1495,7 @@ public final class RenderNode { @CriticalNative private static native boolean nGetAllowForceDark(long renderNode); @CriticalNative private static native long nGetUniqueId(long renderNode); }
libs/hwui/RenderNode.cpp +41 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <SkPathOps.h> #include <algorithm> #include <atomic> #include <sstream> #include <string> Loading @@ -47,8 +48,14 @@ private: TreeInfo* mTreeInfo; }; static int64_t generateId() { static std::atomic<int64_t> sNextId{1}; return sNextId++; } RenderNode::RenderNode() : mDirtyPropertyFields(0) : mUniqueId(generateId()) , mDirtyPropertyFields(0) , mNeedsDisplayListSync(false) , mDisplayList(nullptr) , mStagingDisplayList(nullptr) Loading Loading @@ -444,5 +451,38 @@ const SkPath* RenderNode::getClippedOutline(const SkRect& clipRect) const { return &mClippedOutlineCache.clippedOutline; } using StringBuffer = FatVector<char, 128>; template <typename... T> static void format(StringBuffer& buffer, const std::string_view& format, T... args) { buffer.resize(buffer.capacity()); while (1) { int needed = snprintf(buffer.data(), buffer.size(), format.data(), std::forward<T>(args)...); if (needed < 0) { buffer[0] = '\0'; buffer.resize(1); return; } if (needed < buffer.size()) { buffer.resize(needed + 1); return; } buffer.resize(buffer.size() * 2); } } void RenderNode::markDrawStart(SkCanvas& canvas) { StringBuffer buffer; format(buffer, "RenderNode(id=%d, name='%s')", uniqueId(), getName()); canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr); } void RenderNode::markDrawEnd(SkCanvas& canvas) { StringBuffer buffer; format(buffer, "/RenderNode(id=%d, name='%s')", uniqueId(), getName()); canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr); } } /* namespace uirenderer */ } /* namespace android */
libs/hwui/RenderNode.h +6 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,11 @@ public: UsageHint usageHint() const { return mUsageHint; } int64_t uniqueId() const { return mUniqueId; } void markDrawStart(SkCanvas& canvas); void markDrawEnd(SkCanvas& canvas); private: void computeOrderingImpl(RenderNodeOp* opState, std::vector<RenderNodeOp*>* compositedChildrenOfProjectionSurface, Loading @@ -233,6 +238,7 @@ private: void incParentRefCount() { mParentCount++; } void decParentRefCount(TreeObserver& observer, TreeInfo* info = nullptr); const int64_t mUniqueId; String8 mName; sp<VirtualLightRefBase> mUserContext; Loading