Skip to content

Commit

Permalink
[M109] arc: Handle not-finding the task info
Browse files Browse the repository at this point in the history
This adds check that task info might not be resolved. This is urgent
fix. Proper fix might need to return bool to indicate real situation.

BUG=b:248144270
BUG=b:264957109
TEST=Locally

(cherry picked from commit 94394d6)

Change-Id: Ib5d95d79e19dff011d09e17c2c7e698b2a9b6257
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4152856
Reviewed-by: Muhammad Hasan Khan <mhasank@chromium.org>
Reviewed-by: Satoshi Niwa <niwa@chromium.org>
Commit-Queue: Yury Khmel <khmel@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1091373}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4177415
Auto-Submit: Yury Khmel <khmel@chromium.org>
Commit-Queue: Satoshi Niwa <niwa@chromium.org>
Cr-Commit-Position: refs/branch-heads/5414@{#1413}
Cr-Branched-From: 4417ee5-refs/heads/main@{#1070088}
  • Loading branch information
Yury Khmel authored and Chromium LUCI CQ committed Jan 19, 2023
1 parent c0379eb commit ff640f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chrome/browser/ash/game_mode/game_mode_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ class ArcGameModeCriteria : public GameModeController::GameModeCriteria {
connection_ = ArcAppListPrefs::Get(profile)->app_connection_holder();
auto* app_instance = ARC_GET_INSTANCE_FOR_METHOD(connection_, GetTaskInfo);
if (!app_instance) {
LOG(ERROR) << "GetTaskInfo method for ARC is not available";
return;
}

VLOG(2) << "Getting package name for ARC task: " << task_id;
app_instance->GetTaskInfo(
task_id, base::BindOnce(&ArcGameModeCriteria::OnReceiveTaskInfo,
Expand All @@ -76,6 +74,11 @@ class ArcGameModeCriteria : public GameModeController::GameModeCriteria {

void OnReceiveTaskInfo(const std::string& pkg_name,
const std::string& activity) {
if (pkg_name.empty()) {
LOG(ERROR) << "Failed to find package name for the requested task";
return;
}

if (IsKnownGame(pkg_name)) {
VLOG(2) << "ARC task package " << pkg_name << " is known game";
Enable();
Expand Down

0 comments on commit ff640f6

Please sign in to comment.