Commit ba712bce authored by nancy's avatar nancy Committed by Commit Bot

Check the app type when pause or unpause an app.

When the app doesn't exist in AppService, if the PauseApp is called, the
app is added to AppService with the app type Unknown, then later when
the app is added, the app type is changed to Web or Arc. In theory, the
app type should not be changed, so add the app type checking when pause
or unpause an app.

BUG=1055937

Change-Id: Iafd4befb6f7369977a3693d84994f3453876af7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089445Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747565}
parent 9c383084
...@@ -272,6 +272,10 @@ void AppServiceProxy::PauseApps( ...@@ -272,6 +272,10 @@ void AppServiceProxy::PauseApps(
for (auto& data : pause_data) { for (auto& data : pause_data) {
apps::mojom::AppType app_type = cache_.GetAppType(data.first); apps::mojom::AppType app_type = cache_.GetAppType(data.first);
if (app_type == apps::mojom::AppType::kUnknown) {
continue;
}
constexpr bool kPaused = true; constexpr bool kPaused = true;
UpdatePausedStatus(app_type, data.first, kPaused); UpdatePausedStatus(app_type, data.first, kPaused);
...@@ -294,6 +298,10 @@ void AppServiceProxy::UnpauseApps(const std::set<std::string>& app_ids) { ...@@ -294,6 +298,10 @@ void AppServiceProxy::UnpauseApps(const std::set<std::string>& app_ids) {
for (auto& app_id : app_ids) { for (auto& app_id : app_ids) {
apps::mojom::AppType app_type = cache_.GetAppType(app_id); apps::mojom::AppType app_type = cache_.GetAppType(app_id);
if (app_type == apps::mojom::AppType::kUnknown) {
continue;
}
constexpr bool kPaused = false; constexpr bool kPaused = false;
UpdatePausedStatus(app_type, app_id, kPaused); UpdatePausedStatus(app_type, app_id, kPaused);
......
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