-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[camerax] Add system services to plugin #6986
Conversation
import androidx.core.app.ActivityCompat; | ||
import androidx.core.content.ContextCompat; | ||
|
||
final class CameraPermissionsManager { |
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 the same as CameraPermissions.java in the old plugin.
/** | ||
* Support class to help to determine the media orientation based on the orientation of the device. | ||
*/ | ||
public class DeviceOrientationManager { |
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 the same as DeviceOrientationManager.java, with the exception that it notifies changes in device orientation with a DeviceOrientationChangeCallback
versus a DartMessenger
.
import io.flutter.plugins.camerax.CameraPermissionsManager.ResultCallback; | ||
import org.junit.Test; | ||
|
||
public class CameraPermissionsManagerTest { |
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 the same as CameraPermissions.java in the old plugin.
import org.junit.Test; | ||
import org.mockito.MockedStatic; | ||
|
||
public class DeviceOrientationManagerTest { |
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 essentially the same as DeviceOrientationManager.java in the old plugin, with the DartMessenger
swapped out for the DeviceOrientationChangeCallback
import 'android_camera_camerax_flutter_api_impls.dart'; | ||
import 'camerax_library.pigeon.dart'; | ||
|
||
// ignore_for_file: avoid_classes_with_only_static_members |
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.
I initially wanted to group all static calls to system services here, so I ignored this lint warning. Open to feedback on this decision.
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 fine since you are just wrapping a native class. Can you also add a comment with this explanation about why it is ignored.
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.
LGTM with a few comments
@@ -66,7 +66,15 @@ public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { | |||
|
|||
@Override | |||
public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBinding) { | |||
updateContext(activityPluginBinding.getActivity()); | |||
CameraAndroidCameraxPlugin plugin = new CameraAndroidCameraxPlugin(); | |||
plugin.setUp( |
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.
Same as #6939 (comment)
import 'android_camera_camerax_flutter_api_impls.dart'; | ||
import 'camerax_library.pigeon.dart'; | ||
|
||
// ignore_for_file: avoid_classes_with_only_static_members |
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 fine since you are just wrapping a native class. Can you also add a comment with this explanation about why it is ignored.
final MockTestSystemServicesHostApi mockApi = | ||
MockTestSystemServicesHostApi(); | ||
TestSystemServicesHostApi.setup(mockApi); | ||
const bool enableAudio = true; |
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.
nit: I think we typically test against literals instead of variables in this repo
auto label is removed for flutter/plugins, pr: 6986, due to - The status or check suite Windows windows-build_all_plugins master has failed. Please fix the issues identified (or deflake) before re-applying this label. |
* 90f447313 [ci] Increase timeouts for platform_tests (flutter/plugins#7036) * f5568e4b1 [google_sign_in] Add doc for iOS auth with SERVER_CLIENT_ID (flutter/plugins#4747) * 0c05e8d91 Roll Flutter from a815ee6 to 75680ae (58 revisions) (flutter/plugins#7048) * a4c320902 [camera]: Bump camerax_version from 1.3.0-alpha02 to 1.3.0-alpha03 in /packages/camera/camera_android_camerax/android (flutter/plugins#7061) * 8f12b27b6 [ci] Add LUCI versions of macOS ARM tests (flutter/plugins#6984) * 3843b38e2 [tool] Improve main-branch detection (flutter/plugins#7038) * d39e7569c [in_app_purchase] Prep for more const widgets (flutter/plugins#7030) * ddb9777ee [ci] Switch remaining macOS host tests to LUCI (flutter/plugins#7063) * 2edf56324 [ci] Part 1 of swapping iOS platform test arch (flutter/plugins#7064) * 35f0b1a49 [camerax] Add system services to plugin (flutter/plugins#6986) * 5dd0f41a2 [webview]: Bump mockito-inline (flutter/plugins#7056) * 1896f10ca [webview_flutter_wkwebview][webview_flutter_android] Fixes bug where the `WebView`s could not be released (flutter/plugins#6996) * a494825fa [camerax] Allow instance manager to create identical objects (flutter/plugins#7034) * 6ef73da26 [ci] Increase heavy workload memory (flutter/plugins#7065) * 9da327ca3 [various] Update to use sharedDarwinSource (flutter/plugins#7027)
Adds functionality to request (i) camera permissions and (ii) subscribe to changes in device orientation.
Fixes flutter/flutter#118740.
Fixes flutter/flutter#118742.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).