* limitations under the License.
*/
+#include "pkginfo_internal.h"
+
#include <bundle_cpp.h>
#include <bundle_internal.h>
#include <glib-unix.h>
#include <exception>
#include <memory>
#include <string>
+#include <thread>
#include "app_request.h"
#include "aul_api.h"
return 0;
}
+thread_local bool calling_appinfo_cb = false;
int GetRunningAppInfoWithCb(int cmd, uid_t uid, aul_app_info_iter_fn cb,
void* user_data) {
if (cb == nullptr)
if (ret != AUL_R_OK)
return ret;
+ calling_appinfo_cb = true;
aul_app_info info;
for (auto const& b : results) {
if (SetAppInfo(&info, b) != 0)
cb(&info, user_data);
}
+ calling_appinfo_cb = false;
return AUL_R_OK;
}
} // namespace
+extern "C" bool aul_is_calling_appinfo_cb() {
+ return calling_appinfo_cb;
+}
+
extern "C" API int aul_app_get_pid(const char* appid) {
return aul_app_get_pid_for_uid(appid, getuid());
}
#include "app_request.h"
#include "aul/common/exception.hh"
+#include "pkginfo_internal.h"
using namespace aul::internal;
if (pid == getpid())
return context.GetStatus();
+ if (aul_is_calling_appinfo_cb()) {
+ _E("=====================================================================");
+ _E("=> Do not use this function within the aul_app_info_iter_fn callback.");
+ _E("=====================================================================");
+ }
+
return AppRequest(APP_GET_STATUS, uid)
.SetPid(pid)
.SendSimply();
return AUL_R_EINVAL;
}
+ if (aul_is_calling_appinfo_cb()) {
+ _E("=====================================================================");
+ _E("=> Do not use this function within the aul_app_info_iter_fn callback.");
+ _E("=> The status info is already included in the aul_app_info structure.");
+ _E("=> If you want focused pid information, use the aul_window_get_focused_pid() function.");
+ _E("=====================================================================");
+ }
+
return AppRequest(APP_GET_STATUS_BY_APPID, uid)
.SetAppId(appid)
.SendSimply();