forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Switch Android unit tests to LUCI (flutter#4406)
This moves Android unit tests from Cirrus to LUCI. In order to accomplish this: - Switches the Android LUCI bots from JDK 11 to JDK 12, to resolve a crash when compiling `camera_android` unit tests with 11. - Adds wrappers to SDK checks where necessary for testability, since the hack to override `Build.VERSION.SDK_INT` in unit tests (which was already giving warnings when run with JDK 11) no longer works at all in JDK 12. Part of flutter/flutter#114373
- Loading branch information
1 parent
86c2b7d
commit 166e2c2
Showing
39 changed files
with
343 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ges/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/DeviceInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
.../camera_android/android/src/main/java/io/flutter/plugins/camera/SdkCapabilityChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | ||
// 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() { | ||
// 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() { | ||
// 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() { | ||
// 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() { | ||
// 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() { | ||
// See https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_ZOOM_RATIO | ||
return SDK_VERSION >= Build.VERSION_CODES.R; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.