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 @@
#include "ash/public/cpp/login_screen.h"
#include "ash/public/cpp/system_tray.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/time/default_clock.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
......@@ -267,12 +268,14 @@ void UpdateRequiredScreen::OnUpdateButtonClicked() {
}
void UpdateRequiredScreen::OnWaitForRebootTimeElapsed() {
LOG(ERROR) << "Unable to reboot - asking for a manual reboot.";
EnsureScreenIsShown();
if (view_)
view_->SetUIState(UpdateRequiredView::UPDATE_COMPLETED_NEED_REBOOT);
}
void UpdateRequiredScreen::PrepareForUpdateCheck() {
VLOG(1) << "Update check started.";
error_message_timer_.Stop();
error_screen_->HideCaptivePortal();
......@@ -338,6 +341,7 @@ void UpdateRequiredScreen::UpdateInfoChanged(
EnsureScreenIsShown();
break;
case update_engine::Operation::NEED_PERMISSION_TO_UPDATE:
VLOG(1) << "Need permission to update.";
EnsureScreenIsShown();
if (metered_network_update_permission) {
version_updater_->SetUpdateOverCellularOneTimePermission();
......@@ -345,12 +349,14 @@ void UpdateRequiredScreen::UpdateInfoChanged(
}
break;
case update_engine::Operation::UPDATED_NEED_REBOOT:
VLOG(1) << "Update completed successfully.";
EnsureScreenIsShown();
waiting_for_reboot_ = true;
version_updater_->RebootAfterUpdate();
break;
case update_engine::Operation::ERROR:
case update_engine::Operation::REPORTING_ERROR_EVENT:
LOG(ERROR) << "Exiting update due to error.";
version_updater_->StartExitUpdate(VersionUpdater::Result::UPDATE_ERROR);
break;
default:
......
......@@ -8,6 +8,7 @@
#include "ash/public/cpp/system_tray.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
......@@ -207,8 +208,11 @@ void MinimumVersionPolicyHandler::OnPolicyChanged() {
weak_factory_.GetWeakPtr()));
if (status != chromeos::CrosSettingsProvider::TRUSTED ||
!IsPolicyApplicable() ||
!chromeos::features::IsMinimumChromeVersionEnabled())
!chromeos::features::IsMinimumChromeVersionEnabled()) {
VLOG(1) << "Ignore policy change - policy is not applicable or settings "
"are not trusted.";
return;
}
const base::ListValue* entries;
std::vector<std::unique_ptr<MinimumVersionRequirement>> configs;
......@@ -266,6 +270,7 @@ void MinimumVersionPolicyHandler::OnPolicyChanged() {
}
void MinimumVersionPolicyHandler::HandleUpdateNotRequired() {
VLOG(2) << "Update is not required.";
// Reset the state including any running timers.
Reset();
// Hide update required screen if it is visible and switch back to the login
......@@ -343,6 +348,10 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired(
update_required_deadline_ =
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 =
update_required_deadline_ <= update_required_time_;
......@@ -361,6 +370,7 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired(
if (update_required_deadline_timer_.IsRunning() &&
update_required_deadline_timer_.desired_run_time() ==
update_required_deadline_) {
DLOG(WARNING) << "Deadline is same as previous and timer is running.";
return;
}
......@@ -383,6 +393,7 @@ void MinimumVersionPolicyHandler::HandleUpdateRequired(
// reboot to apply it.
if (GetBuildState()->update_type() == BuildState::UpdateType::kNormalUpdate) {
OverrideRelaunchNotification(update_required_deadline_);
DLOG(WARNING) << "Update is already installed.";
return;
}
......@@ -459,14 +470,17 @@ void MinimumVersionPolicyHandler::MaybeShowNotification(
base::BindOnce(&MinimumVersionPolicyHandler::StopObservingNetwork,
weak_factory_.GetWeakPtr());
if (eol_reached_) {
VLOG(2) << "Showing end of life notification.";
type = NotificationType::kEolReached;
button_click_callback = base::BindOnce(&OpenEnterpriseInfoPage);
} else if (status == NetworkStatus::kMetered) {
VLOG(2) << "Showing metered network notification.";
type = NotificationType::kMeteredConnection;
button_click_callback = base::BindOnce(
&MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted,
weak_factory_.GetWeakPtr());
} else if (status == NetworkStatus::kOffline) {
VLOG(2) << "Showing no network notification.";
button_click_callback = base::BindOnce(&OpenNetworkSettings);
} else {
NOTREACHED();
......@@ -505,6 +519,7 @@ void MinimumVersionPolicyHandler::ShowAndScheduleNotification(
expiry = deadline - base::TimeDelta::FromDays(1);
}
VLOG(2) << "Next notification scheduled for " << expiry;
MaybeShowNotification(base::TimeDelta::FromDays(days_remaining));
if (!expiry.is_null()) {
notification_timer_.Start(
......@@ -518,6 +533,8 @@ void MinimumVersionPolicyHandler::ShowAndScheduleNotification(
void MinimumVersionPolicyHandler::OnUpdate(const BuildState* build_state) {
// If the device has been successfully updated, the relaunch notifications
// will reboot it for applying the updates.
VLOG(1) << "Update installed successfully at " << clock_->Now()
<< " with deadline " << update_required_deadline_;
GetUpdateEngineClient()->RemoveObserver(this);
if (build_state->update_type() == BuildState::UpdateType::kNormalUpdate) {
ResetOnUpdateCompleted();
......@@ -548,6 +565,7 @@ void MinimumVersionPolicyHandler::StopObservingNetwork() {
}
void MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted() {
VLOG(1) << "Permission for update over metered network granted.";
chromeos::UpdateEngineClient* const update_engine_client =
GetUpdateEngineClient();
if (!update_engine_client->HasObserver(this))
......@@ -559,6 +577,7 @@ void MinimumVersionPolicyHandler::UpdateOverMeteredPermssionGranted() {
void MinimumVersionPolicyHandler::OnUpdateCheckStarted(
chromeos::UpdateEngineClient::UpdateCheckResult result) {
VLOG(1) << "Update check started.";
if (result != chromeos::UpdateEngineClient::UPDATE_RESULT_SUCCESS)
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