diff options
Diffstat (limited to 'aosp')
-rw-r--r-- | aosp/binder_service_android.cc | 7 | ||||
-rw-r--r-- | aosp/binder_service_android.h | 1 | ||||
-rw-r--r-- | aosp/service_delegate_android_interface.h | 2 | ||||
-rw-r--r-- | aosp/update_attempter_android.cc | 19 | ||||
-rw-r--r-- | aosp/update_attempter_android.h | 4 | ||||
-rw-r--r-- | aosp/update_engine_client_android.cc | 5 |
6 files changed, 38 insertions, 0 deletions
diff --git a/aosp/binder_service_android.cc b/aosp/binder_service_android.cc index 84b5b7a9..c2231fb0 100644 --- a/aosp/binder_service_android.cc +++ b/aosp/binder_service_android.cc @@ -258,4 +258,11 @@ Status BinderUpdateEngineAndroidService::cleanupSuccessfulUpdate( return Status::ok(); } +Status BinderUpdateEngineAndroidService::setPerformanceMode(bool enable) { + brillo::ErrorPtr error; + if (!service_delegate_->SetPerformanceMode(enable, &error)) + return ErrorPtrToStatus(error); + return Status::ok(); +} + } // namespace chromeos_update_engine diff --git a/aosp/binder_service_android.h b/aosp/binder_service_android.h index f1ce6b5d..6bd1ee3c 100644 --- a/aosp/binder_service_android.h +++ b/aosp/binder_service_android.h @@ -79,6 +79,7 @@ class BinderUpdateEngineAndroidService : public android::os::BnUpdateEngine, int64_t* return_value) override; android::binder::Status cleanupSuccessfulUpdate( const android::sp<android::os::IUpdateEngineCallback>& callback) override; + android::binder::Status setPerformanceMode(bool enable) override; private: // Remove the passed |callback| from the list of registered callbacks. Called diff --git a/aosp/service_delegate_android_interface.h b/aosp/service_delegate_android_interface.h index b3660ab3..b50f0f93 100644 --- a/aosp/service_delegate_android_interface.h +++ b/aosp/service_delegate_android_interface.h @@ -129,6 +129,8 @@ class ServiceDelegateAndroidInterface { std::unique_ptr<CleanupSuccessfulUpdateCallbackInterface> callback, brillo::ErrorPtr* error) = 0; + virtual bool SetPerformanceMode(bool enable, brillo::ErrorPtr* error) = 0; + protected: ServiceDelegateAndroidInterface() = default; }; diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc index 1d35b5e7..b02e6007 100644 --- a/aosp/update_attempter_android.cc +++ b/aosp/update_attempter_android.cc @@ -31,6 +31,7 @@ #include <brillo/message_loops/message_loop.h> #include <brillo/strings/string_utils.h> #include <log/log_safetynet.h> +#include <processgroup/processgroup.h> #include "update_engine/aosp/cleanup_previous_update_action.h" #include "update_engine/common/constants.h" @@ -145,6 +146,7 @@ UpdateAttempterAndroid::UpdateAttempterAndroid( metrics_reporter_ = metrics::CreateMetricsReporter( boot_control_->GetDynamicPartitionControl(), &install_plan_); network_selector_ = network::CreateNetworkSelector(); + SetTaskProfiles(0, {"OtaProfiles"}); } UpdateAttempterAndroid::~UpdateAttempterAndroid() { @@ -560,6 +562,23 @@ bool UpdateAttempterAndroid::VerifyPayloadApplicable( return true; } +bool UpdateAttempterAndroid::SetPerformanceMode(bool enable, + brillo::ErrorPtr* error) { + LOG(INFO) << (enable ? "Enabling" : "Disabling") << " performance mode."; + + if (performance_mode_ == enable) + return true; + bool ret; + if (enable) + ret = SetTaskProfiles(0, {"ProcessCapacityMax", "HighIoPriority", "MaxPerformance"}); + else + ret = SetTaskProfiles(0, {"OtaProfiles"}); + if (!ret) + return LogAndSetError(error, FROM_HERE, "Could not change profiles"); + performance_mode_ = enable; + return true; +} + void UpdateAttempterAndroid::ProcessingDone(const ActionProcessor* processor, ErrorCode code) { LOG(INFO) << "Processing Done."; diff --git a/aosp/update_attempter_android.h b/aosp/update_attempter_android.h index 5d832e0a..4c5c70b7 100644 --- a/aosp/update_attempter_android.h +++ b/aosp/update_attempter_android.h @@ -100,6 +100,8 @@ class UpdateAttempterAndroid brillo::ErrorPtr* error) override; bool resetShouldSwitchSlotOnReboot(brillo::ErrorPtr* error) override; + bool SetPerformanceMode(bool enable, brillo::ErrorPtr* error) override; + // ActionProcessorDelegate methods: void ProcessingDone(const ActionProcessor* processor, ErrorCode code) override; @@ -282,6 +284,8 @@ class UpdateAttempterAndroid // The path to the zip file with X509 certificates. std::string update_certificates_path_{constants::kUpdateCertificatesPath}; + bool performance_mode_ = false; + DISALLOW_COPY_AND_ASSIGN(UpdateAttempterAndroid); }; diff --git a/aosp/update_engine_client_android.cc b/aosp/update_engine_client_android.cc index c00e9f58..a3504099 100644 --- a/aosp/update_engine_client_android.cc +++ b/aosp/update_engine_client_android.cc @@ -169,6 +169,7 @@ int UpdateEngineClientAndroid::OnInit() { false, "Wait for previous update to merge. " "Only available after rebooting to new slot."); + DEFINE_bool(perf_mode, false, "Enable perf mode."); // Boilerplate init commands. base::CommandLine::Init(argc_, argv_); brillo::FlagHelper::Init(argc_, argv_, "Android Update Engine Client"); @@ -292,6 +293,10 @@ int UpdateEngineClientAndroid::OnInit() { keep_running = true; } + if (FLAGS_perf_mode) { + return ExitWhenIdle(service_->setPerformanceMode(true)); + } + if (FLAGS_update) { auto and_headers = ParseHeaders(FLAGS_headers); Status status = service_->applyPayload( |