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 24 potential issue(s) across 4 detector type(s):
| Severity |
Count |
| 🔴 High |
8 |
| 🟡 Medium |
3 |
| 🟢 Low (improvement opportunity) |
13 |
| Detector |
Count |
Severity |
Description |
StateHolderLeak |
1 |
🔴 High |
Static field holds UI/Context reference across configuration changes |
ThreadedUIReference |
7 |
🔴 High |
Worker thread captures Activity/Fragment/View reference |
ServiceResourceManagementIssueDetector |
3 |
🟡 Medium |
Service may never stop — missing stopSelf() call |
ViewBindingOpportunity |
13 |
🟢 Low |
Manual findViewById() calls — ViewBinding migration opportunity |
Detailed Findings
🔴 StateHolderLeak
Static field holds UI/Context reference across configuration changes
Finding #1 — ToggleWidgetOldActivity
Potential State Holder Memory Leak Detected
Class: dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity
Issue: Scenario 2: Static field 'defaultButton' of type 'android.widget.Button' in Activity/Fragment directly holds a UI reference across rotations. Old UI cannot be garbage collected.
Fix: Use instance field instead. Set to null in onDestroy().
Potential State Holder Memory Leak Detected
Class: dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity
Issue: Scenario 2: Static field 'disableButton' of type 'android.widget.Button' in Activity/Fragment directly holds a UI reference across rotations. Old UI cannot be garbage collected.
Fix: Use instance field instead. Set to null in onDestroy().
Potential State Holder Memory Leak Detected
Class: dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity
Issue: Scenario 2: Static field 'enableButton' of type 'android.widget.Button' in Activity/Fragment directly holds a UI reference across rotations. Old UI cannot be garbage collected.
Fix: Use inst
… (truncated for brevity)
🔴 ThreadedUIReference
Worker thread captures Activity/Fragment/View reference
Finding #2 — ExpPreferenceFragment\n// (Full source code omitted for brevity)\n"
{
"text_input": "package dev.ukanth.ufirewall.preferences;\n\n// Class: dev.ukanth.ufirewall.preferences.ExpPreferenceFragment\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewall.preferences.ExpPreferenceFragment\nMethod: void deleteFiles(android.content.Context,boolean)\nStatement: $r4 \u003d new java.lang.Thread\nCaptured UI objects:\n - r0 : dev.ukanth.ufirewall.preferences.ExpPreferenceFragment\nRisk: UI object will be kept in memory until thread completes\nFix: Use WeakReference or avoid passing UI objects to worker threads\n"
}
{
"text_input": "package dev.ukanth.ufirewall.preferences;\n\n// Class: dev.ukanth.ufirewall.preferences.ExpPreferenceFragment\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewal
… (truncated for brevity)
Finding #3 — RulesActivity
Scenario 1: Worker thread holds UI object reference
Class: dev.ukanth.ufirewall.activity.RulesActivity
Method: void appendSystemInfo(android.content.Context)
Statement: $r7 = new dev.ukanth.ufirewall.activity.RulesActivity$1
Captured UI objects:
- r0 : dev.ukanth.ufirewall.activity.RulesActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads
Finding #4 — LogDetailActivity\n// (Full source code omitted for brevity)\n"
{
"text_input": "package dev.ukanth.ufirewall.activity;\n\n// Class: dev.ukanth.ufirewall.activity.LogDetailActivity\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewall.activity.LogDetailActivity\nMethod: boolean onContextItemSelected(android.view.MenuItem)\nStatement: $r10 \u003d new dev.ukanth.ufirewall.util.LogNetUtil$NetTask\nCaptured UI objects:\n - r0 : dev.ukanth.ufirewall.activity.LogDetailActivity\nRisk: UI object will be kept in memory until thread completes\nFix: Use WeakReference or avoid passing UI objects to worker threads\n"
}
{
"text_input": "package dev.ukanth.ufirewall.activity;\n\n// Class: dev.ukanth.ufirewall.activity.LogDetailActivity\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewall.
… (truncated for brevity)
Finding #5 — LogActivity\n// (Full source code omitted for brevity)\n"
{
"text_input": "package dev.ukanth.ufirewall.activity;\n\n// Class: dev.ukanth.ufirewall.activity.LogActivity\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewall.activity.LogActivity\nMethod: void onCreate(android.os.Bundle)\nStatement: r14 \u003d new dev.ukanth.ufirewall.activity.LogActivity$CollectLog\nCaptured UI objects:\n - r0 : dev.ukanth.ufirewall.activity.LogActivity\nRisk: UI object will be kept in memory until thread completes\nFix: Use WeakReference or avoid passing UI objects to worker threads\n"
}
{
"text_input": "package dev.ukanth.ufirewall.activity;\n\n// Class: dev.ukanth.ufirewall.activity.LogActivity\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewall.activity.LogActivity\nMethod: void on
… (truncated for brevity)
Finding #6 — MainActivity
Scenario 1: Worker thread holds UI object reference
Class: dev.ukanth.ufirewall.MainActivity
Method: void onCreate(android.os.Bundle)
Statement: $r10 = new dev.ukanth.ufirewall.MainActivity$RootCheck
Captured UI objects:
- r0 : dev.ukanth.ufirewall.MainActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads
Finding #7 — ToggleWidgetActivity
Scenario 1: Worker thread holds UI object reference
Class: dev.ukanth.ufirewall.widget.ToggleWidgetActivity
Method: void invokeAction()
Statement: $r2 = new dev.ukanth.ufirewall.widget.ToggleWidgetActivity$2
Captured UI objects:
- r0 : dev.ukanth.ufirewall.widget.ToggleWidgetActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads
Finding #8 — ToggleWidgetOldActivity\n// (Full source code omitted for brevity)\n"
{
"text_input": "package dev.ukanth.ufirewall.widget;\n\n// Class: dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity\nMethod: void runProfile(java.lang.String)\nStatement: $r4 \u003d new dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity$2\nCaptured UI objects:\n - r0 : dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity\nRisk: UI object will be kept in memory until thread completes\nFix: Use WeakReference or avoid passing UI objects to worker threads\n"
}
{
"text_input": "package dev.ukanth.ufirewall.widget;\n\n// Class: dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity\n// (Full source code omitted for brevity)\n",
"output": "Yes",
"project": "ufirewall",
"explanation": "Scenario 1: Worker thread holds UI object reference\nClass: dev.ukanth.ufirewall
… (truncated for brevity)
🟡 ServiceResourceManagementIssueDetector
Service may never stop — missing stopSelf() call
Finding #9 — RootShellService
⚠� Service may never stop. Consider calling stopSelf() when work is complete.
Class: dev.ukanth.ufirewall.service.RootShellService
Method: onStartCommand
Finding #10 — RootShellService2
⚠� Service may never stop. Consider calling stopSelf() when work is complete.
Class: dev.ukanth.ufirewall.service.RootShellService2
Method: onStartCommand
Finding #11 — FirewallService
⚠� Service may never stop. Consider calling stopSelf() when work is complete.
Class: dev.ukanth.ufirewall.service.FirewallService
Method: onStartCommand
⚠� Foreground service started but never removed (missing stopForeground() / stopSelf()).
Class: dev.ukanth.ufirewall.service.FirewallService
Method: N/A
🟢 ViewBindingOpportunity
Manual findViewById() calls — ViewBinding migration opportunity
Finding #12 — PreferencesActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.preferences.PreferencesActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in prepareLayout
• findViewById in prepareLayout
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 #13 — AppDetailActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.AppDetailActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• 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 #14 — LogDetailActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.LogDetailActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
• 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 #15 — HelpActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.HelpActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• 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 #16 — CustomScriptActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.CustomScriptActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• 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 #17 — ProfileActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.ProfileActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreateContextMenu
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 #18 — LogActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.LogActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
• 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 #19 — CustomRulesActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.CustomRulesActivity
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 #20 — DataDumpActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.activity.DataDumpActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in copy
• findViewById in lambda$setData$0
• 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 #21 — MainActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.MainActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in addColumns
• findViewById in clearAll
• findViewById in copyColumns
• findViewById in hideColumns
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in reloadPreferences
• findViewById in search
• findViewById in selectAll3G
• findViewById in selectAllLAN
• findViewById in selectAllRoam
• findViewById in selectAllTor
• findViewById in selectAllVPN
• findViewById in selectAllWifi
• findViewById in selectAlltether
• findViewById in selectFilterGroup
• findViewById in selectRevert
•
… (truncated for brevity)
Finding #22 — ToggleWidgetActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.widget.ToggleWidgetActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• 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 #23 — ToggleWidgetOldActivity
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.widget.ToggleWidgetOldActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• 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 #24 — LocaleEdit
View Binding Migration Opportunity
Class: dev.ukanth.ufirewall.plugin.LocaleEdit
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
• findViewById in finish
• findViewById in finish
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• findViewById in onCreate
• 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 afwall.
LeakScope: Android Lifecycle & Memory Leak Violations
Summary
LeakScope detected 24 potential issue(s) across 4 detector type(s):
StateHolderLeakThreadedUIReferenceServiceResourceManagementIssueDetectorViewBindingOpportunityDetailed Findings
🔴
StateHolderLeakStatic field holds UI/Context reference across configuration changes
Finding #1 —
ToggleWidgetOldActivity🔴
ThreadedUIReferenceWorker thread captures Activity/Fragment/View reference
Finding #2 —
ExpPreferenceFragment\n// (Full source code omitted for brevity)\n"Finding #3 —
RulesActivityFinding #4 —
LogDetailActivity\n// (Full source code omitted for brevity)\n"Finding #5 —
LogActivity\n// (Full source code omitted for brevity)\n"Finding #6 —
MainActivityFinding #7 —
ToggleWidgetActivityFinding #8 —
ToggleWidgetOldActivity\n// (Full source code omitted for brevity)\n"🟡
ServiceResourceManagementIssueDetectorService may never stop — missing stopSelf() call
Finding #9 —
RootShellServiceFinding #10 —
RootShellService2Finding #11 —
FirewallService🟢
ViewBindingOpportunityManual findViewById() calls — ViewBinding migration opportunity
Finding #12 —
PreferencesActivityFinding #13 —
AppDetailActivityFinding #14 —
LogDetailActivityFinding #15 —
HelpActivityFinding #16 —
CustomScriptActivityFinding #17 —
ProfileActivityFinding #18 —
LogActivityFinding #19 —
CustomRulesActivityFinding #20 —
DataDumpActivityFinding #21 —
MainActivityFinding #22 —
ToggleWidgetActivityFinding #23 —
ToggleWidgetOldActivityFinding #24 —
LocaleEditHow 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 afwall.