Skip to content

[LeakScope] 9 Android lifecycle/memory violations detected #23

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

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

Detailed Findings

🔴 FragmentViewFieldRetentionLeak

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

Finding #1fragmentAudioContents

Fragment View Field Retention Leak Detected
Class: com.codeboy.mediafacer_examples.fragments.fragmentAudioContents

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

- onDestroyView() is missing

Leaked Fields:
  • progressBar : android.widget.ProgressBar (assigned in onViewCreated)
  • data_recycler : androidx.recyclerview.widget.RecyclerView (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();
    progressBar = null;
    data_recycler = null;
  }

Finding #2fragment_audio_albums

Fragment View Field Retention Leak Detected
Class: com.codeboy.mediafacer_examples.fragments.fragment_audio_albums

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

- onDestroyView() is missing

Leaked Fields:
  • progressBar : android.widget.ProgressBar (assigned in onViewCreated)
  • data_recycler : androidx.recyclerview.widget.RecyclerView (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();
    progressBar = null;
    data_recycler = null;
  }

Finding #3fragment_audio_artists

Fragment View Field Retention Leak Detected
Class: com.codeboy.mediafacer_examples.fragments.fragment_audio_artists

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

- onDestroyView() is missing

Leaked Fields:
  • progressBar : android.widget.ProgressBar (assigned in onViewCreated)
  • data_recycler : androidx.recyclerview.widget.RecyclerView (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();
    progressBar = null;
    data_recycler = null;
  }

Finding #4fragment_audio_folders

Fragment View Field Retention Leak Detected
Class: com.codeboy.mediafacer_examples.fragments.fragment_audio_folders

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

- onDestroyView() is missing

Leaked Fields:
  • progressBar : android.widget.ProgressBar (assigned in onViewCreated)
  • data_recycler : androidx.recyclerview.widget.RecyclerView (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();
    progressBar = null;
    data_recycler = null;
  }

Finding #5fragment_audioDataDisplay

Fragment View Field Retention Leak Detected
Class: com.codeboy.mediafacer_examples.fragments.fragment_audioDataDisplay

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

- onDestroyView() is missing

Leaked Fields:
  • title : android.widget.TextView (assigned in onViewCreated)
  • data_recycler : androidx.recyclerview.widget.RecyclerView (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();
    title = null;
    data_recycler = null;
  }

🟢 ViewBindingOpportunity

Manual findViewById() calls — ViewBinding migration opportunity

Finding #6videoActivity

View Binding Migration Opportunity
Class: com.codeboy.mediafacer_examples.videoActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in setupFolderSelector
  • 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 #7audioActivity

View Binding Migration Opportunity
Class: com.codeboy.mediafacer_examples.audioActivity
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 #8pictureActivity

View Binding Migration Opportunity
Class: com.codeboy.mediafacer_examples.pictureActivity
Type: Activity
Current Pattern: Manual view lookup
findViewById() Calls:
  • findViewById in setUpFolderSelector
  • 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 #9MainActivity

View Binding Migration Opportunity
Class: com.codeboy.mediafacer_examples.MainActivity
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

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 MediaFacer.

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