commit | c2ac7297c48edee0772b1e3a53133a8a9a2653fe | [log] [tgz] |
---|---|---|
author | Christian Padilla <cepadilla@google.com> | Wed Feb 22 11:12:52 2023 -0800 |
committer | GitHub <noreply@github.com> | Wed Feb 22 11:12:52 2023 -0800 |
tree | decea41880b1b8b62ef2243f0b78febd5aa71a01 | |
parent | 557d3284ac9dda32a1106bb75be8a23bdccd2f96 [diff] |
Replace JDK 8 API `Math.toIntExact` is a JDK 8 API. Not all Android apps want/need to include JDK 8, since it comes at a non-zero cost. In this case, `Long.intValue` should behave identically since only small Long values should exist. There doesn't seem to be any other JDK 8 APIs in this plugin.
diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraSelectorHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraSelectorHostApiImpl.java index 603f7cf..00e2979 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraSelectorHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraSelectorHostApiImpl.java
@@ -32,7 +32,7 @@ CameraSelector cameraSelector; if (lensFacing != null) { - cameraSelector = cameraSelectorBuilder.requireLensFacing(Math.toIntExact(lensFacing)).build(); + cameraSelector = cameraSelectorBuilder.requireLensFacing(lensFacing.intValue()).build(); } else { cameraSelector = cameraSelectorBuilder.build(); }