-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[ci] Switch Android unit tests to LUCI #4406
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
Changes from all commits
2fd6c1b
2d98156
4a553a6
548e6da
ff42883
b4a8952
36ca493
9995ab1
78d7a5b
ce4d5d4
49e28f5
205621b
a0786b9
a6fe405
650281f
b4f513a
c128a32
ae5e9fb
935cddd
ab00422
9975a89
529d44e
a4503ec
bf74408
8a17345
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 0.10.8+4 | ||
|
|
||
| * Adjusts SDK checks for better testability. | ||
|
|
||
| ## 0.10.8+3 | ||
|
|
||
| * Fixes unawaited_futures violations. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| package io.flutter.plugins.camera; | ||
|
|
||
| import android.os.Build; | ||
| import androidx.annotation.Nullable; | ||
| import androidx.annotation.VisibleForTesting; | ||
|
|
||
| /** Wraps BUILD device info, allowing for overriding it in unit tests. */ | ||
| public class DeviceInfo { | ||
| @VisibleForTesting public static @Nullable String BRAND = Build.BRAND; | ||
|
|
||
| @VisibleForTesting public static @Nullable String MODEL = Build.MODEL; | ||
|
|
||
| public static @Nullable String getBrand() { | ||
| return BRAND; | ||
| } | ||
|
|
||
| public static @Nullable String getModel() { | ||
| return MODEL; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| package io.flutter.plugins.camera; | ||
|
|
||
| import android.annotation.SuppressLint; | ||
| import android.os.Build; | ||
| import androidx.annotation.ChecksSdkIntAtLeast; | ||
| import androidx.annotation.VisibleForTesting; | ||
|
|
||
| /** Abstracts SDK version checks, and allows overriding them in unit tests. */ | ||
| public class SdkCapabilityChecker { | ||
| /** The current SDK version, overridable for testing. */ | ||
| @SuppressLint("AnnotateVersionCheck") | ||
| @VisibleForTesting | ||
| public static int SDK_VERSION = Build.VERSION.SDK_INT; | ||
|
|
||
| @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P) | ||
| public static boolean supportsDistortionCorrection() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find these types of classes aid in readability a ton. That said it is even better when there are breadcrumbs to the source of truth but are annoying to find during a refactor and this is already a net improvement. To that end I have added suggestions with links to the android docs for at many as I could find.
stuartmorgan-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // See https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES | ||
| return SDK_VERSION >= Build.VERSION_CODES.P; | ||
| } | ||
|
|
||
| @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O) | ||
| public static boolean supportsEglRecordableAndroid() { | ||
| // See https://developer.android.com/reference/android/opengl/EGLExt#EGL_RECORDABLE_ANDROID | ||
| return SDK_VERSION >= Build.VERSION_CODES.O; | ||
| } | ||
|
|
||
| @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.S) | ||
| public static boolean supportsEncoderProfiles() { | ||
stuartmorgan-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // See https://developer.android.com/reference/android/media/EncoderProfiles | ||
| return SDK_VERSION >= Build.VERSION_CODES.S; | ||
| } | ||
|
|
||
| @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.M) | ||
| public static boolean supportsMarshmallowNoiseReductionModes() { | ||
stuartmorgan-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // See https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES | ||
| return SDK_VERSION >= Build.VERSION_CODES.M; | ||
| } | ||
|
|
||
| @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P) | ||
| public static boolean supportsSessionConfiguration() { | ||
stuartmorgan-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // See https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration | ||
| return SDK_VERSION >= Build.VERSION_CODES.P; | ||
| } | ||
|
|
||
| @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.N) | ||
| public static boolean supportsVideoPause() { | ||
stuartmorgan-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // See https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Pause | ||
| return SDK_VERSION >= Build.VERSION_CODES.N; | ||
| } | ||
|
|
||
| @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R) | ||
| public static boolean supportsZoomRatio() { | ||
stuartmorgan-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // See https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_ZOOM_RATIO | ||
| return SDK_VERSION >= Build.VERSION_CODES.R; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.