Commit 01baf65d authored by Renee Wright's avatar Renee Wright Committed by Commit Bot

Remove Crostini apps before inserting them to clean up any residual prefs

Bug: 869734
Change-Id: Ie863c125d49c351b79f5b072bc20535a75dd8d6a
Reviewed-on: https://chromium-review.googlesource.com/1157963Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Renée Wright <rjwright@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580002}
parent d04fac0d
...@@ -72,8 +72,12 @@ void CrostiniAppModelBuilder::OnRegistryUpdated( ...@@ -72,8 +72,12 @@ void CrostiniAppModelBuilder::OnRegistryUpdated(
RemoveApp(app_id, unsynced_change); RemoveApp(app_id, unsynced_change);
InsertCrostiniAppItem(registry_service, app_id); InsertCrostiniAppItem(registry_service, app_id);
} }
for (const std::string& app_id : inserted_apps) for (const std::string& app_id : inserted_apps) {
// If the app has been installed before and has not been cleaned up
// correctly, it needs to be removed.
RemoveApp(app_id, unsynced_change);
InsertCrostiniAppItem(registry_service, app_id); InsertCrostiniAppItem(registry_service, app_id);
}
} }
void CrostiniAppModelBuilder::OnAppIconUpdated(const std::string& app_id, void CrostiniAppModelBuilder::OnAppIconUpdated(const std::string& app_id,
...@@ -90,12 +94,15 @@ void CrostiniAppModelBuilder::OnAppIconUpdated(const std::string& app_id, ...@@ -90,12 +94,15 @@ void CrostiniAppModelBuilder::OnAppIconUpdated(const std::string& app_id,
} }
void CrostiniAppModelBuilder::OnCrostiniEnabledChanged() { void CrostiniAppModelBuilder::OnCrostiniEnabledChanged() {
const bool unsynced_change = false;
if (IsCrostiniEnabled(profile())) { if (IsCrostiniEnabled(profile())) {
// If Terminal has been installed before and has not been cleaned up
// correctly, it needs to be removed.
RemoveApp(kCrostiniTerminalId, unsynced_change);
crostini::CrostiniRegistryService* registry_service = crostini::CrostiniRegistryService* registry_service =
crostini::CrostiniRegistryServiceFactory::GetForProfile(profile()); crostini::CrostiniRegistryServiceFactory::GetForProfile(profile());
InsertCrostiniAppItem(registry_service, kCrostiniTerminalId); InsertCrostiniAppItem(registry_service, kCrostiniTerminalId);
} else { } else {
const bool unsynced_change = false;
RemoveApp(kCrostiniTerminalId, unsynced_change); RemoveApp(kCrostiniTerminalId, unsynced_change);
} }
} }
......
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