Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cce6c6b authored by Vishnu Nair's avatar Vishnu Nair Committed by android-build-merger
Browse files

Merge "Clear binder references and flush operations when destroying...

Merge "Clear binder references and flush operations when destroying NativeInputWindowHandle" into qt-qpr1-dev
am: f8c3ac92

Change-Id: Id4a85aaaf3c78fdfbe67438020c0da82fbca0b5f
parents 2d8c6c76 f8c3ac92
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "android_hardware_input_InputWindowHandle.h"
#include "android_hardware_input_InputApplicationHandle.h"
#include "android_util_Binder.h"
#include <binder/IPCThreadState.h>

namespace android {

@@ -78,6 +79,12 @@ NativeInputWindowHandle::NativeInputWindowHandle(jweak objWeak) :
NativeInputWindowHandle::~NativeInputWindowHandle() {
    JNIEnv* env = AndroidRuntime::getJNIEnv();
    env->DeleteWeakGlobalRef(mObjWeak);

    // Clear the weak reference to the layer handle and flush any binder ref count operations so we
    // do not hold on to any binder references.
    // TODO(b/139697085) remove this after it can be flushed automatically
    mInfo.touchableRegionCropHandle.clear();
    IPCThreadState::self()->flushCommands();
}

jobject NativeInputWindowHandle::getInputWindowHandleObjLocalRef(JNIEnv* env) {