if (!package.empty()) {
if (instance->mXMLDocMap.count(package)) {
+ mAppCount--;
+ mAppXMLLoadedCount--;
instance->mXMLDocMap.erase(package);
}
if (mXMLSync)
{
if (instance->mXMLDocMap.count(std::string(pkg))) {
+ mAppCount--;
+ mAppXMLLoadedCount--;
instance->mXMLDocMap.erase(std::string(pkg));
}
}
std::map<std::string, std::shared_ptr<AurumXML>> AtspiAccessibleWatcher::getXMLDocMap(void)
{
- LOGI("XMLsync: %s", (mXMLSync ? "TRUE" : "FALSE"));
if(mXMLSync)
{
std::unique_lock lk(mXMLMutex);
- //LOGI("mAppCount: %d, mAppXMLLoadedCount: %d", mAppCount, mAppXMLLoadedCount);
+ LOGI("mAppCount: %d, mAppXMLLoadedCount: %d", mAppCount, mAppXMLLoadedCount);
mXMLConditionVar.wait(lk, [&] {return mAppCount <= mAppXMLLoadedCount;});
lk.unlock();
std::shared_ptr<AurumXML> AtspiAccessibleWatcher::getXMLDoc(std::string pkgName)
{
- LOGI("XMLsync: %s", (mXMLSync ? "TRUE" : "FALSE"));
if(mXMLSync)
{
std::unique_lock lk(mXMLMutex);
- //LOGI("mAppCount: %d, mAppXMLLoadedCount: %d", mAppCount, mAppXMLLoadedCount);
+ LOGI("mAppCount: %d, mAppXMLLoadedCount: %d", mAppCount, mAppXMLLoadedCount);
mXMLConditionVar.wait(lk, [&] {return mAppCount <= mAppXMLLoadedCount;});
lk.unlock();
if(!sync) {
mXMLDocMap.clear();
+ mAppCount = 0;
+ mAppXMLLoadedCount = 0;
+ } else {
+ auto apps = getApplications();
+ for (auto app : apps)
+ {
+ app->getAccessibleNode()->updateName();
+ mAppCount++;
+ mXMLDocMap.insert(std::pair<std::string, std::shared_ptr<AurumXML>>(app->getPackageName(),
+ std::make_shared<AurumXML>(app->getAccessibleNode(), &mAppXMLLoadedCount, &mXMLMutex, &mXMLConditionVar)));
+ }
}
-}
\ No newline at end of file
+}