{
}
-/*
-void AccessibleWatcher::printDbgInformation() const
-{
- LOG_SCOPE_F(INFO, "%d %d", mActivatedWindowList.size(), mWindowSet.size());
-
- for (auto iter = mActivatedWindowList.begin(); iter != mActivatedWindowList.end(); ++iter) {
- LOG_F(INFO, "%p", *iter);
- }
- LOG_F(INFO, "-----------");
-
- for (auto iter = mWindowSet.begin(); iter != mWindowSet.end(); ++iter) {
- LOG_F(INFO, "%p", *iter);
- }
-}
-*/
-
AccessibleWatcher *AccessibleWatcher::getInstance(AccessibleWatcher *watcherImpl)
{
static AccessibleWatcher *mInstance = nullptr;
std::vector<std::shared_ptr<AccessibleApplication>> AccessibleWatcher::getActiveApplications(void) const
{
- LOGI("getActiveApplications for this(%p)", this);
-
std::vector<std::shared_ptr<AccessibleApplication>> ret{};
auto apps = this->getApplications();
- LOGI("apps size %d", apps.size());
+ LOGI("available app process size %d", (int)apps.size());
apps.erase(std::remove_if(apps.begin(), apps.end(), [](auto app){
return !app->isActive();
}), apps.end());
- LOGI("active apps size %d", apps.size());
+ LOGI("active apps size %d", (int)apps.size());
return apps;
}
{
std::list<std::shared_ptr<PartialMatch>> partialList{};
std::vector<std::shared_ptr<AccessibleNode>> ret = findObjects(root, 0, 0, partialList);
- LOGI("%d object(s) found", ret.size());
+ LOGI("%d object(s) found", (int)ret.size());
return ret;
}
std::vector<std::shared_ptr<AccessibleApplication>> AtspiAccessibleWatcher::getApplications(void) const
{
AtspiWrapper::lock();
- LOGI("getApplications for this(%p)", this);
std::vector<std::shared_ptr<AccessibleApplication>> ret{};
AtspiAccessible *root = AtspiWrapper::Atspi_get_desktop(0);
int nchild = AtspiWrapper::Atspi_accessible_get_child_count(root, NULL);
auto activeWindows = app->getActiveWindows();
std::transform(activeWindows.begin(), activeWindows.end(), std::back_inserter(ret),
[&](std::shared_ptr<AccessibleWindow> window){
+ LOGI("Active pkg: %s, window: %s", window->getAccessibleNode()->getPkg().c_str(), window->getTitle().c_str());
return window->getAccessibleNode();
}
);
std::stringstream ss{};
LOGI("clean up object map");
- ss << "mObjectMapReverse: ";
for(auto iter = mObjectMapReverse.begin(); iter != mObjectMapReverse.end(); ) {
auto obj = mObjectMap[iter->second];
if (obj && !obj->isValid()) {
iter = mObjectMapReverse.erase(iter);
} else {
- ss << "(" << iter->first << "," << iter->second << ") ";
++iter;
}
}
- ss << std::endl;
- ss << "mObjectMap: ";
for(auto iter = mObjectMap.begin(); iter != mObjectMap.end(); ) {
if (!iter->second->isValid()) {
iter = mObjectMap.erase(iter);
} else {
- ss << "(" << iter->first << "," << iter->second.get() << ") ";
++iter;
}
}
- ss << std::endl;
- LOGI("%s", ss.str().c_str());
}