Skip to content

[LeakScope] 11 Android lifecycle/memory violations detected #3188

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

Severity Count
🔴 High 11
🟡 Medium 0
🟢 Low (improvement opportunity) 0
Detector Count Severity Description
FragmentViewFieldRetentionLeak 3 🔴 High Fragment stores View references in instance fields not cleared in onDestroyView()
StateHolderLeak 1 🔴 High Static field holds UI/Context reference across configuration changes
ThreadedUIReference 7 🔴 High Worker thread captures Activity/Fragment/View reference

Detailed Findings

🔴 FragmentViewFieldRetentionLeak

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

Finding #1NotePreviewFragment

Fragment View Field Retention Leak Detected
Class: it.niedermann.owncloud.notes.edit.NotePreviewFragment

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

- onDestroyView() is missing

Leaked Fields:
  • binding : it.niedermann.owncloud.notes.databinding.FragmentNotePreviewBinding (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();
    binding = null;
  }

Finding #2NoteEditFragment

Fragment View Field Retention Leak Detected
Class: it.niedermann.owncloud.notes.edit.NoteEditFragment

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

- onDestroyView() is missing

Leaked Fields:
  • binding : it.niedermann.owncloud.notes.databinding.FragmentNoteEditBinding (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();
    binding = null;
  }

Finding #3AboutFragmentLicenseTab

Fragment View Field Retention Leak Detected
Class: it.niedermann.owncloud.notes.about.AboutFragmentLicenseTab

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

- onDestroyView() is missing

Leaked Fields:
  • binding : it.niedermann.owncloud.notes.databinding.FragmentAboutLicenseTabBinding (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();
    binding = null;
  }

🔴 StateHolderLeak

Static field holds UI/Context reference across configuration changes

Finding #4BrandingUtil

Potential State Holder Memory Leak Detected
Class: it.niedermann.owncloud.notes.branding.BrandingUtil
Issue: Scenario 1: Long-lived class field 'dialog' of type 'com.nextcloud.android.common.ui.theme.utils.DialogViewThemeUtils' holds UI reference. Prevents UI garbage collection.
Fix: Avoid storing UI in long-lived components. Use WeakReference.

🔴 ThreadedUIReference

Worker thread captures Activity/Fragment/View reference

Finding #5ManageAccountsActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.manageaccounts.ManageAccountsActivity
Method: void lambda$changeAccountSetting$6(it.niedermann.owncloud.notes.databinding.DialogEditSettingBinding,it.niedermann.owncloud.notes.persistence.NotesRepository,it.niedermann.owncloud.notes.persistence.entity.Account,java.util.function.Function,int,java.util.function.Function,android.content.DialogInterface,int)
Statement: $r7 = new it.niedermann.owncloud.notes.manageaccounts.ManageAccountsActivity$$ExternalSyntheticLambda3
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.manageaccounts.ManageAccountsActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

Finding #6NotePreviewFragment\n// (Full source code omitted for brevity)\n"

{
  "text_input": "package it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.NotePreviewFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: it.niedermann.owncloud.notes.edit.NotePreviewFragment\nMethod: void lambda$onRefresh$6()\nStatement: $r4 \u003d new it.niedermann.owncloud.notes.edit.NotePreviewFragment$$ExternalSyntheticLambda4\nCaptured UI objects:\n  - r0 : it.niedermann.owncloud.notes.edit.NotePreviewFragment\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 it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.NotePreviewFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object re
… (truncated for brevity)

Finding #7BaseNoteFragment\n// (Full source code omitted for brevity)\n"

{
  "text_input": "package it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.BaseNoteFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: it.niedermann.owncloud.notes.edit.BaseNoteFragment\nMethod: boolean onOptionsItemSelected(android.view.MenuItem)\nStatement: $r22 \u003d new it.niedermann.owncloud.notes.edit.BaseNoteFragment$$ExternalSyntheticLambda4\nCaptured UI objects:\n  - r0 : it.niedermann.owncloud.notes.edit.BaseNoteFragment\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 it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.BaseNoteFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds
… (truncated for brevity)

Finding #8MainActivity\n// (Full source code omitted for brevity)\n"

{
  "text_input": "package it.niedermann.owncloud.notes.main;\n\n// Class: it.niedermann.owncloud.notes.main.MainActivity\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: it.niedermann.owncloud.notes.main.MainActivity\nMethod: void lambda$onActivityResult$38(com.nextcloud.android.sso.model.SingleSignOnAccount)\nStatement: $r2 \u003d new it.niedermann.owncloud.notes.main.MainActivity$$ExternalSyntheticLambda17\nCaptured UI objects:\n  - r0 : it.niedermann.owncloud.notes.main.MainActivity\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 it.niedermann.owncloud.notes.main;\n\n// Class: it.niedermann.owncloud.notes.main.MainActivity\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker 
… (truncated for brevity)

Finding #9NoteListWidgetConfigurationActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.widget.notelist.NoteListWidgetConfigurationActivity
Method: void onCreate(android.os.Bundle)
Statement: $r16 = new it.niedermann.owncloud.notes.widget.notelist.NoteListWidgetConfigurationActivity$$ExternalSyntheticLambda1
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.widget.notelist.NoteListWidgetConfigurationActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

Finding #10SingleNoteWidgetConfigurationActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.widget.singlenote.SingleNoteWidgetConfigurationActivity
Method: void onNoteClick(int,android.view.View)
Statement: $r2 = new it.niedermann.owncloud.notes.widget.singlenote.SingleNoteWidgetConfigurationActivity$$ExternalSyntheticLambda1
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.widget.singlenote.SingleNoteWidgetConfigurationActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

Finding #11ImportAccountActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.importaccount.ImportAccountActivity
Method: void lambda$onActivityResult$6(com.nextcloud.android.sso.model.SingleSignOnAccount)
Statement: $r8 = new it.niedermann.owncloud.notes.importaccount.ImportAccountActivity$$ExternalSyntheticLambda5
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.importaccount.ImportAccountActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

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 notes-android.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions