LeakScope: Android Lifecycle & Memory Leak Violations
About this report: This issue was automatically generated by LeakScope, a static analysis tool for Android lifecycle violations and memory leaks built on the Soot framework. This is part of an ongoing academic research study targeting ICSE 2027. No immediate action is required — we would greatly appreciate your feedback on whether these findings are accurate.
Summary
LeakScope detected 10 potential issue(s) across 4 detector type(s):
| Severity |
Count |
| 🔴 High |
6 |
| 🟡 Medium |
1 |
| 🟢 Low (improvement opportunity) |
3 |
| Detector |
Count |
Severity |
Description |
FragmentViewFieldRetentionLeak |
4 |
🔴 High |
Fragment stores View references in instance fields not cleared in onDestroyView() |
ThreadedUIReference |
2 |
🔴 High |
Worker thread captures Activity/Fragment/View reference |
ServiceResourceManagementIssueDetector |
1 |
🟡 Medium |
Service may never stop — missing stopSelf() call |
ViewBindingOpportunity |
3 |
🟢 Low |
Manual findViewById() calls — ViewBinding migration opportunity |
Detailed Findings
🔴 FragmentViewFieldRetentionLeak
Fragment stores View references in instance fields not cleared in onDestroyView()
Finding #1 — AboutFragment
Fragment View Field Retention Leak Detected
Class: com.fadcam.ui.AboutFragment
Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed
- onDestroyView() is missing
Leaked Fields:
• view : android.view.View (assigned in onCreateView)
Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions
Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
@Override
public void onDestroyView() {
super.onDestroyView();
view = null;
}
Finding #2 — RecordsFragment
Fragment View Field Retention Leak Detected
Class: com.fadcam.ui.RecordsFragment
Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed
- onDestroyView() is missing
Leaked Fields:
• recyclerView : androidx.recyclerview.widget.RecyclerView (assigned in onCreateView)
• fabToggleView : com.google.android.material.floatingactionbutton.FloatingActionButton (assigned in onCreateView)
• fabDeleteSelected : com.google.android.material.floatingactionbutton.FloatingActionButton (assigned in onCreateView)
Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions
Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
@Override
public void onDestroyView() {
super.onDestroyView();
recyclerView = n
… (truncated for brevity)
Finding #3 — HomeFragment
Fragment View Field Retention Leak Detected
Class: com.fadcam.ui.HomeFragment
Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed
- onDestroyView() does not clear all View fields
Leaked Fields:
• tvStorageInfo : android.widget.TextView (assigned in onViewCreated)
• tvPreviewPlaceholder : android.widget.TextView (assigned in onViewCreated)
• buttonStartStop : com.google.android.material.button.MaterialButton (assigned in onViewCreated)
• buttonPauseResume : com.google.android.material.button.MaterialButton (assigned in onViewCreated)
• buttonCamSwitch : android.widget.Button (assigned in onViewCreated)
• tvTip : android.widget.TextView (assigned in onViewCreated)
• tvStats : android.widget.TextView (assigned in onViewCreated)
• cardClock : androidx.cardview.widget.CardView (assigned in onViewCreated)
• tvClock : android.widget.TextView (assigned in onViewCreated)
• tvDateEnglish
… (truncated for brevity)
Finding #4 — SettingsFragment
Fragment View Field Retention Leak Detected
Class: com.fadcam.ui.SettingsFragment
Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed
- onDestroyView() is missing
Leaked Fields:
• view : android.view.View (assigned in onCreateView)
• cameraSelectionToggle : com.google.android.material.button.MaterialButtonToggleGroup (assigned in onCreateView)
• resolutionSpinner : android.widget.Spinner (assigned in onCreateView)
• frameRateSpinner : android.widget.Spinner (assigned in onCreateView)
• codecSpinner : android.widget.Spinner (assigned in onCreateView)
• watermarkSpinner : android.widget.Spinner (assigned in onCreateView)
Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions
Recommended Fix:
Override
… (truncated for brevity)
🔴 ThreadedUIReference
Worker thread captures Activity/Fragment/View reference
Finding #5 — AboutFragment
Scenario 1: Worker thread holds UI object reference
Class: com.fadcam.ui.AboutFragment
Method: void checkForUpdates()
Statement: $r1 = new com.fadcam.ui.AboutFragment$$ExternalSyntheticLambda0
Captured UI objects:
- r0 : com.fadcam.ui.AboutFragment
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads
Finding #6 — RecordsFragment
Scenario 1: Worker thread holds UI object reference
Class: com.fadcam.ui.RecordsFragment
Method: void loadRecordsList()
Statement: $r2 = new com.fadcam.ui.RecordsFragment$$ExternalSyntheticLambda3
Captured UI objects:
- r0 : com.fadcam.ui.RecordsFragment
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads
🟡 ServiceResourceManagementIssueDetector
Service may never stop — missing stopSelf() call
Finding #7 — TorchService
⚠� Service may never stop. Consider calling stopSelf() when work is complete.
Class: com.fadcam.services.TorchService
Method: onStartCommand
🟢 ViewBindingOpportunity
Manual findViewById() calls — ViewBinding migration opportunity
Finding #8 — VideoPlayerActivity
View Binding Migration Opportunity
Class: com.fadcam.ui.VideoPlayerActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
Benefits of View Binding:
- Eliminates boilerplate findViewById() calls
- Compile-time type safety for view references
- Reduced null pointer exceptions
- Cleaner, more maintainable code
Note: This is a code modernization suggestion, not a memory leak
Finding #9 — WebViewActivity
View Binding Migration Opportunity
Class: com.fadcam.ui.WebViewActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onBackPressed
• findViewById in onCreate
• findViewById in onCreate
Benefits of View Binding:
- Eliminates boilerplate findViewById() calls
- Compile-time type safety for view references
- Reduced null pointer exceptions
- Cleaner, more maintainable code
Note: This is a code modernization suggestion, not a memory leak
Finding #10 — MainActivity
View Binding Migration Opportunity
Class: com.fadcam.MainActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
Benefits of View Binding:
- Eliminates boilerplate findViewById() calls
- Compile-time type safety for view references
- Reduced null pointer exceptions
- Cleaner, more maintainable code
Note: This is a code modernization suggestion, not a memory leak
How to respond to this issue:
- If a finding is a true positive: consider applying the recommended fix and closing this issue.
- If a finding is a false positive: please leave a comment explaining why — your feedback directly improves our research.
- If you have questions: reply here or open a discussion.
This report was generated by LeakScope as part of the ICSE 2027 research artifact. Tool analyzes compiled APKs using Soot static analysis on FadCam.
LeakScope: Android Lifecycle & Memory Leak Violations
Summary
LeakScope detected 10 potential issue(s) across 4 detector type(s):
FragmentViewFieldRetentionLeakThreadedUIReferenceServiceResourceManagementIssueDetectorViewBindingOpportunityDetailed Findings
🔴
FragmentViewFieldRetentionLeakFragment stores View references in instance fields not cleared in onDestroyView()
Finding #1 —
AboutFragmentFinding #2 —
RecordsFragmentFinding #3 —
HomeFragmentFinding #4 —
SettingsFragment🔴
ThreadedUIReferenceWorker thread captures Activity/Fragment/View reference
Finding #5 —
AboutFragmentFinding #6 —
RecordsFragment🟡
ServiceResourceManagementIssueDetectorService may never stop — missing stopSelf() call
Finding #7 —
TorchService🟢
ViewBindingOpportunityManual findViewById() calls — ViewBinding migration opportunity
Finding #8 —
VideoPlayerActivityFinding #9 —
WebViewActivityFinding #10 —
MainActivityHow to respond to this issue:
This report was generated by LeakScope as part of the ICSE 2027 research artifact. Tool analyzes compiled APKs using Soot static analysis on FadCam.