Snap for 12715656 from fa32332a55562edf522b44d5632bf6c9dfeb5da1 to 25Q1-release

Change-Id: I221011f2e4196eb8dc477a14d9b9bcc16b6dc60f
diff --git a/camera/lyric.mk b/camera/lyric.mk
index c886138..0ec1d6d 100644
--- a/camera/lyric.mk
+++ b/camera/lyric.mk
@@ -20,8 +20,20 @@
 # All shipping releases will switch to prebuilts (trunk+)
 # if this condition is not true, then build from source.
 
-ifneq ($(RELEASE_PIXEL_CAMERA_ENABLE_PREBUILT),true)
+# Fallback if the prebuilts directory does not exist, then we must
+# build from source no matter what, so we log a warning
+ifeq ($(RELEASE_PIXEL_CAMERA_ENABLE_PREBUILT),true)
+  ifeq ($(wildcard vendor/google/services/LyricCameraHAL/prebuilt),)
+    $(warning Lyric prebuilt directory is missing, it will be built from source)
+    BUILD_LYRIC_FROM_SOURCE := true
+  else
+    BUILD_LYRIC_FROM_SOURCE := false
+  endif
+else
+  BUILD_LYRIC_FROM_SOURCE := true
+endif  # RELEASE_PIXEL_CAMERA_ENABLE_PREBUILT
 
+ifeq ($(BUILD_LYRIC_FROM_SOURCE),true)
 PRODUCT_SOONG_NAMESPACES += \
     vendor/google/camera \
     vendor/google/camera/google_3a/libs_v4 \
@@ -41,7 +53,7 @@
 # Calibration tool for debug builds
 PRODUCT_PACKAGES_DEBUG += tarasque_test
 PRODUCT_PACKAGES_DEBUG += ProtoCalibGenerator
-endif  # RELEASE_PIXEL_CAMERA_ENABLE_PREBUILT check
+endif  # BUILD_LYRIC_FROM_SOURCE
 
 # Init-time log settings for Google 3A
 PRODUCT_PACKAGES += libg3a_standalone_gabc_rc
diff --git a/camera/lyric_soong_variables.md b/camera/lyric_soong_variables.md
index b442943..4289109 100644
--- a/camera/lyric_soong_variables.md
+++ b/camera/lyric_soong_variables.md
@@ -44,3 +44,13 @@
 $(call soong_config_set,google3a_config,target_device,oriole)
 ```
 A mixture of `camera_hardware` and `tuning_product` used by 3A.
+
+## `radioext_interface_type`
+
+Example:
+```
+$(call soong_config_set,lyric,radioext_interface_type,aidl)
+```
+Specifies which interface type to use in the RadioExt client when communicating
+with the RadioExt service. The possible values are "hidl" and "aidl".
+Devices launching with Android 15 no longer support HIDL.
diff --git a/gps/dump/dump_gps.cpp b/gps/dump/dump_gps.cpp
index e073732..7906a1f 100644
--- a/gps/dump/dump_gps.cpp
+++ b/gps/dump/dump_gps.cpp
@@ -17,6 +17,7 @@
 #include <android-base/properties.h>
 #include <dirent.h>
 #include <dump/pixel_dump.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
@@ -66,6 +67,58 @@
   return;
 }
 
+int compareFileExtensions(const struct dirent **a, const struct dirent **b) {
+    int num_a, num_b;
+    sscanf((*a)->d_name, "rawbinlog.out.%d", &num_a);
+    sscanf((*b)->d_name, "rawbinlog.out.%d", &num_b);
+
+    return num_a - num_b;
+}
+
+void dumpLogsAscending(const char* SrcDir, const char* DestDir, int limit, const char* prefix) {
+
+    struct dirent **dirent_list = NULL;
+    int num_entries = scandir(SrcDir, &dirent_list, 0, (int (*)(const struct dirent **, const struct dirent **)) alphasort);
+    if (!dirent_list) {
+        printf("Unable to scan dir: %s.\n", SrcDir);
+        return;
+    } else if (num_entries <= 0) {
+        printf("No file is found.\n");
+        return;
+    }
+
+    if (access(DestDir, R_OK)) {
+        printf("Unable to find folder: %s\n", DestDir);
+        return;
+    }
+
+    qsort(dirent_list, num_entries, sizeof(struct dirent *), (int (*)(const void *, const void *)) compareFileExtensions);
+
+    int copiedFiles = 0;
+
+    for (int i = 0 ; i < num_entries; i++) {
+
+        if (0 != strncmp(dirent_list[i]->d_name, prefix, strlen(prefix))) {
+            continue;
+        }
+
+        if ((copiedFiles >= limit) && (limit != -1)) {
+            printf("Skipped %s\n", dirent_list[i]->d_name);
+            continue;
+        }
+
+        copiedFiles++;
+        copyFile(concatenatePath(SrcDir, dirent_list[i]->d_name).c_str(), concatenatePath(DestDir, dirent_list[i]->d_name).c_str());
+    }
+
+    while (num_entries--) {
+        free(dirent_list[num_entries]);
+    }
+
+    free(dirent_list);
+    return;
+}
+
 int main() {
     if(!::android::base::GetBoolProperty("vendor.gps.aol.enabled", false)) {
         printf("vendor.gps.aol.enabled is false. gps logging is not running.\n");
@@ -85,9 +138,8 @@
     if (access(GPS_VENDOR_CHIP_INFO, F_OK) == 0) {
         copyFile(GPS_VENDOR_CHIP_INFO, concatenatePath(outputDir.c_str(), "chip.info").c_str());
     }
-    dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), maxFileNum, GPS_RAWLOG_PREFIX);
+    dumpLogsAscending(GPS_LOG_DIRECTORY, outputDir.c_str(), 5, GPS_RAWLOG_PREFIX);
     dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), 18, GPS_MEMDUMP_LOG_PREFIX);
     copyDirectory(GPS_RESOURCE_DIRECTORY, concatenatePath(outputDir.c_str(), "resource"));
     return 0;
 }
-