GrapheneCamera: Add a script for updating prebuilt libs

Change-Id: I2be67f63831cc25ff6454a4414bb2e681b07bbfc
diff --git a/libs/Android.bp b/libs/Android.bp
index dc2afb4..03e2076 100644
--- a/libs/Android.bp
+++ b/libs/Android.bp
@@ -16,7 +16,7 @@
 
 android_library_import {
     name: "androidx.camera_camera-camera2",
-    aars: ["androidx.camera_camera-camera2-*.aar"],
+    aars: ["androidx.camera_camera-camera2.aar"],
     sdk_version: "current",
 }
 
@@ -46,48 +46,48 @@
 
 android_library_import {
     name: "androidx.camera_camera-core",
-    aars: ["androidx.camera_camera-core-*.aar"],
+    aars: ["androidx.camera_camera-core.aar"],
     sdk_version: "current",
 }
 
 android_library_import {
     name: "androidx.camera_camera-extensions",
-    aars: ["androidx.camera_camera-extensions-*.aar"],
+    aars: ["androidx.camera_camera-extensions.aar"],
     sdk_version: "current",
 }
 
 android_library_import {
     name: "androidx.camera_camera-lifecycle",
-    aars: ["androidx.camera_camera-lifecycle-*.aar"],
+    aars: ["androidx.camera_camera-lifecycle.aar"],
     sdk_version: "current",
 }
 
 android_library_import {
     name: "androidx.camera_camera-video",
-    aars: ["androidx.camera_camera-video-*.aar"],
+    aars: ["androidx.camera_camera-video.aar"],
     sdk_version: "current",
 }
 
 android_library_import {
     name: "androidx.camera_camera-view",
-    aars: ["androidx.camera_camera-view-*.aar"],
+    aars: ["androidx.camera_camera-view.aar"],
     sdk_version: "current",
 }
 
 java_import {
     name: "androidx.concurrent_concurrent-futures",
-    jars: ["androidx.concurrent_concurrent-futures-*.jar"],
+    jars: ["androidx.concurrent_concurrent-futures.jar"],
     sdk_version: "current",
 }
 
 android_library_import {
     name: "androidx.databinding_viewbinding",
-    aars: ["androidx.databinding_viewbinding-*.aar"],
+    aars: ["androidx.databinding_viewbinding.aar"],
     sdk_version: "current",
 }
 
 java_import {
     name: "com.google.zxing_core",
-    jars: ["com.google.zxing_core-*.jar"],
+    jars: ["com.google.zxing_core.jar"],
     sdk_version: "current",
 }
diff --git a/libs/androidx.camera_camera-camera2-1.1.0-rc01.aar b/libs/androidx.camera_camera-camera2.aar
similarity index 100%
rename from libs/androidx.camera_camera-camera2-1.1.0-rc01.aar
rename to libs/androidx.camera_camera-camera2.aar
Binary files differ
diff --git a/libs/androidx.camera_camera-core-1.1.0-rc01.aar b/libs/androidx.camera_camera-core.aar
similarity index 100%
rename from libs/androidx.camera_camera-core-1.1.0-rc01.aar
rename to libs/androidx.camera_camera-core.aar
Binary files differ
diff --git a/libs/androidx.camera_camera-extensions-1.1.0-rc01.aar b/libs/androidx.camera_camera-extensions.aar
similarity index 100%
rename from libs/androidx.camera_camera-extensions-1.1.0-rc01.aar
rename to libs/androidx.camera_camera-extensions.aar
Binary files differ
diff --git a/libs/androidx.camera_camera-lifecycle-1.1.0-rc01.aar b/libs/androidx.camera_camera-lifecycle.aar
similarity index 100%
rename from libs/androidx.camera_camera-lifecycle-1.1.0-rc01.aar
rename to libs/androidx.camera_camera-lifecycle.aar
Binary files differ
diff --git a/libs/androidx.camera_camera-video-1.1.0-rc01.aar b/libs/androidx.camera_camera-video.aar
similarity index 100%
rename from libs/androidx.camera_camera-video-1.1.0-rc01.aar
rename to libs/androidx.camera_camera-video.aar
Binary files differ
diff --git a/libs/androidx.camera_camera-view-1.1.0-rc01.aar b/libs/androidx.camera_camera-view.aar
similarity index 100%
rename from libs/androidx.camera_camera-view-1.1.0-rc01.aar
rename to libs/androidx.camera_camera-view.aar
Binary files differ
diff --git a/libs/androidx.concurrent_concurrent-futures-1.1.0.jar b/libs/androidx.concurrent_concurrent-futures.jar
similarity index 100%
rename from libs/androidx.concurrent_concurrent-futures-1.1.0.jar
rename to libs/androidx.concurrent_concurrent-futures.jar
Binary files differ
diff --git a/libs/androidx.databinding_viewbinding-7.4.0-alpha02.aar b/libs/androidx.databinding_viewbinding.aar
similarity index 100%
rename from libs/androidx.databinding_viewbinding-7.4.0-alpha02.aar
rename to libs/androidx.databinding_viewbinding.aar
Binary files differ
diff --git a/libs/com.google.zxing_core-3.5.0.jar b/libs/com.google.zxing_core.jar
similarity index 100%
rename from libs/com.google.zxing_core-3.5.0.jar
rename to libs/com.google.zxing_core.jar
Binary files differ
diff --git a/libs/update_libs.sh b/libs/update_libs.sh
new file mode 100755
index 0000000..c2f6195
--- /dev/null
+++ b/libs/update_libs.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+for LIB in androidx.camera_camera-camera2 \
+androidx.camera_camera-core \
+androidx.camera_camera-extensions \
+androidx.camera_camera-lifecycle \
+androidx.camera_camera-video \
+androidx.camera_camera-view; do
+    PKGNAME=$(echo $LIB | cut -f1 -d '_')
+    NAME=$(echo $LIB | cut -f2 -d '_')
+
+    VERSION=$(cat $(dirname $0)/../app/build.gradle.kts | grep "implementation(\"$PKGNAME:$NAME:" \
+            | cut -f3 -d ':' | cut -f1 -d '"')
+    if [ $PKGNAME = "androidx.camera" ]; then
+        VERSION=$(cat $(dirname $0)/../app/build.gradle.kts | grep "val cameraVersion =" | cut -f2 -d '"')
+    fi
+
+    FILEEXT=$(ls ${PKGNAME}_${NAME}.* | rev | cut -f1 -d '.' | rev)
+    wget -O ${PKGNAME}_${NAME}.${FILEEXT} \
+            https://maven.google.com/$(echo $PKGNAME | sed 's|\.|/|g')/${NAME}/${VERSION}/${NAME}-${VERSION}.${FILEEXT}
+
+    if [ $NAME = "camera-core" ]; then
+        pushd androidx.camera_camera-core
+        unzip ../${PKGNAME}_${NAME}.${FILEEXT} "jni/*/libimage_processing_util_jni.so"
+        popd
+    fi
+done