Commit 8d7da5a7 authored by Saurabh Nijhara's avatar Saurabh Nijhara Committed by Commit Bot

Add logging for minimum chrome version policy

MinimumChromeVersionEnforced is a device policy and only applicable to
ChromeOS.

Bug: 1048607
Change-Id: I3dcf88c018b2b16aceb82086996b121f60a1b28b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2279882
Commit-Queue: Saurabh Nijhara <snijhara@google.com>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786552}
parent 532f87d2
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ash/public/cpp/login_screen.h" #include "ash/public/cpp/login_screen.h"
#include "ash/public/cpp/system_tray.h" #include "ash/public/cpp/system_tray.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h"
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/browser_process_platform_part.h"
...@@ -267,12 +268,14 @@ void UpdateRequiredScreen::OnUpdateButtonClicked() { ...@@ -267,12 +268,14 @@ void UpdateRequiredScreen::OnUpdateButtonClicked() {
} }
void UpdateRequiredScreen::OnWaitForRebootTimeElapsed() { void UpdateRequiredScreen::OnWaitForRebootTimeElapsed() {
LOG(ERROR) << "Unable to reboot - asking for a manual reboot.";
EnsureScreenIsShown(); EnsureScreenIsShown();
if (view_) if (view_)
view_->SetUIState(UpdateRequiredView::UPDATE_COMPLETED_NEED_REBOOT); view_->SetUIState(UpdateRequiredView::UPDATE_COMPLETED_NEED_REBOOT);
} }
void UpdateRequiredScreen::PrepareForUpdateCheck() { void UpdateRequiredScreen::PrepareForUpdateCheck() {
VLOG(1) << "Update check started.";
error_message_timer_.Stop(); error_message_timer_.Stop();
error_screen_->HideCaptivePortal(); error_screen_->HideCaptivePortal();
...@@ -338,6 +341,7 @@ void UpdateRequiredScreen::UpdateInfoChanged( ...@@ -338,6 +341,7 @@ void UpdateRequiredScreen::UpdateInfoChanged(
EnsureScreenIsShown(); EnsureScreenIsShown();
break; break;
case update_engine::Operation::NEED_PERMISSION_TO_UPDATE: case update_engine::Operation::NEED_PERMISSION_TO_UPDATE:
VLOG(1) << "Need permission to update.";
EnsureScreenIsShown(); EnsureScreenIsShown();
if (metered_network_update_permission) { if (metered_network_update_permission) {
version_updater_->SetUpdateOverCellularOneTimePermission(); version_updater_->SetUpdateOverCellularOneTimePermission();
...@@ -345,12 +349,14 @@ void UpdateRequiredScreen::UpdateInfoChanged( ...@@ -345,12 +349,14 @@ void UpdateRequiredScreen::UpdateInfoChanged(
} }
break; break;
case update_engine::Operation::UPDATED_NEED_REBOOT: case update_engine::Operation::UPDATED_NEED_REBOOT:
VLOG(1) << "Update completed successfully.";
EnsureScreenIsShown(); EnsureScreenIsShown();
waiting_for_reboot_ = true; waiting_for_reboot_ = true;
version_updater_->RebootAfterUpdate(); version_updater_->RebootAfterUpdate();
break; break;
case update_engine::Operation::ERROR: case update_engine::Operation::ERROR:
case update_engine::Operation::REPORTING_ERROR_EVENT: case update_engine::Operation::REPORTING_ERROR_EVENT:
LOG(ERROR) << "Exiting update due to error.";
version_updater_->StartExitUpdate(VersionUpdater::Result::UPDATE_ERROR); version_updater_->StartExitUpdate(VersionUpdater::Result::UPDATE_ERROR);
break; break;
default: default:
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/public/cpp/system_tray.h" #include "ash/public/cpp/system_tray.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -207,8 +208,11 @@ void MinimumVersionPolicyHandler::OnPolicyChanged() { ...@@ -207,8 +208,11 @@ void MinimumVersionPolicyHandler::OnPolicyChanged() {
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
if (status != chromeos::CrosSettingsProvider::TRUSTED || if (status != chromeos::CrosSettingsProvider::TRUSTED ||
!IsPolicyApplicable() || !IsPolicyApplicable() ||
!chromeos::features::IsMinimumChromeVersionEnabled()) !chromeos::features::IsMinimumChromeVersionEnabled()) {
VLOG(1) << "Ignore policy change - policy is not applicable or settings "
"are not trusted.";
return; return;
}
const base::ListValue* entries; const base::ListValue* entries;
std::vector<std::unique_ptr<MinimumVersionRequirement>> configs; std::vector<std::unique_ptr<MinimumVersionRequirement>> configs;
...@@ -266,6 +270,7 @@ void MinimumVersionPolicyHandler::OnPolicyChanged() { ...@@ -266,6 +270,7 @@ void MinimumVersionPolicyHandler::OnPolicyChanged() {
} }
void MinimumVersionPolicyHandler::HandleUpdateNotRequired() { void MinimumVersionPolicyHandler::HandleUpdateNotRequired() {
VLOG(2) << "Update is not required.";
// Reset the state including any running timers. // Reset the state including any running timers.
Reset(); Reset();
// Hide update required screen if it is visible and switch back to the login // Hide update required screen if it is visible and switch back to the login
...@@ -343,6 +348,10 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired( ...@@ -343,6 +348,10 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired(
update_required_deadline_ = update_required_deadline_ =
stored_timer_start_time + std::max(stored_warning_time, warning_time); stored_timer_start_time + std::max(stored_warning_time, warning_time);
} }
VLOG(1) << "Update is required with "
<< "update required time " << update_required_time_
<< " warning time " << warning_time
<< " and update required deadline " << update_required_deadline_;
const bool deadline_reached = const bool deadline_reached =
update_required_deadline_ <= update_required_time_; update_required_deadline_ <= update_required_time_;
...@@ -361,6 +370,7 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired( ...@@ -361,6 +370,7 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired(
if (update_required_deadline_timer_.IsRunning() && if (update_required_deadline_timer_.IsRunning() &&
update_required_deadline_timer_.desired_run_time() == update_required_deadline_timer_.desired_run_time() ==
update_required_deadline_) { update_required_deadline_) {
DLOG(WARNING) << "Deadline is same as previous and timer is running.";
return; return;
} }
...@@ -383,6 +393,7 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired( ...@@ -383,6 +393,7 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired(
// reboot to apply it. // reboot to apply it.
if (GetBuildState()->update_type() == BuildState::UpdateType::kNormalUpdate) { if (GetBuildState()->update_type() == BuildState::UpdateType::kNormalUpdate) {
OverrideRelaunchNotification(update_required_deadline_); OverrideRelaunchNotification(update_required_deadline_);
DLOG(WARNING) << "Update is already installed.";
return; return;
} }
...@@ -459,14 +470,17 @@ void MinimumVersionPolicyHandler::MaybeShowNotification( ...@@ -459,14 +470,17 @@ void MinimumVersionPolicyHandler::MaybeShowNotification(
base::BindOnce(&MinimumVersionPolicyHandler::StopObservingNetwork, base::BindOnce(&MinimumVersionPolicyHandler::StopObservingNetwork,
weak_factory_.GetWeakPtr()); weak_factory_.GetWeakPtr());
if (eol_reached_) { if (eol_reached_) {
VLOG(2) << "Showing end of life notification.";
type = NotificationType::kEolReached; type = NotificationType::kEolReached;
button_click_callback = base::BindOnce(&OpenEnterpriseInfoPage); button_click_callback = base::BindOnce(&OpenEnterpriseInfoPage);
} else if (status == NetworkStatus::kMetered) { } else if (status == NetworkStatus::kMetered) {
VLOG(2) << "Showing metered network notification.";
type = NotificationType::kMeteredConnection; type = NotificationType::kMeteredConnection;
button_click_callback = base::BindOnce( button_click_callback = base::BindOnce(
&MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted, &MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted,
weak_factory_.GetWeakPtr()); weak_factory_.GetWeakPtr());
} else if (status == NetworkStatus::kOffline) { } else if (status == NetworkStatus::kOffline) {
VLOG(2) << "Showing no network notification.";
button_click_callback = base::BindOnce(&OpenNetworkSettings); button_click_callback = base::BindOnce(&OpenNetworkSettings);
} else { } else {
NOTREACHED(); NOTREACHED();
...@@ -505,6 +519,7 @@ void MinimumVersionPolicyHandler::ShowAndScheduleNotification( ...@@ -505,6 +519,7 @@ void MinimumVersionPolicyHandler::ShowAndScheduleNotification(
expiry = deadline - base::TimeDelta::FromDays(1); expiry = deadline - base::TimeDelta::FromDays(1);
} }
VLOG(2) << "Next notification scheduled for " << expiry;
MaybeShowNotification(base::TimeDelta::FromDays(days_remaining)); MaybeShowNotification(base::TimeDelta::FromDays(days_remaining));
if (!expiry.is_null()) { if (!expiry.is_null()) {
notification_timer_.Start( notification_timer_.Start(
...@@ -518,6 +533,8 @@ void MinimumVersionPolicyHandler::ShowAndScheduleNotification( ...@@ -518,6 +533,8 @@ void MinimumVersionPolicyHandler::ShowAndScheduleNotification(
void MinimumVersionPolicyHandler::OnUpdate(const BuildState* build_state) { void MinimumVersionPolicyHandler::OnUpdate(const BuildState* build_state) {
// If the device has been successfully updated, the relaunch notifications // If the device has been successfully updated, the relaunch notifications
// will reboot it for applying the updates. // will reboot it for applying the updates.
VLOG(1) << "Update installed successfully at " << clock_->Now()
<< " with deadline " << update_required_deadline_;
GetUpdateEngineClient()->RemoveObserver(this); GetUpdateEngineClient()->RemoveObserver(this);
if (build_state->update_type() == BuildState::UpdateType::kNormalUpdate) { if (build_state->update_type() == BuildState::UpdateType::kNormalUpdate) {
ResetOnUpdateCompleted(); ResetOnUpdateCompleted();
...@@ -548,6 +565,7 @@ void MinimumVersionPolicyHandler::StopObservingNetwork() { ...@@ -548,6 +565,7 @@ void MinimumVersionPolicyHandler::StopObservingNetwork() {
} }
void MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted() { void MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted() {
VLOG(1) << "Permission for update over metered network granted.";
chromeos::UpdateEngineClient* const update_engine_client = chromeos::UpdateEngineClient* const update_engine_client =
GetUpdateEngineClient(); GetUpdateEngineClient();
if (!update_engine_client->HasObserver(this)) if (!update_engine_client->HasObserver(this))
...@@ -559,6 +577,7 @@ void MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted() { ...@@ -559,6 +577,7 @@ void MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted() {
void MinimumVersionPolicyHandler::OnUpdateCheckStarted( void MinimumVersionPolicyHandler::OnUpdateCheckStarted(
chromeos::UpdateEngineClient::UpdateCheckResult result) { chromeos::UpdateEngineClient::UpdateCheckResult result) {
VLOG(1) << "Update check started.";
if (result != chromeos::UpdateEngineClient::UPDATE_RESULT_SUCCESS) if (result != chromeos::UpdateEngineClient::UPDATE_RESULT_SUCCESS)
GetUpdateEngineClient()->RemoveObserver(this); GetUpdateEngineClient()->RemoveObserver(this);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment