1 // 2 // Copyright (C) 2017 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #include "update_engine/update_manager/interactive_update_policy_impl.h" 18 19 namespace chromeos_update_manager { 20 21 // Check to see if an interactive update was requested. 22 EvalStatus InteractiveUpdatePolicyImpl::UpdateCheckAllowed( 23 EvaluationContext* ec, 24 State* state, 25 std::string* error, 26 UpdateCheckParams* result) const { 27 UpdaterProvider* const updater_provider = state->updater_provider(); 28 29 // First, check to see if an interactive update was requested. 30 const UpdateRequestStatus* forced_update_requested_p = 31 ec->GetValue(updater_provider->var_forced_update_requested()); 32 if (forced_update_requested_p != nullptr && 33 *forced_update_requested_p != UpdateRequestStatus::kNone) { 34 result->is_interactive = 35 (*forced_update_requested_p == UpdateRequestStatus::kInteractive); 36 LOG(INFO) << "Forced update signaled (" 37 << (result->is_interactive ? "interactive" : "periodic") 38 << "), allowing update check."; 39 return EvalStatus::kSucceeded; 40 } 41 return EvalStatus::kContinue; 42 } 43 44 } // namespace chromeos_update_manager 45