Commit 4b8789e7 authored by nancy's avatar nancy Committed by Commit Bot

Reorder the shelf id checking.

The ARC app shelf id could have prefix "shelf_group:", and AppService
can't find the app type for that shelf id, so check ARC app shelf id
first before checking from AppService record.

Update ARC tracker to use the app shelf id as the app id and checking
the profile when getting the ARC shelf id to resolve the unit test
failed issue and user switch crash issue due to the above change..

BUG=1011235

Change-Id: I817f059bb0cf65dc89a458b6b2bdf78ab22afc19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984783Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728038}
parent b04878b2
...@@ -201,7 +201,8 @@ void AppServiceAppWindowArcTracker::OnTaskCreated( ...@@ -201,7 +201,8 @@ void AppServiceAppWindowArcTracker::OnTaskCreated(
state = static_cast<apps::InstanceState>( state = static_cast<apps::InstanceState>(
state | apps::InstanceState::kStarted | apps::InstanceState::kRunning); state | apps::InstanceState::kStarted | apps::InstanceState::kRunning);
app_service_controller_->app_service_instance_helper()->OnInstances( app_service_controller_->app_service_instance_helper()->OnInstances(
arc_app_id, window, std::string(), state); task_id_to_arc_app_window_info_[task_id]->app_shelf_id().ToString(),
window, std::string(), state);
} }
void AppServiceAppWindowArcTracker::OnTaskDescriptionUpdated( void AppServiceAppWindowArcTracker::OnTaskDescriptionUpdated(
...@@ -384,6 +385,9 @@ void AppServiceAppWindowArcTracker::OnItemDelegateDiscarded( ...@@ -384,6 +385,9 @@ void AppServiceAppWindowArcTracker::OnItemDelegateDiscarded(
} }
ash::ShelfID AppServiceAppWindowArcTracker::GetShelfId(int task_id) const { ash::ShelfID AppServiceAppWindowArcTracker::GetShelfId(int task_id) const {
if (observed_profile_ != app_service_controller_->owner()->profile())
return ash::ShelfID();
const auto it = task_id_to_arc_app_window_info_.find(task_id); const auto it = task_id_to_arc_app_window_info_.find(task_id);
if (it == task_id_to_arc_app_window_info_.end()) if (it == task_id_to_arc_app_window_info_.end())
return ash::ShelfID(); return ash::ShelfID();
......
...@@ -520,7 +520,15 @@ ash::ShelfID AppServiceAppWindowLauncherController::GetShelfId( ...@@ -520,7 +520,15 @@ ash::ShelfID AppServiceAppWindowLauncherController::GetShelfId(
return ash::ShelfID(shelf_app_id); return ash::ShelfID(shelf_app_id);
} }
if (plugin_vm::IsPluginVmWindow(window))
return ash::ShelfID(plugin_vm::kPluginVmAppId);
ash::ShelfID shelf_id; ash::ShelfID shelf_id;
if (arc_tracker_)
shelf_id = arc_tracker_->GetShelfId(arc::GetWindowTaskId(window));
if (!shelf_id.IsNull())
return shelf_id;
// If the window exists in InstanceRegistry, get the shelf id from // If the window exists in InstanceRegistry, get the shelf id from
// InstanceRegistry. // InstanceRegistry.
...@@ -564,13 +572,6 @@ ash::ShelfID AppServiceAppWindowLauncherController::GetShelfId( ...@@ -564,13 +572,6 @@ ash::ShelfID AppServiceAppWindowLauncherController::GetShelfId(
} }
} }
// For null shelf id, it could be VM window or ARC apps window.
if (plugin_vm::IsPluginVmWindow(window))
return ash::ShelfID(plugin_vm::kPluginVmAppId);
if (arc_tracker_)
return arc_tracker_->GetShelfId(arc::GetWindowTaskId(window));
return shelf_id; return shelf_id;
} }
......
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