Dialer: fix memory leak in DialpadFragment
By MAT tool, we find there exists several PopupMenu objects after repeating operation "dial 10086 -> hangup" several times. It's not right, there should exist only one object of PopupMenu for DialpadFragment. This PopupMenu object occupies 40 byte but indeed causes memory leak. The root cause is that we will call onResume() after hangup every time, onResume will new PopupMenu every time and set its mDragListener to overflow image button's mOnAttachStateChangeListeners, this listener references PopupMenu object and causes PopupMenu can not be released by GC. We create PopupMenu in onCreate instead of onResume to avoid this leak. Change-Id: Id787bc5e23f9d5f86a9fa03536e9ae901e12cb13
Loading
Please register or sign in to comment