Skip to content

Storage volume fix#1499

Open
raveniscool27 wants to merge 22 commits into
utkarshdalal:masterfrom
raveniscool27:Storage-Volume-Fix
Open

Storage volume fix#1499
raveniscool27 wants to merge 22 commits into
utkarshdalal:masterfrom
raveniscool27:Storage-Volume-Fix

Conversation

@raveniscool27

@raveniscool27 raveniscool27 commented May 31, 2026

Copy link
Copy Markdown

Description

Add support for using multiple storage drives and more compatibility with devices

Recording

Screenshot_20260404-023547

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by CodeRabbit

  • New Features

    • Broader detection of app-specific external storage locations for better access to removable media.
  • Bug Fixes

    • Improved reliability accessing, saving and cleaning crash logs and debug logs across multiple storage volumes.
    • More accurate, user-friendly labels for removable storage (SD cards/USB) in settings.
    • Better handling of downloads across available external volumes.

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d827c679-a39b-4f02-b87f-eb5da06a3583

📥 Commits

Reviewing files that changed from the base of the PR and between 3a18f33 and 975bd80.

📒 Files selected for processing (2)
  • app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupInterface.kt
  • app/src/main/java/app/gamenative/utils/StorageUtils.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupInterface.kt
  • app/src/main/java/app/gamenative/utils/StorageUtils.kt

📝 Walkthrough

Walkthrough

Adds a resilient StorageUtils.getAllExternalFilesDirs(context) fallback for external app-specific directories and updates CrashHandler, SettingsGroupDebug, DownloadService, and SettingsGroupInterface to consume it for crash logs, wine logs, and external-volume discovery.

Changes

External Storage Directory Discovery Consolidation

Layer / File(s) Summary
StorageUtils external directory discovery utility
app/src/main/java/app/gamenative/utils/StorageUtils.kt
New getAllExternalFilesDirs(context) utility implements two-phase discovery: attempts context.getExternalFilesDirs(null), falls back to StorageManager volume enumeration with reflection-based directory resolution on older SDKs, constructs app-specific Android/data/<package>/files paths, ensures directories exist, logs exceptions via Timber, and returns deduplicated list.
CrashHandler crash log directory
app/src/main/java/app/gamenative/CrashHandler.kt
CrashHandler imports StorageUtils and updates crashFileDir initialization to prefer first result from getAllExternalFilesDirs() with fallback to context.getExternalFilesDir(null), maintaining the crash_logs subdirectory and existing crash-handling behavior.
SettingsGroupDebug log directories
app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupDebug.kt
SettingsGroupDebug imports StorageUtils and updates both crash_logs and wine_logs directory resolution to use getAllExternalFilesDirs(context).firstOrNull() with fallback to getExternalFilesDir(null).
DownloadService external volume discovery
app/src/main/java/app/gamenative/service/DownloadService.kt
DownloadService imports StorageManager directly and refactors populateDownloadService to source all external directories via getAllExternalFilesDirs(), determine primary directory from StorageManager volume info, set baseExternalAppDirPath with cascading fallbacks, and populate externalVolumePaths by filtering mounted non-primary volumes.
SettingsGroupInterface removable media discovery and labels
app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupInterface.kt
SettingsGroupInterface imports StorageUtils and replaces volume discovery logic to collect all external directories via getAllExternalFilesDirs(), filter to removable media using Environment.isExternalStorageRemovable() with an exception fallback, and regenerate labels using StorageVolume descriptions with a directory-name/UUID fallback.

Sequence Diagram(s)

Possibly related PRs

Suggested reviewers

  • utkarshdalal

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

"I tunneled through paths both wide and small,
Found Android/data where app-files call,
One helper to guide each removable road,
Logs and crashes now share my payload,
Hop, hop — unified directories for all!" 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Storage volume fix' is concise and accurately reflects the main objective of the PR to add support for multiple storage drives and improve device compatibility.
Description check ✅ Passed The PR description is complete with all required template sections filled: a clear description of the feature, a recording/screenshot, type of change selected, and all checklist items completed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupInterface.kt`:
- Around line 471-475: The fallback label uses dir.name which is "files" for
every app-specific external directory; change the fallback to derive a more
unique volume name (e.g., the mount folder above the app data) by replacing the
fallback expression in the labels remember block (the dirs.map lambda where
sm?.getStorageVolume(dir)?.getDescription(ctx) ?: "SD Card (${dir.name})") with
something like sm?.getStorageVolume(dir)?.getDescription(ctx) ?: "SD Card
(${dir.parentFile?.parentFile?.name ?: dir.name})" so the code references the
parent folders of dir instead of the constant "files".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58daac64-0e7c-4336-b9e8-4260eb7ff688

📥 Commits

Reviewing files that changed from the base of the PR and between 2bea2aa and f960d20.

📒 Files selected for processing (5)
  • app/src/main/java/app/gamenative/CrashHandler.kt
  • app/src/main/java/app/gamenative/service/DownloadService.kt
  • app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupDebug.kt
  • app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupInterface.kt
  • app/src/main/java/app/gamenative/utils/StorageUtils.kt

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupInterface.kt Outdated
Comment thread app/src/main/java/app/gamenative/utils/StorageUtils.kt Outdated
Comment thread app/src/main/java/app/gamenative/ui/screen/settings/SettingsGroupInterface.kt Outdated
raveniscool27 and others added 3 commits May 31, 2026 18:25
…oupInterface.kt

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant