Aperture: Update CameraX to 1.3.0-beta01
Change-Id: Ib8926e5720cd7257bc78edd48d6c90ab32693282
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 048d3d5..21b865c 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -63,7 +63,7 @@
implementation("com.google.android.material:material:1.9.0")
// CameraX core library using the camera2 implementation
- val cameraxVersion = "1.3.0-alpha07"
+ val cameraxVersion = "1.3.0-beta01"
// The following line is optional, as the core library is included indirectly by camera-camera2
implementation("androidx.camera:camera-core:${cameraxVersion}")
implementation("androidx.camera:camera-camera2:${cameraxVersion}")
diff --git a/app/libs/Android.bp b/app/libs/Android.bp
index a29d436..fc24189 100644
--- a/app/libs/Android.bp
+++ b/app/libs/Android.bp
@@ -1,7 +1,7 @@
// DO NOT EDIT THIS FILE MANUALLY
android_library_import {
name: "Aperture_androidx.camera_camera-camera2-nodeps",
- aars: ["androidx/camera/camera-camera2/1.3.0-alpha07/camera-camera2-1.3.0-alpha07.aar"],
+ aars: ["androidx/camera/camera-camera2/1.3.0-beta01/camera-camera2-1.3.0-beta01.aar"],
sdk_version: "33",
min_sdk_version: "14",
apex_available: [
@@ -25,7 +25,7 @@
"//apex_available:platform",
"//apex_available:anyapex",
],
- manifest: "androidx/camera/camera-camera2/1.3.0-alpha07/AndroidManifest.xml",
+ manifest: "androidx/camera/camera-camera2/1.3.0-beta01/AndroidManifest.xml",
static_libs: [
"Aperture_androidx.camera_camera-camera2-nodeps",
"Aperture_androidx.camera_camera-core",
@@ -39,7 +39,7 @@
android_library_import {
name: "Aperture_androidx.camera_camera-core-nodeps",
- aars: ["androidx/camera/camera-core/1.3.0-alpha07/camera-core-1.3.0-alpha07.aar"],
+ aars: ["androidx/camera/camera-core/1.3.0-beta01/camera-core-1.3.0-beta01.aar"],
sdk_version: "33",
min_sdk_version: "14",
apex_available: [
@@ -67,7 +67,7 @@
"//apex_available:platform",
"//apex_available:anyapex",
],
- manifest: "androidx/camera/camera-core/1.3.0-alpha07/AndroidManifest.xml",
+ manifest: "androidx/camera/camera-core/1.3.0-beta01/AndroidManifest.xml",
static_libs: [
"Aperture_androidx.camera_camera-core-nodeps",
"androidx.annotation_annotation-experimental",
@@ -85,7 +85,7 @@
android_library_import {
name: "Aperture_androidx.camera_camera-extensions-nodeps",
- aars: ["androidx/camera/camera-extensions/1.3.0-alpha07/camera-extensions-1.3.0-alpha07.aar"],
+ aars: ["androidx/camera/camera-extensions/1.3.0-beta01/camera-extensions-1.3.0-beta01.aar"],
sdk_version: "33",
min_sdk_version: "14",
apex_available: [
@@ -110,7 +110,7 @@
"//apex_available:platform",
"//apex_available:anyapex",
],
- manifest: "androidx/camera/camera-extensions/1.3.0-alpha07/AndroidManifest.xml",
+ manifest: "androidx/camera/camera-extensions/1.3.0-beta01/AndroidManifest.xml",
static_libs: [
"Aperture_androidx.camera_camera-extensions-nodeps",
"Aperture_androidx.camera_camera-camera2",
@@ -125,7 +125,7 @@
android_library_import {
name: "Aperture_androidx.camera_camera-lifecycle-nodeps",
- aars: ["androidx/camera/camera-lifecycle/1.3.0-alpha07/camera-lifecycle-1.3.0-alpha07.aar"],
+ aars: ["androidx/camera/camera-lifecycle/1.3.0-beta01/camera-lifecycle-1.3.0-beta01.aar"],
sdk_version: "33",
min_sdk_version: "14",
apex_available: [
@@ -150,7 +150,7 @@
"//apex_available:platform",
"//apex_available:anyapex",
],
- manifest: "androidx/camera/camera-lifecycle/1.3.0-alpha07/AndroidManifest.xml",
+ manifest: "androidx/camera/camera-lifecycle/1.3.0-beta01/AndroidManifest.xml",
static_libs: [
"Aperture_androidx.camera_camera-lifecycle-nodeps",
"Aperture_androidx.camera_camera-core",
@@ -165,7 +165,7 @@
android_library_import {
name: "Aperture_androidx.camera_camera-video-nodeps",
- aars: ["androidx/camera/camera-video/1.3.0-alpha07/camera-video-1.3.0-alpha07.aar"],
+ aars: ["androidx/camera/camera-video/1.3.0-beta01/camera-video-1.3.0-beta01.aar"],
sdk_version: "33",
min_sdk_version: "14",
apex_available: [
@@ -188,7 +188,7 @@
"//apex_available:platform",
"//apex_available:anyapex",
],
- manifest: "androidx/camera/camera-video/1.3.0-alpha07/AndroidManifest.xml",
+ manifest: "androidx/camera/camera-video/1.3.0-beta01/AndroidManifest.xml",
static_libs: [
"Aperture_androidx.camera_camera-video-nodeps",
"Aperture_androidx.camera_camera-core",
@@ -201,7 +201,7 @@
android_library_import {
name: "Aperture_androidx.camera_camera-view-nodeps",
- aars: ["androidx/camera/camera-view/1.3.0-alpha07/camera-view-1.3.0-alpha07.aar"],
+ aars: ["androidx/camera/camera-view/1.3.0-beta01/camera-view-1.3.0-beta01.aar"],
sdk_version: "33",
min_sdk_version: "14",
apex_available: [
@@ -230,7 +230,7 @@
"//apex_available:platform",
"//apex_available:anyapex",
],
- manifest: "androidx/camera/camera-view/1.3.0-alpha07/AndroidManifest.xml",
+ manifest: "androidx/camera/camera-view/1.3.0-beta01/AndroidManifest.xml",
static_libs: [
"Aperture_androidx.camera_camera-view-nodeps",
"androidx.annotation_annotation-experimental",
diff --git a/app/libs/androidx/camera/camera-camera2/1.3.0-alpha07/camera-camera2-1.3.0-alpha07.aar b/app/libs/androidx/camera/camera-camera2/1.3.0-alpha07/camera-camera2-1.3.0-alpha07.aar
deleted file mode 100644
index e41196b..0000000
--- a/app/libs/androidx/camera/camera-camera2/1.3.0-alpha07/camera-camera2-1.3.0-alpha07.aar
+++ /dev/null
Binary files differ
diff --git a/app/libs/androidx/camera/camera-camera2/1.3.0-alpha07/AndroidManifest.xml b/app/libs/androidx/camera/camera-camera2/1.3.0-beta01/AndroidManifest.xml
similarity index 100%
rename from app/libs/androidx/camera/camera-camera2/1.3.0-alpha07/AndroidManifest.xml
rename to app/libs/androidx/camera/camera-camera2/1.3.0-beta01/AndroidManifest.xml
diff --git a/app/libs/androidx/camera/camera-camera2/1.3.0-beta01/camera-camera2-1.3.0-beta01.aar b/app/libs/androidx/camera/camera-camera2/1.3.0-beta01/camera-camera2-1.3.0-beta01.aar
new file mode 100644
index 0000000..a49c47a
--- /dev/null
+++ b/app/libs/androidx/camera/camera-camera2/1.3.0-beta01/camera-camera2-1.3.0-beta01.aar
Binary files differ
diff --git a/app/libs/androidx/camera/camera-core/1.3.0-alpha07/camera-core-1.3.0-alpha07.aar b/app/libs/androidx/camera/camera-core/1.3.0-alpha07/camera-core-1.3.0-alpha07.aar
deleted file mode 100644
index fd21ea6..0000000
--- a/app/libs/androidx/camera/camera-core/1.3.0-alpha07/camera-core-1.3.0-alpha07.aar
+++ /dev/null
Binary files differ
diff --git a/app/libs/androidx/camera/camera-core/1.3.0-alpha07/AndroidManifest.xml b/app/libs/androidx/camera/camera-core/1.3.0-beta01/AndroidManifest.xml
similarity index 100%
rename from app/libs/androidx/camera/camera-core/1.3.0-alpha07/AndroidManifest.xml
rename to app/libs/androidx/camera/camera-core/1.3.0-beta01/AndroidManifest.xml
diff --git a/app/libs/androidx/camera/camera-core/1.3.0-beta01/camera-core-1.3.0-beta01.aar b/app/libs/androidx/camera/camera-core/1.3.0-beta01/camera-core-1.3.0-beta01.aar
new file mode 100644
index 0000000..f3e0f5a
--- /dev/null
+++ b/app/libs/androidx/camera/camera-core/1.3.0-beta01/camera-core-1.3.0-beta01.aar
Binary files differ
diff --git a/app/libs/androidx/camera/camera-extensions/1.3.0-alpha07/camera-extensions-1.3.0-alpha07.aar b/app/libs/androidx/camera/camera-extensions/1.3.0-alpha07/camera-extensions-1.3.0-alpha07.aar
deleted file mode 100644
index 75c193d..0000000
--- a/app/libs/androidx/camera/camera-extensions/1.3.0-alpha07/camera-extensions-1.3.0-alpha07.aar
+++ /dev/null
Binary files differ
diff --git a/app/libs/androidx/camera/camera-extensions/1.3.0-alpha07/AndroidManifest.xml b/app/libs/androidx/camera/camera-extensions/1.3.0-beta01/AndroidManifest.xml
similarity index 100%
rename from app/libs/androidx/camera/camera-extensions/1.3.0-alpha07/AndroidManifest.xml
rename to app/libs/androidx/camera/camera-extensions/1.3.0-beta01/AndroidManifest.xml
diff --git a/app/libs/androidx/camera/camera-extensions/1.3.0-beta01/camera-extensions-1.3.0-beta01.aar b/app/libs/androidx/camera/camera-extensions/1.3.0-beta01/camera-extensions-1.3.0-beta01.aar
new file mode 100644
index 0000000..938fef4
--- /dev/null
+++ b/app/libs/androidx/camera/camera-extensions/1.3.0-beta01/camera-extensions-1.3.0-beta01.aar
Binary files differ
diff --git a/app/libs/androidx/camera/camera-lifecycle/1.3.0-alpha07/camera-lifecycle-1.3.0-alpha07.aar b/app/libs/androidx/camera/camera-lifecycle/1.3.0-alpha07/camera-lifecycle-1.3.0-alpha07.aar
deleted file mode 100644
index b6be4a5..0000000
--- a/app/libs/androidx/camera/camera-lifecycle/1.3.0-alpha07/camera-lifecycle-1.3.0-alpha07.aar
+++ /dev/null
Binary files differ
diff --git a/app/libs/androidx/camera/camera-lifecycle/1.3.0-alpha07/AndroidManifest.xml b/app/libs/androidx/camera/camera-lifecycle/1.3.0-beta01/AndroidManifest.xml
similarity index 100%
rename from app/libs/androidx/camera/camera-lifecycle/1.3.0-alpha07/AndroidManifest.xml
rename to app/libs/androidx/camera/camera-lifecycle/1.3.0-beta01/AndroidManifest.xml
diff --git a/app/libs/androidx/camera/camera-lifecycle/1.3.0-beta01/camera-lifecycle-1.3.0-beta01.aar b/app/libs/androidx/camera/camera-lifecycle/1.3.0-beta01/camera-lifecycle-1.3.0-beta01.aar
new file mode 100644
index 0000000..c6f5d32
--- /dev/null
+++ b/app/libs/androidx/camera/camera-lifecycle/1.3.0-beta01/camera-lifecycle-1.3.0-beta01.aar
Binary files differ
diff --git a/app/libs/androidx/camera/camera-video/1.3.0-alpha07/camera-video-1.3.0-alpha07.aar b/app/libs/androidx/camera/camera-video/1.3.0-alpha07/camera-video-1.3.0-alpha07.aar
deleted file mode 100644
index b2855b0..0000000
--- a/app/libs/androidx/camera/camera-video/1.3.0-alpha07/camera-video-1.3.0-alpha07.aar
+++ /dev/null
Binary files differ
diff --git a/app/libs/androidx/camera/camera-video/1.3.0-alpha07/AndroidManifest.xml b/app/libs/androidx/camera/camera-video/1.3.0-beta01/AndroidManifest.xml
similarity index 100%
rename from app/libs/androidx/camera/camera-video/1.3.0-alpha07/AndroidManifest.xml
rename to app/libs/androidx/camera/camera-video/1.3.0-beta01/AndroidManifest.xml
diff --git a/app/libs/androidx/camera/camera-video/1.3.0-beta01/camera-video-1.3.0-beta01.aar b/app/libs/androidx/camera/camera-video/1.3.0-beta01/camera-video-1.3.0-beta01.aar
new file mode 100644
index 0000000..f73641a
--- /dev/null
+++ b/app/libs/androidx/camera/camera-video/1.3.0-beta01/camera-video-1.3.0-beta01.aar
Binary files differ
diff --git a/app/libs/androidx/camera/camera-view/1.3.0-alpha07/camera-view-1.3.0-alpha07.aar b/app/libs/androidx/camera/camera-view/1.3.0-alpha07/camera-view-1.3.0-alpha07.aar
deleted file mode 100644
index b2e356e..0000000
--- a/app/libs/androidx/camera/camera-view/1.3.0-alpha07/camera-view-1.3.0-alpha07.aar
+++ /dev/null
Binary files differ
diff --git a/app/libs/androidx/camera/camera-view/1.3.0-alpha07/AndroidManifest.xml b/app/libs/androidx/camera/camera-view/1.3.0-beta01/AndroidManifest.xml
similarity index 100%
rename from app/libs/androidx/camera/camera-view/1.3.0-alpha07/AndroidManifest.xml
rename to app/libs/androidx/camera/camera-view/1.3.0-beta01/AndroidManifest.xml
diff --git a/app/libs/androidx/camera/camera-view/1.3.0-beta01/camera-view-1.3.0-beta01.aar b/app/libs/androidx/camera/camera-view/1.3.0-beta01/camera-view-1.3.0-beta01.aar
new file mode 100644
index 0000000..fbb65d0
--- /dev/null
+++ b/app/libs/androidx/camera/camera-view/1.3.0-beta01/camera-view-1.3.0-beta01.aar
Binary files differ
diff --git a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
index e232c93..ee5c4f7 100644
--- a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
@@ -48,6 +48,7 @@
import androidx.camera.core.resolutionselector.ResolutionSelector
import androidx.camera.extensions.ExtensionMode
import androidx.camera.video.Quality
+import androidx.camera.video.QualitySelector
import androidx.camera.video.Recording
import androidx.camera.video.VideoRecordEvent
import androidx.camera.video.muted
@@ -123,7 +124,6 @@
@androidx.camera.camera2.interop.ExperimentalCamera2Interop
@androidx.camera.core.ExperimentalZeroShutterLag
-@androidx.camera.view.video.ExperimentalVideo
open class CameraActivity : AppCompatActivity() {
// Views
private val aspectRatioButton by lazy { findViewById<Button>(R.id.aspectRatioButton) }
@@ -1068,9 +1068,9 @@
sharedPreferences.aspectRatio, AspectRatioStrategy.FALLBACK_RULE_AUTO
))
.setAllowedResolutionMode(if (cameraManager.enableHighResolution) {
- ResolutionSelector.ALLOWED_RESOLUTIONS_SLOW
+ ResolutionSelector.PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE
} else {
- ResolutionSelector.ALLOWED_RESOLUTIONS_NORMAL
+ ResolutionSelector.PREFER_CAPTURE_RATE_OVER_HIGHER_RESOLUTION
})
.build()
CameraController.IMAGE_CAPTURE
@@ -1080,8 +1080,8 @@
if (!supportedVideoQualities.contains(sharedPreferences.videoQuality)) {
sharedPreferences.videoQuality = supportedVideoQualities.first()
}
- cameraController.videoCaptureTargetQuality = null // FIXME: video preview restart
- cameraController.videoCaptureTargetQuality = sharedPreferences.videoQuality
+ cameraController.videoCaptureQualitySelector =
+ QualitySelector.from(sharedPreferences.videoQuality)
// Set proper video framerate
sharedPreferences.videoFramerate = (Framerate::getLowerOrHigher)(
diff --git a/app/src/main/java/org/lineageos/aperture/QrScannerActivity.kt b/app/src/main/java/org/lineageos/aperture/QrScannerActivity.kt
index 2d76895..0c402fe 100644
--- a/app/src/main/java/org/lineageos/aperture/QrScannerActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/QrScannerActivity.kt
@@ -9,7 +9,6 @@
@androidx.camera.camera2.interop.ExperimentalCamera2Interop
@androidx.camera.core.ExperimentalZeroShutterLag
-@androidx.camera.view.video.ExperimentalVideo
class QrScannerActivity : CameraActivity() {
override fun overrideInitialCameraMode() = CameraMode.QR
}
diff --git a/app/src/main/java/org/lineageos/aperture/camera/Camera.kt b/app/src/main/java/org/lineageos/aperture/camera/Camera.kt
index 3074a20..6e94c8e 100644
--- a/app/src/main/java/org/lineageos/aperture/camera/Camera.kt
+++ b/app/src/main/java/org/lineageos/aperture/camera/Camera.kt
@@ -11,8 +11,9 @@
import androidx.camera.camera2.interop.Camera2CameraInfo
import androidx.camera.core.CameraInfo
import androidx.camera.core.CameraSelector
+import androidx.camera.core.DynamicRange
import androidx.camera.video.Quality
-import androidx.camera.video.QualitySelector
+import androidx.camera.video.Recorder
import org.lineageos.aperture.ext.*
import kotlin.reflect.safeCast
@@ -47,13 +48,15 @@
private val supportedVideoFramerates = cameraInfo.supportedFrameRateRanges.mapNotNull {
Framerate.fromRange(it)
}.distinct().sorted()
- val supportedVideoQualities = QualitySelector.getSupportedQualities(cameraInfo).associateWith {
- supportedVideoFramerates + cameraManager.getAdditionalVideoFramerates(cameraId, it)
- }.toSortedMap { a, b ->
- listOf(Quality.SD, Quality.HD, Quality.FHD, Quality.UHD).let {
- it.indexOf(a) - it.indexOf(b)
- }
- }
+ val supportedVideoQualities =
+ Recorder.getVideoCapabilities(cameraInfo).getSupportedQualities(DynamicRange.SDR)
+ .associateWith {
+ supportedVideoFramerates + cameraManager.getAdditionalVideoFramerates(cameraId, it)
+ }.toSortedMap { a, b ->
+ listOf(Quality.SD, Quality.HD, Quality.FHD, Quality.UHD).let {
+ it.indexOf(a) - it.indexOf(b)
+ }
+ }
val supportsVideoRecording = supportedVideoQualities.isNotEmpty()
val supportedExtensionModes = cameraManager.extensionsManager.getSupportedModes(cameraSelector)
diff --git a/app/src/main/java/org/lineageos/aperture/utils/ShortcutsUtils.kt b/app/src/main/java/org/lineageos/aperture/utils/ShortcutsUtils.kt
index 2e50ec9..69355e5 100644
--- a/app/src/main/java/org/lineageos/aperture/utils/ShortcutsUtils.kt
+++ b/app/src/main/java/org/lineageos/aperture/utils/ShortcutsUtils.kt
@@ -20,7 +20,6 @@
@androidx.camera.camera2.interop.ExperimentalCamera2Interop
@androidx.camera.core.ExperimentalZeroShutterLag
- @androidx.camera.view.video.ExperimentalVideo
fun registerShortcuts(context: Context) {
val shortcutManager = context.getSystemService(ShortcutManager::class.java)
shortcutManager.dynamicShortcuts = listOf(
diff --git a/app/src/main/java/org/lineageos/aperture/utils/StorageUtils.kt b/app/src/main/java/org/lineageos/aperture/utils/StorageUtils.kt
index 10b242a..6c29c38 100644
--- a/app/src/main/java/org/lineageos/aperture/utils/StorageUtils.kt
+++ b/app/src/main/java/org/lineageos/aperture/utils/StorageUtils.kt
@@ -53,7 +53,6 @@
/**
* Returns a new OutputFileOptions to use to store a MP4 video
*/
- @androidx.camera.view.video.ExperimentalVideo
fun getVideoMediaStoreOutputOptions(
contentResolver: ContentResolver,
location: Location?
diff --git a/settings.gradle.kts b/settings.gradle.kts
index dd6a152..a5bf872 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -8,7 +8,7 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
- maven("https://raw.githubusercontent.com/luk1337/camerax_selfie/7e1d88811cf2c7b19a02f432e228005fe4023fc4/.m2")
+ maven("https://raw.githubusercontent.com/luk1337/camerax_selfie/6399ec6e375714b3a3786be88934a162c1563872/.m2")
google()
mavenCentral()
}