ALOGD("SecurityManager: Setting security level to " << level);
std::string appName;
- identifyApp(app, appName);
+ std::string pkgLabel;
+ identifyApp(app, appName, pkgLabel);
if (appName.empty()) {
ALOGE("Couldn't fetch appName from cynara client. Cannot set policy");
return;
#endif
m_poller.setEvents(m_serverSocket.getFd(), POLLIN);
setSignalDescriptor();
+ m_gui.setLocale();
m_gui.initialize();
ALOGD("Initialized");
}
m_checkbox = elm_check_add(m_popup);
elm_object_style_set(m_checkbox, "popup");
elm_object_text_set(m_checkbox, checkBoxText);
+ elm_check_state_set(m_checkbox, EINA_FALSE);
evas_object_size_hint_align_set(m_checkbox, EVAS_HINT_FILL, 0.0);
elm_object_part_content_set(m_layoutInner, "elm.swallow.end", m_checkbox);
evas_object_show(m_checkbox);
ALOGE("textdomain failed");
}
-void GuiRunner::refreshText()
+void GuiRunner::refresh()
{
char *popupTitle = dgettext(PROJECT_NAME, "IDS_IDLE_HEADER_PRIVACY_REQUEST");
char *checkBoxText = dgettext(PROJECT_NAME, "IDS_ST_OPT_DONT_SHOW_AGAIN");
#ifdef MOBILE_UI
elm_object_part_text_set(m_popup, "title,text", popupTitle);
- elm_object_text_set(m_checkbox, checkBoxText);
elm_object_text_set(m_denyButton, dgettext(PROJECT_NAME, "IDS_IDLE_BUTTON_DENY"));
elm_object_text_set(m_allowButton, dgettext(PROJECT_NAME, "IDS_IDLE_BUTTON_ALLOW_ABB7"));
#elif defined(CIRCLE_UI)
elm_object_part_text_set(m_layout, "elm.text.title", popupTitle);
- elm_object_text_set(m_checkbox, checkBoxText);
#endif
+ elm_object_text_set(m_checkbox, checkBoxText);
+ elm_check_state_set(m_checkbox, EINA_FALSE);
}
NResponseType GuiRunner::popupRun(const std::string &app, const std::string &perm)
setLocale();
if (!m_initialized) {
initialize();
- } else {
- refreshText();
}
+ refresh();
m_running = true;
+ std::string appId;
std::string pkgLabel;
- identifyApp(app, pkgLabel);
+ identifyApp(app, appId, pkgLabel);
// create message
char *messageFormat = dgettext(PROJECT_NAME, "IDS_IDLE_POP_ALLOW_P1SS_TO_ACCESS_YOUR_P2SS_Q");
GuiRunner() = default;
void initialize();
void setLocale();
- void refreshText();
+ void refresh();
void addDismissFd(int fd, DissmissCb cb, void *data);
void delDismissFd(int fd);
~GuiRunner();
char * toAppId(const char *pkgId) {
int ret = 0;
+ char *mainappid = 0;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgId, &handle);
+ if (ret != PMINFO_R_OK)
+ return NULL;
+ ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &mainappid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return NULL;
+ }
+ printf("main app id: %s\n", mainappid);
+ char *result = strdup(mainappid);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return result;
+}
+
+char * toPkgLabel(const char *pkgId) {
+ int ret = 0;
char *pkgLabel = 0;
pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgId, &handle);
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return result;
}
-
}
namespace AskUser {
-void identifyApp(const std::string &client, std::string &appId) {
+void identifyApp(const std::string &client, std::string &appId, std::string &pkgLabel) {
char *pkg_name = nullptr;
char *app_name = nullptr;
+ char *pkg_label = nullptr;
int ret = security_manager_identify_app_from_cynara_client(client.c_str(), &pkg_name, &app_name);
std::unique_ptr<char, decltype(free)*> pkg_name_p(pkg_name, free);
- if (!app_name && pkg_name_p)
+ if (!app_name && pkg_name_p) {
app_name = toAppId(pkg_name_p.get());
+ pkg_label = toPkgLabel(pkg_name_p.get());
+ }
std::unique_ptr<char, decltype(free)*> app_name_p(app_name, free);
throwOnSMError("security_manager_identify_app_from_cynara_client", ret);
+ std::unique_ptr<char, decltype(free)*> pkg_label_p(pkg_label, free);
+
if (!app_name) {
ALOGW("Identifying of application failed!");
return;
}
+ if (!pkg_label) {
+ ALOGW("Get pkg label failed!");
+ return;
+ }
+
appId = app_name;
+ pkgLabel = pkg_label;
}
PolicyEntry::PolicyEntry() {
namespace AskUser {
-void identifyApp(const std::string &client, std::string &appId);
+void identifyApp(const std::string &client, std::string &appId, std::string &pkgLabel);
class PolicyEntry {
public: