Skip to content
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

Prevent Android Cached App Freezer from freezing the replay server #3504

Open
wants to merge 1 commit into
base: v1.x
Choose a base branch
from

Conversation

thisisjimmyfb
Copy link
Contributor

@thisisjimmyfb thisisjimmyfb commented Dec 14, 2024

Since Android assigns a low oom_score_adj to foreground services, which prevent cached app freezer from freezing the replay server. Therefore adding a dummy service to RenderDoc will prevent cached app freezer from freezing the replay server.

Cached app freezer stops execution for cached processes and reduces resource usage by misbehaving apps that might attempt to operate while cached. This can happen for the RenderDoc replay server when user simply stopped using RenderDoc for a short period of time because the RenderDoc replay server only produces user perceptible changes when actions are taken on the RenderDoc client.

@baldurk
Copy link
Owner

baldurk commented Dec 16, 2024

I'm not quite sure of the purpose of this PR. You've explained the implementation detail but not why this is necessary or what is causing the disconnections. Android has developer features to prevent the screen from going off or from sleeping while applications are running, so this hasn't been a widespread problem. Can you explain exactly what the problem is that you're solving here beyond just 'prevents disconnections'?

Android is an extremely unstable and unreliable platform where almost nothing works as expected - so any Android-specific changes must be required or well justified to outweigh any risk of breaking or causing unexpected crashes/problems if they use features which are unavailable, changed, or broken on some devices.

@thisisjimmyfb
Copy link
Contributor Author

Cached app freezer stops execution for cached processes and reduces resource usage by misbehaving apps that might attempt to operate while cached. This can happen for the RenderDoc replay server when user simply stopped using RenderDoc for a short period of time because the RenderDoc replay server only produces user perceptible changes when actions are taken on the RenderDoc client.

The WakeLock is a more speculative fix for an issue where the adb command process hangs, which I presume is due to cpu suspend (and the issue has stopped happening ever since the wake lock is introduced in our fork). I can leave that out if you are not comfortable with speculative fixes.

@cmannett85-arm
Copy link
Collaborator

The freezer is disabled when the flag use_freezer is set to false or the developer option is disabled.

You can just turn it off in the developer options.

The WakeLock is a more speculative fix for an issue where the adb command process hangs, which I presume is due to cpu suspend

When does this occur? Once the server is running the UI will ping it repeatedly which should keep it alive.

@thisisjimmyfb
Copy link
Contributor Author

thisisjimmyfb commented Dec 18, 2024

Each Android implementation can choose to expose or not expose certain set of developer options so users might not always have the option to disable it. In the case of Cached App Freezer, it can really help free up system resources so disabling it can actually impede RenderDoc's execution.

The adb command process hang happened while the RenderDoc server was running and connected to the client running on my PC. If network activity was supposed to prevents cpu suspend I will remove the Wake Lock from this PR.

@thisisjimmyfb thisisjimmyfb force-pushed the v1.x branch 2 times, most recently from ae89ba1 to d83699d Compare December 18, 2024 20:07
@thisisjimmyfb thisisjimmyfb changed the title Prevent Android cpu suspend and cached app freezer Prevent Android Cached App Freezer from freezing the replay server Dec 18, 2024
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.

3 participants