Merge "Add ScopedLocalFrame in functions that hold Java objects" into tm-dev
This commit is contained in:
commit
fc5865f69f
@ -22,6 +22,7 @@
|
|||||||
#include <gui/DisplayInfo.h>
|
#include <gui/DisplayInfo.h>
|
||||||
#include <gui/SurfaceComposerClient.h>
|
#include <gui/SurfaceComposerClient.h>
|
||||||
#include <nativehelper/JNIHelp.h>
|
#include <nativehelper/JNIHelp.h>
|
||||||
|
#include <nativehelper/ScopedLocalFrame.h>
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
|
|
||||||
#include "android_hardware_input_InputWindowHandle.h"
|
#include "android_hardware_input_InputWindowHandle.h"
|
||||||
@ -95,6 +96,7 @@ struct WindowInfosListener : public gui::WindowInfosListener {
|
|||||||
JNIEnv* env = AndroidRuntime::getJNIEnv();
|
JNIEnv* env = AndroidRuntime::getJNIEnv();
|
||||||
LOG_ALWAYS_FATAL_IF(env == nullptr, "Unable to retrieve JNIEnv in onWindowInfoChanged.");
|
LOG_ALWAYS_FATAL_IF(env == nullptr, "Unable to retrieve JNIEnv in onWindowInfoChanged.");
|
||||||
|
|
||||||
|
ScopedLocalFrame localFrame(env);
|
||||||
jobject listener = env->NewGlobalRef(mListener);
|
jobject listener = env->NewGlobalRef(mListener);
|
||||||
if (listener == nullptr) {
|
if (listener == nullptr) {
|
||||||
// Weak reference went out of scope
|
// Weak reference went out of scope
|
||||||
|
Loading…
x
Reference in New Issue
Block a user