diff --git a/src/anbox/application/launcher_storage.cpp b/src/anbox/application/launcher_storage.cpp index 3173ea3..988281a 100644 --- a/src/anbox/application/launcher_storage.cpp +++ b/src/anbox/application/launcher_storage.cpp @@ -33,6 +33,14 @@ LauncherStorage::LauncherStorage(const fs::path &path, LauncherStorage::~LauncherStorage() {} +void LauncherStorage::reset() { + if (fs::exists(path_)) + fs::remove_all(path_); + + if (fs::exists(icon_path_)) + fs::remove_all(icon_path_); +} + void LauncherStorage::add(const Item &item) { if (!fs::exists(path_)) fs::create_directories(path_); if (!fs::exists(icon_path_)) fs::create_directories(icon_path_); diff --git a/src/anbox/application/launcher_storage.h b/src/anbox/application/launcher_storage.h index 255943d..e019d90 100644 --- a/src/anbox/application/launcher_storage.h +++ b/src/anbox/application/launcher_storage.h @@ -40,6 +40,7 @@ class LauncherStorage { std::vector icon; }; + void reset(); void add(const Item &item); private: diff --git a/src/anbox/bridge/platform_api_skeleton.cpp b/src/anbox/bridge/platform_api_skeleton.cpp index c28a0ca..32f53de 100644 --- a/src/anbox/bridge/platform_api_skeleton.cpp +++ b/src/anbox/bridge/platform_api_skeleton.cpp @@ -99,6 +99,11 @@ void PlatformApiSkeleton::handle_window_state_update_event( void PlatformApiSkeleton::handle_application_list_update_event( const anbox::protobuf::bridge::ApplicationListUpdateEvent &event) { + // Remove all existing items to start from scratch for all + // applications. We may need to improve this in the future + // to guarantee correct integration into desktop environments + launcher_storage_->reset(); + for (int n = 0; n < event.applications_size(); n++) { application::LauncherStorage::Item item;