Commit 4d40bc76 authored by Pilar Molina Lopez's avatar Pilar Molina Lopez Committed by Chromium LUCI CQ

Lacros: add logs with info about why lacros-chrome did not launch

Add log warning messages when lacros-chrome didn't launch because:
- The session is not yet active (for instance when using
  "Browse as a Guest")
- The current user is not allowed
- Lacros is not supported or allowed

Bug: None
Change-Id: I06a60daace575a32b46662be36c5ae824a4ea744
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583622
Commit-Queue: Pilar Molina Lopez <pmolinalopez@google.com>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836175}
parent 3bdb9041
...@@ -445,8 +445,12 @@ void BrowserManager::OnSessionStateChanged() { ...@@ -445,8 +445,12 @@ void BrowserManager::OnSessionStateChanged() {
// Wait for session to become active. // Wait for session to become active.
auto* session_manager = session_manager::SessionManager::Get(); auto* session_manager = session_manager::SessionManager::Get();
if (session_manager->session_state() != session_manager::SessionState::ACTIVE) if (session_manager->session_state() !=
session_manager::SessionState::ACTIVE) {
LOG(WARNING)
<< "Session not yet active. Lacros-chrome will not be launched yet";
return; return;
}
// Ensure this isn't run multiple times. // Ensure this isn't run multiple times.
session_manager::SessionManager::Get()->RemoveObserver(this); session_manager::SessionManager::Get()->RemoveObserver(this);
......
...@@ -126,23 +126,32 @@ bool IsLacrosEnabled() { ...@@ -126,23 +126,32 @@ bool IsLacrosEnabled() {
} }
bool IsLacrosEnabled(Channel channel) { bool IsLacrosEnabled(Channel channel) {
if (!base::FeatureList::IsEnabled(chromeos::features::kLacrosSupport)) if (!base::FeatureList::IsEnabled(chromeos::features::kLacrosSupport)) {
LOG(WARNING) << "Lacros-chrome is not supported";
return false; return false;
}
const User* user = user_manager::UserManager::Get()->GetPrimaryUser(); const User* user = user_manager::UserManager::Get()->GetPrimaryUser();
if (!user) if (!user) {
LOG(WARNING)
<< "Unable to get primary user. Lacros-chrome will be disabled";
return false; return false;
}
if (!IsUserTypeAllowed(user)) if (!IsUserTypeAllowed(user)) {
LOG(WARNING) << "Current user type not allowed to launch lacros-chrome";
return false; return false;
}
// TODO(https://crbug.com/1135494): Remove the free ticket for // TODO(https://crbug.com/1135494): Remove the free ticket for
// Channel::UNKNOWN after the policy is set on server side for developers. // Channel::UNKNOWN after the policy is set on server side for developers.
if (channel == Channel::UNKNOWN) if (channel == Channel::UNKNOWN)
return true; return true;
if (!g_browser_process->local_state()->GetBoolean(prefs::kLacrosAllowed)) if (!g_browser_process->local_state()->GetBoolean(prefs::kLacrosAllowed)) {
LOG(WARNING) << "Lacros-chrome is not allowed by policy";
return false; return false;
}
switch (channel) { switch (channel) {
case Channel::UNKNOWN: case Channel::UNKNOWN:
......
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