Skip to content

Fallback to default app storage on Android when custom storage lacks permissions#22

Open
GooGuJiang wants to merge 1 commit intov2from
codex/fix-crash-on-startup-for-osulazer
Open

Fallback to default app storage on Android when custom storage lacks permissions#22
GooGuJiang wants to merge 1 commit intov2from
codex/fix-crash-on-startup-for-osulazer

Conversation

@GooGuJiang
Copy link
Copy Markdown
Collaborator

Motivation

  • Realm startup could fail on Android when using a custom storage path due to permission or read-only filesystem errors, causing unnecessary corrupt backups or startup failure.
  • Provide a safer recovery path by falling back to the default app storage when permission failures are detected for custom storage on Android.

Description

  • Added a using alias RuntimeInfo = osu.Framework.RuntimeInfo and a new fallback flow in the realm startup catch block which attempts tryFallbackToDefaultStorage before performing other recovery logic and backups.
  • Implemented tryFallbackToDefaultStorage(Exception) to detect Android runtime, confirm usage of IO.OsuStorage with a custom path, inspect the root exception message for permission-related failures, log the event, reset the custom storage path, and return true to retry opening the realm.
  • Added helper isStoragePermissionFailure(string) to centralize detection of permission/read-only errors in exception messages.

Testing

  • Ran the repository unit test suite with dotnet test and observed no regressions in automated tests.
  • Executed an Android startup integration check that simulates storage permission failures to verify the fallback path logs the event and retries with the default storage, which succeeded.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant