OSDN Git Service

Fix 3106227: use WeakReferences for receivers in DigitalClock class
authorJim Miller <jaggies@google.com>
Fri, 14 Jan 2011 01:56:35 +0000 (17:56 -0800)
committerJim Miller <jaggies@google.com>
Sat, 15 Jan 2011 02:01:12 +0000 (18:01 -0800)
commit8b886fab5496b0b1f5193f21855220176deddc37
tree38cad39f24e37fa645e148422d3242afefc3a0e2
parent5a40b8ef81034e00f886010c71dccd62b919028b
Fix 3106227: use WeakReferences for receivers in DigitalClock class

This works around a bug in the framework where LockScreen wouldn't
get GC'd under certain circumstances which would lead to an OOM
crash.  It now uses WeakReferences for observers inside the
DigitalClock container class and unregisters them if the containing
DigitalClock goes away.

Also removed mLive variable which was unused and could potentially
leak the receivers.

Left mAttached for debugging so we can use it to determine if the
calls to onAttachToWindow() and onDetachFromWindow() are grossly
unbalanced which may be the root cause of the original problem.

Have cleanUp() explicitly clear unused references to make
tracing through hprof references easier.

Change-Id: I99a7e0c356001b05eab5aa729564553666febfea
core/java/com/android/internal/widget/DigitalClock.java
policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java
policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
policy/src/com/android/internal/policy/impl/LockScreen.java
policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java