-
-
Notifications
You must be signed in to change notification settings - Fork 357
Fix List layout crash with external storage #1758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Meloon33
wants to merge
8
commits into
utkarshdalal:master
Choose a base branch
from
Meloon33:fix/list-layout-external-storage-crash
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
893d34b
Fix List layout crash with external storage
b343e84
Refactor ContainerManager to singleton pattern to improve performance…
0ea500d
Implement asynchronous icon loading and fix list layout divider overlap
d4f00e5
Improve documentation coverage for PR review
920b07d
Update .artifacts/9266bc76-2492-4ea3-87e8-b690e9961ac9/implementation…
Meloon33 4a3738d
Update artifacts for list layout fix
b0491fb
Finalize and polish PR #1758: Fix List Layout External Storage Crash
56de92b
Fix List layout crash with external storage and documentation polish
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
.artifacts/9266bc76-2492-4ea3-87e8-b690e9961ac9/implementation_plan.artifact.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Implementation Plan - Fix Crashes, ANRs, and UI Stability in Library List View | ||
|
|
||
| This plan aims to implement the changes and feedback from [PR #1758](https://github.com/utkarshdalal/GameNative/pull/1758) to resolve critical application crashes and ANRs, especially when games are stored on external storage. | ||
|
|
||
| ## User Review Required | ||
|
|
||
| > [!IMPORTANT] | ||
| > The `ContainerManager` will be converted to a strict singleton. This involves making its constructor private and updating all instantiation sites to use `getInstance(Context)`. | ||
|
|
||
| ## Proposed Changes | ||
|
|
||
| ### Core Infrastructure | ||
|
|
||
| #### [MODIFY] [ContainerManager.java](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/com/winlator/container/ContainerManager.java) | ||
| - Make the constructor `private`. | ||
| - Make `getInstance(Context)` thread-safe using a synchronized block. | ||
|
|
||
| #### [MODIFY] [AdrenotoolsManager.java](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/com/winlator/contents/AdrenotoolsManager.java) | ||
| - Replace `new ContainerManager(context)` with `ContainerManager.getInstance(context)`. | ||
|
|
||
| #### [MODIFY] [ImageFsInstaller.java](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java) | ||
| - Replace `new ContainerManager(context)` with `ContainerManager.getInstance(context)`. | ||
|
|
||
| #### [MODIFY] [PluviaMain.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/PluviaMain.kt) | ||
| - Replace `ContainerManager(context)` with `ContainerManager.getInstance(context)`. | ||
|
|
||
| #### [MODIFY] [XServerScreen.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt) | ||
| - Replace `ContainerManager(context)` with `ContainerManager.getInstance(context)`. | ||
|
|
||
| #### [MODIFY] [ContainerUtils.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/utils/ContainerUtils.kt) | ||
| - Replace all `ContainerManager(context)` calls with `ContainerManager.getInstance(context)`. | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| --- | ||
|
|
||
| ### Library UI Components | ||
|
|
||
| #### [MODIFY] [LibraryListCard.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/screen/library/components/LibraryListCard.kt) | ||
| - Add `imageRefreshCounter: Long` parameter to `ListViewCard`. | ||
| - Add `imageRefreshCounter` to the `produceState` keys for icon loading. This ensures icons are re-fetched if the refresh counter changes (e.g., when external storage becomes ready). | ||
|
|
||
| #### [MODIFY] [LibraryAppItem.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/screen/library/components/LibraryAppItem.kt) | ||
| - Pass the `imageRefreshCounter` from `AppItem` to `ListViewCard`. | ||
|
|
||
| #### [MODIFY] [LibraryListPane.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/screen/library/components/LibraryListPane.kt) | ||
| - Move the `HorizontalDivider` logic out of the animated `Box` and `Column` to prevent it from being part of the item cell's animated alpha and touch area. | ||
| - Position the divider above the item's animated `Box`. | ||
|
|
||
| --- | ||
|
|
||
| ### Verification Plan | ||
|
|
||
| ### Automated Tests | ||
| - Run a build to ensure all `ContainerManager` references are correctly updated and the private constructor doesn't break anything. | ||
| - `gradlew :app:assembleDebug` | ||
|
|
||
| ### Manual Verification | ||
| - Verify that the Library screen loads correctly. | ||
| - Verify that switching between List and Grid layouts works as expected. | ||
| - Verify that icons load correctly in List view. | ||
10 changes: 10 additions & 0 deletions
10
.artifacts/9266bc76-2492-4ea3-87e8-b690e9961ac9/task.artifact.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| - `[/]` Step 1: Core Infrastructure (`ContainerManager` Singleton) | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
|
||
| - `[ ]` Modify `ContainerManager.java` (private constructor, synchronized `getInstance`) | ||
| - `[ ]` Update `AdrenotoolsManager.java` | ||
| - `[ ]` Update `ImageFsInstaller.java` | ||
| - `[ ]` Update `PluviaMain.kt` | ||
| - `[ ]` Update `XServerScreen.kt` | ||
| - `[ ]` Update `ContainerUtils.kt` | ||
| - `[ ]` Update `EpicAppScreen.kt` (clean up import if needed) | ||
| - `[ ]` Step 2: Asynchronous Icon loading in `LibraryListCard` | ||
| - `[ ]` Step 3: UI Layout Fix in `LibraryListPane` | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
29 changes: 29 additions & 0 deletions
29
.artifacts/9266bc76-2492-4ea3-87e8-b690e9961ac9/walkthrough.artifact.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Walkthrough - Core Infrastructure (Step 1) | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| I have completed the refactoring of `ContainerManager` to a singleton pattern. This ensures that only one instance of the manager exists, preventing redundant disk scans of the internal home directory and improving thread safety across the application. | ||
|
|
||
| ## Changes Made | ||
|
|
||
| ### Core Infrastructure | ||
|
|
||
| #### [ContainerManager.java](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/com/winlator/container/ContainerManager.java) | ||
| - Converted `ContainerManager` to a strict singleton. | ||
| - Made the constructor `private`. | ||
| - Added a synchronized `getInstance(Context)` method to ensure thread safety during initialization. | ||
|
|
||
| ### Singleton Migration | ||
| Updated the following classes to use `ContainerManager.getInstance(context)` instead of creating new instances: | ||
| - [AdrenotoolsManager.java](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/com/winlator/contents/AdrenotoolsManager.java) | ||
| - [ImageFsInstaller.java](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java) | ||
| - [PluviaMain.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/PluviaMain.kt) | ||
| - [XServerScreen.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt) | ||
| - [ContainerUtils.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/utils/ContainerUtils.kt) | ||
| - [EpicAppScreen.kt](file:///E:/workspace/StudioProjects/GameNative/app/src/main/java/app/gamenative/ui/screen/library/appscreen/EpicAppScreen.kt) (removed redundant import) | ||
|
|
||
| ## Verification Results | ||
|
|
||
| ### Automated Tests | ||
| - Verified that all compilation errors related to the `private` constructor were resolved by updating all instantiation sites. | ||
|
|
||
| > [!NOTE] | ||
| > I have committed these changes locally to the branch `fix/list-layout-external-storage-crash`. However, I do not have permissions to push directly to the remote repository `utkarshdalal/GameNative`. Please push the changes to GitHub to make them available for review in the PR. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.