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

Add SettingsRepo, refactoring & setting for battery limit #28

Merged
merged 34 commits into from
May 15, 2024

Conversation

miguelguzmanr
Copy link
Collaborator

Things to note:

  • Still testing these changes. My sincerest apologies if anything broke.
  • Could not decide on a name or correct folder for the SettingsRepo class. Please change.
  • Could not decide on a proper name for functions that use "cat"/"echo" commands in the ShellExecutor class to read and write settings. Not sure if they're even useful at all, either, at least currently not very much. Please change.

- Apply consistent indentation
- Use android constants for color values instead of hex values
Attempt to use generic icon names to promote re-usable icons
Use consistent capitalization and punctuation.
- Add a class for system settings.
- Attempt consistency in function & variable names.
Add SettingsRepo, refactoring & setting for battery limit
Copy link
Owner

@langerhans langerhans left a comment

Choose a reason for hiding this comment

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

For the name I think it's fine as it is. I'm bad at naming things so I don't worry so much about it. As for the package maybe we can move SettingsRepo and ShellExecutor to a new package "system" since they are responsible for communicating with the system. Keep DeviceUtils in tools and BootReceiver can live there for now as well. Maybe that will be a bit cleaner.
Otherwise nice work, thanks!

@miguelguzmanr
Copy link
Collaborator Author

I suggest we put these changes on hold while we review other pull requests @langerhans

@miguelguzmanr
Copy link
Collaborator Author

miguelguzmanr commented Apr 21, 2024

Introduces configurable charging separation.
Requires thorough testing, as this may introduce additional battery drain due to having to monitor the battery level.

image

@miguelguzmanr
Copy link
Collaborator Author

This approach only works if the app is running in the background. I think this might need to be implemented as a foreground service or a background task.

@langerhans
Copy link
Owner

Even with the fix from #23 this does not work in background? Could we just watch battery state with Intent.ACTION_BATTERY_CHANGED?

@miguelguzmanr
Copy link
Collaborator Author

miguelguzmanr commented Apr 28, 2024

Introduces a service to monitor the battery level.
Just trying out a different approach.
Sadly, the service forcefully ends when the app is terminated in any way.

Requires #23 to work in the background.

image

Fixed incorrectly reading restrictCharge setting as a system setting instead of as a text file.
Discovered that charging separation briefly turns off when the screen is turned off. Not sure about the culprit. Added a trigger for screen off event to combat this behavior.
Should work properly now.

Added an option to dump a log file for debug builds.
Might be useful for troubleshooting issues.

image

@miguelguzmanr
Copy link
Collaborator Author

@langerhans please let me know your thoughts!

Copy link
Owner

@langerhans langerhans left a comment

Choose a reason for hiding this comment

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

Happy to merge this, but just had two more questions :)

@github-staff github-staff deleted a comment from isedwards May 1, 2024
@miguelguzmanr
Copy link
Collaborator Author

@langerhans please let me know if this approach works better!

@langerhans
Copy link
Owner

Yup looks good to me, LGTM

@langerhans langerhans merged commit b32e54f into langerhans:main May 15, 2024
3 checks passed
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.

2 participants