diff options
-rw-r--r-- | libjsonpb/verify/verify.cpp | 2 | ||||
-rw-r--r-- | profcollectd/libprofcollectd/config.rs | 2 | ||||
-rw-r--r-- | profcollectd/libprofcollectd/service.rs | 14 |
3 files changed, 14 insertions, 4 deletions
diff --git a/libjsonpb/verify/verify.cpp b/libjsonpb/verify/verify.cpp index d3e986dd..a4767502 100644 --- a/libjsonpb/verify/verify.cpp +++ b/libjsonpb/verify/verify.cpp @@ -137,7 +137,6 @@ bool AllFieldsAreKnown(const google::protobuf::Message& message, const std::stri std::string* error) { Json::CharReaderBuilder builder; std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); - std::string errorMessage; Json::Value value; if (!reader->parse(&*json.begin(), &*json.end(), &value, error)) { return false; @@ -157,7 +156,6 @@ bool EqReformattedJson(const std::string& json, google::protobuf::Message* scrat Json::CharReaderBuilder builder; std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); Json::Value old_json; - std::string errorMessage; if (!reader->parse(&*json.begin(), &*json.end(), &old_json, error)) { return false; } diff --git a/profcollectd/libprofcollectd/config.rs b/profcollectd/libprofcollectd/config.rs index e9a1d288..e72fa47a 100644 --- a/profcollectd/libprofcollectd/config.rs +++ b/profcollectd/libprofcollectd/config.rs @@ -30,6 +30,8 @@ lazy_static! { pub static ref TRACE_OUTPUT_DIR: &'static Path = Path::new("/data/misc/profcollectd/trace/"); pub static ref PROFILE_OUTPUT_DIR: &'static Path = Path::new("/data/misc/profcollectd/output/"); pub static ref REPORT_OUTPUT_DIR: &'static Path = Path::new("/data/misc/profcollectd/report/"); + pub static ref OLD_REPORT_OUTPUT_FILE: &'static Path = + Path::new("/data/misc/profcollectd/report.zip"); pub static ref CONFIG_FILE: &'static Path = Path::new("/data/misc/profcollectd/output/config.json"); } diff --git a/profcollectd/libprofcollectd/service.rs b/profcollectd/libprofcollectd/service.rs index c01b8492..d3413b84 100644 --- a/profcollectd/libprofcollectd/service.rs +++ b/profcollectd/libprofcollectd/service.rs @@ -21,13 +21,16 @@ use binder::public_api::Result as BinderResult; use binder::Status; use profcollectd_aidl_interface::aidl::com::android::server::profcollect::IProfCollectd::IProfCollectd; use std::ffi::CString; -use std::fs::{create_dir, read_to_string, remove_dir_all, write}; +use std::fs::{create_dir, read_to_string, remove_dir_all, remove_file, write}; use std::{ str::FromStr, sync::{Mutex, MutexGuard}, }; -use crate::config::{Config, CONFIG_FILE, PROFILE_OUTPUT_DIR, REPORT_OUTPUT_DIR, TRACE_OUTPUT_DIR}; +use crate::config::{ + Config, CONFIG_FILE, OLD_REPORT_OUTPUT_FILE, PROFILE_OUTPUT_DIR, REPORT_OUTPUT_DIR, + TRACE_OUTPUT_DIR, +}; use crate::report::pack_report; use crate::scheduler::Scheduler; @@ -104,6 +107,13 @@ impl ProfcollectdBinderService { remove_dir_all(*TRACE_OUTPUT_DIR)?; create_dir(*PROFILE_OUTPUT_DIR)?; create_dir(*TRACE_OUTPUT_DIR)?; + + // Remove the report file in the old output location. + // TODO: Remove this after all devices have updated to the new profcollect. + if OLD_REPORT_OUTPUT_FILE.exists() { + remove_file(*OLD_REPORT_OUTPUT_FILE)?; + } + write(*CONFIG_FILE, &new_config.to_string())?; } |