Snap for 12508860 from 2c8ec7ea44 to 25Q1-release

Change-Id: I297e370918e1d80d51df1697dae68e728c96d206
This commit is contained in:
Android Build Coastguard Worker 2024-10-16 23:02:59 +00:00
commit 56225106db
2 changed files with 43 additions and 3 deletions

View file

@ -13,13 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <unistd.h>
#include <dump/pixel_dump.h>
#include <android-base/properties.h>
#include <android-base/file.h>
#include <android-base/properties.h>
#include <dirent.h>
#include <dump/pixel_dump.h>
#include <sys/stat.h>
#include <unistd.h>
#define GPS_LOG_NUMBER_PROPERTY "persist.vendor.gps.aol.log_num"
#define GPS_LOG_DIRECTORY "/data/vendor/gps/logs"
#define GPS_RESOURCE_DIRECTORY "/data/vendor/gps/resource"
#define GPS_TMP_LOG_DIRECTORY "/data/vendor/gps/logs/.tmp"
#define GPS_LOG_PREFIX "gl-"
#define GPS_MCU_LOG_PREFIX "esw-"
@ -29,6 +32,40 @@
#define GPS_RAWLOG_PREFIX "rawbin"
#define GPS_MEMDUMP_LOG_PREFIX "memdump_"
static void copyDirectory(const std::string &source,
const std::string &outputDir) {
DIR *dir = opendir(source.c_str());
if (dir == nullptr) {
return;
}
if (mkdir(outputDir.c_str(), 0777) == -1) {
closedir(dir);
return;
}
struct dirent *entry;
while ((entry = readdir(dir)) != nullptr) {
std::string entryName = entry->d_name;
if (entryName == "." || entryName == "..") {
continue;
}
std::string sourcePath = source + "/" + entryName;
std::string destPath = outputDir + "/" + entryName;
struct stat st;
if (stat(sourcePath.c_str(), &st) == 0) {
if (S_ISDIR(st.st_mode))
copyDirectory(sourcePath, destPath);
else
copyFile(sourcePath.c_str(), destPath.c_str());
}
}
closedir(dir);
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");
@ -50,6 +87,7 @@ int main() {
}
dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), maxFileNum, 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;
}

View file

@ -0,0 +1,2 @@
# Support SW_LID event from SensorHAL to configure touch input and gesture
set_prop(hal_sensors_default, vendor_gti_prop)