Skip to content

[LeakScope] 10 Android lifecycle/memory violations detected #6

Description

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 3 detector type(s):

Severity Count
🔴 High 3
🟡 Medium 0
🟢 Low (improvement opportunity) 7
Detector Count Severity Description
FragmentViewFieldRetentionLeak 1 🔴 High Fragment stores View references in instance fields not cleared in onDestroyView()
ThreadedUIReference 2 🔴 High Worker thread captures Activity/Fragment/View reference
ViewBindingOpportunity 7 🟢 Low Manual findViewById() calls — ViewBinding migration opportunity

Detailed Findings

🔴 FragmentViewFieldRetentionLeak

Fragment stores View references in instance fields not cleared in onDestroyView()

Finding #1 — RoundMenuFragment

Fragment View Field Retention Leak Detected
Class: com.swx.adbremote.fragment.RoundMenuFragment

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • dlRmv : com.dlong.rep.dlroundmenuview.DLRoundMenuView (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();
    dlRmv = null;
  }

🔴 ThreadedUIReference

Worker thread captures Activity/Fragment/View reference

Finding #2 — RoundMenuFragment

Scenario 1: Worker thread holds UI object reference
Class: com.swx.adbremote.fragment.RoundMenuFragment
Method: void handleRoundMenuClick(android.view.View,int,boolean,com.swx.adbremote.utils.ADBConnectUtil$ShellExecCallable)
Statement: $r6 = new com.swx.adbremote.fragment.RoundMenuFragment$$ExternalSyntheticLambda0
Captured UI objects:
  - $r1 : android.view.View
  - r0 : com.swx.adbremote.fragment.RoundMenuFragment
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

Finding #3 — MainActivity

Scenario 1: Worker thread holds UI object reference
Class: com.swx.adbremote.MainActivity
Method: boolean handleLongClick(android.view.View)
Statement: $r4 = new com.swx.adbremote.MainActivity$$ExternalSyntheticLambda5
Captured UI objects:
  - $r1 : android.view.View
  - r0 : com.swx.adbremote.MainActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

🟢 ViewBindingOpportunity

Manual findViewById() calls — ViewBinding migration opportunity

Finding #4 — ConnectInstanceActivity

View Binding Migration Opportunity
Class: com.swx.adbremote.activity.ConnectInstanceActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • 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 #5 — SettingActivity

View Binding Migration Opportunity
Class: com.swx.adbremote.activity.SettingActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • 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 #6 — MainActivity

View Binding Migration Opportunity
Class: com.swx.adbremote.MainActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
Benefits of View Binding:
- Eliminates boilerplate findViewById() calls
- Compile-time type safety for view references
- Reduced null pointer exceptions
- Cleaner, more maintainable cod
… (truncated for brevity)

Finding #7 — SettingBehaviorActivity

View Binding Migration Opportunity
Class: com.swx.adbremote.activity.settings.SettingBehaviorActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in init
  • findViewById in initEvent
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 #8 — SettingLayoutActivity

View Binding Migration Opportunity
Class: com.swx.adbremote.activity.settings.SettingLayoutActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in init
  • findViewById in initEvent
  • 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 — SettingApplicationsActivity

View Binding Migration Opportunity
Class: com.swx.adbremote.activity.settings.SettingApplicationsActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in init
  • findViewById in initEvent
  • findViewById in initEvent
  • findViewById in initEvent
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 — SettingOnlineAppsActivity

View Binding Migration Opportunity
Class: com.swx.adbremote.activity.settings.SettingOnlineAppsActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in init
  • findViewById in init
  • findViewById in initEvent
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 ADBRemoteATV.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions