Aperture: Bind onResume instead of onCreate

Signed-off-by: Luca Stefani <luca.stefani.ge1@gmail.com>
Change-Id: If7ce54eafe8d8415e9fd659b027353e16780cb4c
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index cb11989..439e04d 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -168,9 +168,6 @@
         // Get vendor extensions manager
         extensionsManager = ExtensionsManager.getInstanceAsync(this, cameraProvider).get()
 
-        // Bind use cases for the first time
-        bindCameraUseCases()
-
         // Bind camera controller to lifecycle
         cameraController.bindToLifecycle(this)
 
@@ -272,12 +269,16 @@
         cameraExecutor = Executors.newSingleThreadExecutor()
     }
 
+    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
     override fun onResume() {
         super.onResume()
 
         // Special case: we want to enable the gallery by default if
         // we have at least one saved Uri and we aren't locked
         updateGalleryButton(sharedPreferences.lastSavedUri, !keyguardManager.isKeyguardLocked)
+
+        // Re-bind the use cases
+        bindCameraUseCases()
     }
 
     override fun onPause() {