-
-
Notifications
You must be signed in to change notification settings - Fork 869
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
Report ignoreBatteryOptimizations permission correctly #1200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good and appears to be working.
I have one comment regarding the workings of the permission when running Android below Marshmallow.
|
||
if (requestCode == PermissionConstants.PERMISSION_CODE_IGNORE_BATTERY_OPTIMIZATIONS) { | ||
permission = PermissionConstants.PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS; | ||
|
||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to report false
or true
when the device runs a version below Marshmallow? Doze and App Stand-by were not introduced until Marshmallow. It might make sense to return this as true
from a developer's perspective, as to indicate that the application is not subjected to battery optimizations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good point, I will update the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably also the case for the logic that handles just checking the status of the permission
* Report ignoreBatteryOptimizations permission correctly * Report restricted status pre-marshmallow devices
Fixes a bug where the
ignoreBatteryOptimizations
reports a denied status when requesting permission and the user granted permission.Solves #1191
Pre-launch Checklist
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.CHANGELOG.md
to add a description of the change.///
).main
.dart format .
and committed any changes.flutter analyze
and fixed any errors.