From d4b763dbd2f76702b7bd54a84db3e05ead1cdf7a Mon Sep 17 00:00:00 2001 From: l30059571 Date: Tue, 8 Apr 2025 19:52:17 +0800 Subject: [PATCH] =?UTF-8?q?FUZZ=E7=94=A8=E4=BE=8B=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30059571 --- BUILD.gn | 3 +++ services/common/src/bundle_active_usage_database.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 09800fb..3ba65c5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -369,6 +369,9 @@ ohos_static_library("usagestatservice_static") { defines += [ "DEVICE_USAGES_STATISTICS_POWERMANGER_ENABLE" ] external_deps += [ "power_manager:powermgr_client" ] } + if (use_libfuzzer) { + defines += [ "DEVICE_USAGES_STATISTICS_TEST_ENABLE" ] + } part_name = "${device_usage_statistics_part_name}" subsystem_name = "resourceschedule" branch_protector_ret = "pac_ret" diff --git a/services/common/src/bundle_active_usage_database.cpp b/services/common/src/bundle_active_usage_database.cpp index b9a33c9..52842ee 100644 --- a/services/common/src/bundle_active_usage_database.cpp +++ b/services/common/src/bundle_active_usage_database.cpp @@ -575,7 +575,11 @@ shared_ptr WEAK_FUNC BundleActiveUsageDatabase::GetBundleAc string currDatabaseFileConfig = BUNDLE_ACTIVE_DATABASE_DIR + databaseFiles_.at(databaseType); RdbStoreConfig config(currDatabaseFileConfig); BundleActiveOpenCallback rdbDataCallBack; +#ifdef DEVICE_USAGES_STATISTICS_TEST_ENABLE + config.SetJournalMode(NativeRdb::JournalMode::MODE_WAL); +#else config.SetJournalMode(NativeRdb::JournalMode::MODE_OFF); +#endif // DEVICE_USAGES_STATISTICS_TEST_ENABLE config.SetSecurityLevel(NativeRdb::SecurityLevel::S1); rdbStore = RdbHelper::GetRdbStore(config, BUNDLE_ACTIVE_RDB_VERSION, rdbDataCallBack, errCode); if ((rdbStore == nullptr)) { -- Gitee