Skip to content

[LeakScope] 20 Android lifecycle/memory violations detected #21

@MuhammadTehamsibAliTashfeen

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 20 potential issue(s) across 2 detector type(s):

Severity Count
🔴 High 19
🟡 Medium 0
🟢 Low (improvement opportunity) 1
Detector Count Severity Description
FragmentViewFieldRetentionLeak 19 🔴 High Fragment stores View references in instance fields not cleared in onDestroyView()
ViewBindingOpportunity 1 🟢 Low Manual findViewById() calls — ViewBinding migration opportunity

Detailed Findings

🔴 FragmentViewFieldRetentionLeak

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

Finding #1HomeFragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.HomeFragment

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

- onDestroyView() is missing

Leaked Fields:
  • status : android.widget.ImageView (assigned in onViewCreated)
  • statusText : android.widget.TextView (assigned in onViewCreated)
  • button : android.widget.Button (assigned in onViewCreated)
  • debugStatus : android.widget.TextView (assigned in onViewCreated)

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();
    status = null;
    statusText = null;
    button = null;
    d
… (truncated for brevity)

Finding #2AboutFragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.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:
  • aboutGithub : android.widget.TextView (assigned in onViewCreated)

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();
    aboutGithub = null;
  }

Finding #3ConnectFragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.ConnectFragment

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

- onDestroyView() is missing

Leaked Fields:
  • status : android.widget.ImageView (assigned in onViewCreated)
  • statusText : android.widget.TextView (assigned in onViewCreated)

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();
    status = null;
    statusText = null;
  }

Finding #4MouseFragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.MouseFragment

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:
  • root : android.widget.RelativeLayout (assigned in onViewCreated)

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();
    root = null;
  }

Finding #5ConnectConnectedSubfragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.ConnectConnectedSubfragment

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

- onDestroyView() is missing

Leaked Fields:
  • elapsed : android.widget.Chronometer (assigned in onViewCreated)
  • name : android.widget.TextView (assigned in onViewCreated)
  • disconnect : android.widget.Button (assigned in onViewCreated)
  • mouse : android.widget.Button (assigned in onViewCreated)

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();
    elapsed = null;
    name = null;
    disconnec
… (truncated for brevity)

Finding #6ConnectFailedSubfragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.ConnectFailedSubfragment

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

- onDestroyView() is missing

Leaked Fields:
  • device : android.widget.TextView (assigned in onViewCreated)
  • back : android.widget.Button (assigned in onViewCreated)
  • remove : android.widget.Button (assigned in onViewCreated)

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();
    device = null;
    back = null;
    remove = null;
  }

Finding #7ConnectSelectSubfragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.ConnectSelectSubfragment

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

- onDestroyView() is missing

Leaked Fields:
  • list : androidx.recyclerview.widget.RecyclerView (assigned in onViewCreated)
  • add : android.widget.Button (assigned in onViewCreated)

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();
    list = null;
    add = null;
  }

Finding #8HomeUnsupportedSubfragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.home.HomeUnsupportedSubfragment

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

- onDestroyView() is missing

Leaked Fields:
  • playstoreLink : android.widget.Button (assigned in onViewCreated)

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();
    playstoreLink = null;
  }

Finding #9HomeDisabledSubfragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.home.HomeDisabledSubfragment

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

- onDestroyView() is missing

Leaked Fields:
  • refresh : android.widget.Button (assigned in onViewCreated)

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();
    refresh = null;
  }

Finding #10HomeConnectedSubfragment

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.home.HomeConnectedSubfragment

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

- onDestroyView() is missing

Leaked Fields:
  • chronometer : android.widget.Chronometer (assigned in onViewCreated)
  • device : android.widget.TextView (assigned in onViewCreated)
  • more : android.widget.Button (assigned in onViewCreated)

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();
    chronometer = null;
    device = null;
    more = null;
  }

Finding #11CalibrationHappeningSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.settings.dialog.CalibrationHappeningSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • time : android.widget.TextView (assigned in onViewCreated)

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();
    time = null;
  }

Finding #12MouseUsageFinishedSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.mouse.MouseUsageFinishedSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • notAgain : android.widget.CheckBox (assigned in onViewCreated)

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();
    notAgain = null;
  }

Finding #13MouseMessageSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.mouse.MouseMessageSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • messageView : android.widget.TextView (assigned in onViewCreated)

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();
    messageView = null;
  }

Finding #14AddSuccessSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.dialog.AddSuccessSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • name : android.widget.TextView (assigned in onViewCreated)

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();
    name = null;
  }

Finding #15AddRequestSettingSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.dialog.AddRequestSettingSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • error : android.widget.TextView (assigned in onViewCreated)

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();
    error = null;
  }

Finding #16AddManualSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.dialog.AddManualSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • nameLayout : com.google.android.material.textfield.TextInputLayout (assigned in onViewCreated)
  • macLayout : com.google.android.material.textfield.TextInputLayout (assigned in onViewCreated)

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();
    nameLayout = null;
    macLayout = null;
  }

Finding #17AddSelectSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.dialog.AddSelectSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • list : androidx.recyclerview.widget.RecyclerView (assigned in onViewCreated)
  • scanning : android.widget.Button (assigned in onViewCreated)

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();
    list = null;
    scanning = null;
  }

Finding #18AddBondedSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.dialog.AddBondedSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • error : android.widget.TextView (assigned in onViewCreated)

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();
    error = null;
  }

Finding #19AddRequestPermissionSubdialog

Fragment View Field Retention Leak Detected
Class: ch.virt.smartphonemouse.ui.connect.dialog.AddRequestPermissionSubdialog

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

- onDestroyView() is missing

Leaked Fields:
  • error : android.widget.TextView (assigned in onViewCreated)

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();
    error = null;
  }

🟢 ViewBindingOpportunity

Manual findViewById() calls — ViewBinding migration opportunity

Finding #20MainActivity

View Binding Migration Opportunity
Class: ch.virt.smartphonemouse.MainActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in loadComponents
  • findViewById in loadComponents
  • findViewById in loadComponents
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 SmartMouse.

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