void PlatformApiStub::update_application_list(const ApplicationListUpdate &update) { protobuf::bridge::EventSequence seq; auto event = seq.mutable_application_list_update(); for (const auto &a : update.applications) { auto app = event->add_applications(); app->set_name(a.name); app->set_package(a.package); auto launch_intent = app->mutable_launch_intent(); launch_intent->set_action(a.launch_intent.action); launch_intent->set_uri(a.launch_intent.uri); launch_intent->set_type(a.launch_intent.type); launch_intent->set_package(a.launch_intent.package); launch_intent->set_component(a.launch_intent.component); for (const auto &category : a.launch_intent.categories) { auto c = launch_intent->add_categories(); *c = category; } app->set_icon(a.icon.data(), a.icon.size()); } for (const auto &package : update.removed_applications) { auto app = event->add_removed_applications(); app->set_name("unknown"); app->set_package(package); } rpc_channel_->send_event(seq); }
int main(int argc, const char * const *argv) { const char *env_pkgname; int ret; dpkg_locales_init(PACKAGE); dpkg_program_init("dpkg-divert"); dpkg_options_parse(&argv, cmdinfos, printforhelp); admindir = dpkg_db_set_dir(admindir); instdir = dpkg_fsys_set_dir(instdir); env_pkgname = getenv("DPKG_MAINTSCRIPT_PACKAGE"); if (opt_pkgname_match_any && env_pkgname) set_package(NULL, env_pkgname); if (!cipaction) setaction(&cmdinfo_add, NULL); modstatdb_open(msdbrw_readonly); fsys_hash_init(); ensure_diversions(); ret = cipaction->action(argv); modstatdb_shutdown(); dpkg_program_done(); return ret; }