ConnectionInfo &conn = m_connToInfo[fd];
- FdEvent fdEvent{eventId, popup_id, std::shared_ptr<IUIEvent>(new ExtUIEvent(popup_id, conn.pid, conn.pkgId, conn.appId, privacies))};
+ FdEvent fdEvent{eventId, popup_id, std::shared_ptr<IUIEvent>(new ExtUIEvent(popup_id, conn.pid, conn.pkgId, privacies))};
fdEvent.event->process();
m_pendingEvents.emplace_back(std::move(fdEvent));
}
class ExtUIEvent : public IUIEvent {
public:
- ExtUIEvent(int popup_id, pid_t caller_app_pid, std::string pkg_id, std::string app_id, std::vector<std::string> privacies)
+ ExtUIEvent(int popup_id, pid_t caller_app_pid, std::string pkg_id, std::vector<std::string> privacies)
: IUIEvent(NULL),
m_popup_id(popup_id),
m_caller_app_pid(caller_app_pid),
m_pkg_id(pkg_id),
- m_app_id(app_id),
m_privacies(privacies)
{}
virtual void process() {
- (void)UIAppInvoker::invoke(m_popup_id, m_caller_app_pid, m_pkg_id, m_app_id, m_privacies);
+ (void)UIAppInvoker::invoke(m_popup_id, m_caller_app_pid, m_pkg_id, m_privacies);
}
private:
int m_popup_id;
pid_t m_caller_app_pid;
- std::string m_pkg_id, m_app_id;
+ std::string m_pkg_id;
std::vector<std::string> m_privacies;
};
#include <component_manager.h>
#define PID_BUFFER_SIZE 64
+#define APPID_BUFFER_SIZE 1024
namespace AskUser {
const char* LAUNCH_MODE_GROUP = "group";
const char* LAUNCH_MODE_SINGLE = "single";
-const char* get_app_launch_mode(const std::string &pkg_id, const std::string &app_id)
+const char* get_app_launch_mode(const std::string &app_id)
{
+ ALOGD("Get app launch mode for app id : " << app_id);
app_info_h app_info;
int ret = 0;
- ret = app_info_create(pkg_id.c_str(), &app_info);
+ ret = app_info_create(app_id.c_str(), &app_info);
if (ret != APP_MANAGER_ERROR_NONE) {
- ALOGE("Cannot retrieve app launch mode for pkg : " << pkg_id << " app id : " << app_id);
+ ALOGE("Cannot retrieve app launch mode for app id : " << app_id);
return LAUNCH_MODE_SINGLE;
}
app_info_destroy(app_info);
if (ret != APP_MANAGER_ERROR_NONE) {
- ALOGE("Cannot get app type for pkg : " << pkg_id << " app id : " << app_id);
+ ALOGE("Cannot get app type for app id : " << app_id);
return LAUNCH_MODE_SINGLE;
}
ret = component_info_create(app_id.c_str(), &component);
if (ret) {
- ALOGE("Cannot retrieve component info for pkg : " << pkg_id << " app id : " << app_id);
+ ALOGE("Cannot retrieve component info for app id : " << app_id);
return LAUNCH_MODE_SINGLE;
}
component_info_destroy(component);
if (ret) {
- ALOGE("Cannot retrieve component info for pkg : " << pkg_id << " app id : " << app_id);
+ ALOGE("Cannot retrieve component info for app id : " << app_id);
return LAUNCH_MODE_SINGLE;
}
}
}
-bool UIAppInvoker::invoke(int popup_id, pid_t caller_app_pid, const std::string &pkg_id, const std::string &app_id, const std::vector<std::string> &privacies) {
+bool UIAppInvoker::invoke(int popup_id, pid_t caller_app_pid, const std::string &pkg_id, const std::vector<std::string> &privacies) {
ALOGD("Launching popup app for popup_id: " << popup_id << ", pkg_id of requestor app: " << pkg_id);
char buf[PID_BUFFER_SIZE];
char** privacies_c = NULL;
int ret = -1;
size_t i = 0;
+ char real_app_id[APPID_BUFFER_SIZE];
b = bundle_create();
}
/* Sets App Launch Mode */
- ret = aul_svc_set_launch_mode(b, get_app_launch_mode(pkg_id, app_id));
+ ret = aul_app_get_appid_bypid(caller_app_pid, real_app_id, APPID_BUFFER_SIZE);
+ if (ret < 0) {
+ ALOGE("aul_app_get_appid_bypid() failed. ret = " << ret);
+ goto error_exit;
+ }
+
+ ret = aul_svc_set_launch_mode(b, get_app_launch_mode(real_app_id));
if (ret < 0) {
ALOGE("aul_svc_set_launch_mode() failed. ret = " << ret);
goto error_exit;