Fix the potential memory leak issue caused by setExtension.
The combination of setExtension and Java references may lead to circular references that cannot be released by the GC, due to the strong pointer in the C++ layer associated with setExtension.
The solution is to place the setExtension reference at the Java layer, and the native code should retrieve it from the Java object when needed.
Bug: https://partnerissuetracker.corp.google.com/issues/390062396
Change-Id: I23c932355878a5c75c89e50b3bb102b0f6c305da
Test: presubmit
2 files changed