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

Device becomes warm while the app is open #31

Open
An-anonymous-coder opened this issue Oct 4, 2024 · 4 comments
Open

Device becomes warm while the app is open #31

An-anonymous-coder opened this issue Oct 4, 2024 · 4 comments

Comments

@An-anonymous-coder
Copy link

Pixel 8 running GrapheneOS (Android 14)

While using the app, the battery begins to heat up more than it should. This is an indication of nonessential loops or unoptimized code.

Check to see if any code is running while the app is idle that is not required.

@VadimBoev
Copy link
Owner

The code is available, it can be viewed and analyzed. I'm closing this, it sounds weird.

@illerokcob
Copy link

No, he was right, I double checked on a rooted Android 11 device the cpu usage with top, and I found the following:

  • When the app is open, cpu usage is around 50-60% on one core:
    Screenshot_20241005-143938_Trebuchet_1
  • When the app is in the background, cpu usage is on maximum on one core, 100%:
    Screenshot_20241005-143919_Trebuchet_1

My test can be replicated easily on a rooted emulator as well with adb.
I'd suggest reviewing the code in main.c and checking for state's activityState alongside destroyRequested because it can detect when the app is backgrounded.

@VadimBoev VadimBoev reopened this Oct 5, 2024
@WSQS
Copy link

WSQS commented Oct 6, 2024

I think we should add a nanosleep in the loop of android_main

@VadimBoev
Copy link
Owner

I think we should add a nanosleep in the loop of android_main

from the point of view of working with threads, this is a good idea, but I can't be sure that this is a good practice for android native

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

No branches or pull requests

4 participants