Fix the context leak in the ContentCapture
Activity cannot be released because the context be holded by multiple objects. * Activity holds ContentCaptureManager. * ContentCaptureManager holds the context and MainContextCaptureSession. * MainContextCaptureSession holds the context and ContentCaptureManager. * The system server holds some binder references to MainContentCaptureSession. If the system service never released the binder references, then the activity is also never GC'd. To avoid the issue, 1. Make the session state receiver of MainContextCaptureSession to be static and uses weak reference to MainContextCaptureSession. 2. The direct service vulture may miss to do unlinkToDeath(), do a checking while the session destory. Bug: 143210612 Test: manual check Objects on the meminfo Test: Activities should be released after a period of time Test: adb shell dumpsys meminfo com.google.android.dialer Change-Id: I12037483addb1efe444c74fa189ef6afd15821dd
Loading
Please register or sign in to comment