summaryrefslogtreecommitdiff
path: root/aosp/update_attempter_android.cc
diff options
context:
space:
mode:
Diffstat (limited to 'aosp/update_attempter_android.cc')
-rw-r--r--aosp/update_attempter_android.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 56281092..92a0aad1 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -32,6 +32,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/clock.h"
@@ -151,6 +152,7 @@ UpdateAttempterAndroid::UpdateAttempterAndroid(
metrics_reporter_ = metrics::CreateMetricsReporter(
boot_control_->GetDynamicPartitionControl(), &install_plan_);
network_selector_ = network::CreateNetworkSelector();
+ SetTaskProfiles(0, {"OtaProfiles"});
}
UpdateAttempterAndroid::~UpdateAttempterAndroid() {
@@ -578,6 +580,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.";