Fix leaks due to GC circular references.
The DisplayEventReceiver and SensorManager event queue both get
leaked when the Looper thread they are attached to dies because
the Java object holds a strong reference to its native peer and
meanwhile the native peer holds a strong reference to the Java
object through JNI.
Fixed the issue by indirecting through a weak reference as was
done for InputEventReceiver some time ago.
Bug: 12455729
Change-Id: I3d80a2a190192d1a2981bf5ae0cad30f0f7688a5
4 files changed