Skip to content

fix: fix-xiaomi-battery-safe-mode #3537

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

Conversation

JulianBissekkou
Copy link

@JulianBissekkou JulianBissekkou commented Apr 1, 2025

Description

This PR fixes a bug where the battery safe mode or power safe mode was not correctly fetched on Xiaomi devices. I added a comment in the PR at the important code that resolved the issue.

Related Issues

This resolves #3540

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

@miquelbeltran
Copy link
Member

Hello. I see that this PR is not following the Contributing Guidelines you also did not provide any context on what is this change about, and made changes on the pubspec files. Please address those or we will have to close this one.

@miquelbeltran miquelbeltran added the invalid Bad description, irrelevant information, not related to the plugin, etc. label Apr 1, 2025
@JulianBissekkou
Copy link
Author

The PR is still draft.
@miquelbeltran I will correct the PR today and come back to you :)

return if (mode != -1) {
mode == POWER_SAVE_MODE_XIAOMI_VALUE
} else {
null
checkPowerServiceSaveMode()
Copy link
Author

Choose a reason for hiding this comment

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

On some newer android version of xiaomi devices, the power safe mode is not available by querying POWER_SAVE_MODE_XIAOMI_NAME.

This PR fallbacks to the default power safe mode. We are doing something similar for samsung as well.

@JulianBissekkou JulianBissekkou changed the title Draft: fix-xiaomi-battery-safe-mode fix: fix-xiaomi-battery-safe-mode Apr 2, 2025
@JulianBissekkou
Copy link
Author

@miquelbeltran
The PR is ready now. Looking forward to your review ☺️

Copy link
Collaborator

@vbuberen vbuberen left a comment

Choose a reason for hiding this comment

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

Please update the PR title according to our guidelines.
Also, I would appreciate if you revert the formatting. We have editor config file in the project with rules for formatting, so would be good if you use it for lines formatting.

As to the change itself - that is great that Xiaomi finally gets on track to use the default Android APIs. Thanks for dealing with this.

@vbuberen
Copy link
Collaborator

Looks like there is no reply to review and no access to edit the PR despite the request in the contributors guide. Not the first time from this contributor, even though the change is useful. Closing this PR and will open a fixed one instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Bad description, irrelevant information, not related to the plugin, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Xiaomi battery safe mode is not working on newer android versions
3 participants