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

fix setExposureAndFocusPoint #66

Merged
merged 3 commits into from
Dec 24, 2021

Conversation

leftcoding
Copy link
Contributor

@leftcoding leftcoding commented Dec 24, 2021

Summary

Fix #65. This PR fixes set exposure crashes when switching between cameras by adding a condition when the set is called.

Step to reproduce

  • Double click to switch between cameras
  • When switching, tap the screen again, to call the exposure point set.

Environments

  • System version: Android 10
  • Package: ^2.6.2
  • Flutter SDK: 2.5.3
  • Dart SDK: 2.14.0

Logs

E/AndroidRuntime( 5978): java.lang.AssertionError: The cameraBoundaries should be set (using `ExposurePointFeature.setCameraBoundaries(Size)`) before updating the exposure point.
E/AndroidRuntime( 5978): 	at io.flutter.plugins.camera.features.exposurepoint.ExposurePointFeature.buildExposureRectangle(ExposurePointFeature.java:83)
E/AndroidRuntime( 5978): 	at io.flutter.plugins.camera.features.exposurepoint.ExposurePointFeature.setValue(ExposurePointFeature.java:61)
E/AndroidRuntime( 5978): 	at io.flutter.plugins.camera.Camera.setExposurePoint(Camera.java:803)
E/AndroidRuntime( 5978): 	at io.flutter.plugins.camera.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:183)
E/AndroidRuntime( 5978): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/AndroidRuntime( 5978): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/AndroidRuntime( 5978): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/AndroidRuntime( 5978): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime( 5978): 	at android.os.MessageQueue.next(MessageQueue.java:326)
E/AndroidRuntime( 5978): 	at android.os.Looper.loop(Looper.java:160)
E/AndroidRuntime( 5978): 	at android.app.ActivityThread.main(ActivityThread.java:6713)
E/AndroidRuntime( 5978): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 5978): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime( 5978): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

Comment on lines 1320 to 1323
if (_controller?.value.isInitialized != true) {
return;
}
setExposureAndFocusPoint(d, constraints);
Copy link
Member

@AlexV525 AlexV525 Dec 24, 2021

Choose a reason for hiding this comment

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

Suggested change
if (_controller?.value.isInitialized != true) {
return;
}
setExposureAndFocusPoint(d, constraints);
// Only call exposure point updates when the controller is initialized.
if (_controller?.value.isInitialized == true) {
setExposureAndFocusPoint(d, constraints);
}

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix.

@AlexV525 AlexV525 merged commit 5d59238 into fluttercandies:master Dec 24, 2021
@AlexV525
Copy link
Member

@all-contributors Add @leftcoding for bugs.

@allcontributors
Copy link
Contributor

@AlexV525

I've put up a pull request to add @leftcoding! 🎉

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.

[Android] 多次快速点击拍照页崩溃
2 participants