return fetch.fetchPolicy();
}
-void identifyApp(PkgInfo &pkgInfo, const std::string &client, std::string &appId, std::string &pkgLabel)
+void identifyApp(PkgInfo &pkgInfo, const std::string &client, std::string &appId, std::string &pkgId)
{
char *pkgName = nullptr;
char *appName = nullptr;
else
appId = appName;
- pkgLabel = pkgInfo.pkgLabel(pkgName, uid);
+ pkgId = pkgName;
}
std::string getOwnAppId(PkgInfo &pkgInfo)
class PolicyEntryCopy;
std::string getOwnAppId(PkgInfo &pkgInfo);
-void identifyApp(PkgInfo &pkgInfo, const std::string &client, std::string &appId, std::string &pkgLabel);
+void identifyApp(PkgInfo &pkgInfo, const std::string &client, std::string &appId, std::string &pkgId);
std::set<Privilege> getManifestPrivs(const std::string &appId);
#include <exception/ErrnoException.h>
#include <policy/Policy.h>
#include <policy/PrivilegePolicy.h>
+#include <ui/Po.h>
#include "PolicyUpdater.h"
#include "ServerCallbacks.h"
m_serverChannel->process(fd, 0);
}
- std::string appId, pkgLabel;
+ std::string appId, pkgId;
PkgMgrPkgInfo pkgInfo;
- identifyApp(pkgInfo, creds.label, appId, pkgLabel);
+ identifyApp(pkgInfo, creds.label, appId, pkgId);
ALOGD("Proper client connected");
stopTimer();
- ConnectionInfo connInfo{appId, pkgLabel, creds.uid};
+ ConnectionInfo connInfo{appId, pkgId, creds.uid};
m_connToInfo.insert(it, std::make_pair(fd, connInfo));
} catch (const std::exception &e) {
ALOGE("Failed to add channel fd " << fd);
Privacy currentPrivacy;
seq.getNextPrivacy(currentPrivacy);
- FdEvent fdEvent{eventId, std::unique_ptr<IUIEvent>(new EventPopupCheck(&m_popupper, conn.pkgLabel, currentPrivacy))};
+ FdEvent fdEvent{eventId, std::unique_ptr<IUIEvent>(new EventPopupCheck(&m_popupper, conn.pkgId, currentPrivacy))};
m_pendingEvents.emplace_back(std::move(fdEvent));
}
void Logic::init() {
init_agent_log();
m_popupper.initialize();
- m_popupper.setLocale();
+ Po::setLocale();
m_popupper.registerPopupResponseHandler([&](NResponseType response) { popupResponse(response);});
registerSignalFd();
Privacy nextPrivacy;
if (seq.getNextPrivacy(nextPrivacy)) {
// More privacies to process - replace existing event with new privacy
- FdEvent fdEvent{m_currentEvent, std::unique_ptr<IUIEvent>(new EventPopupCheck(&m_popupper, conn.pkgLabel, nextPrivacy))};
+ FdEvent fdEvent{m_currentEvent, std::unique_ptr<IUIEvent>(new EventPopupCheck(&m_popupper, conn.pkgId, nextPrivacy))};
m_pendingEvents[0] = std::move(fdEvent);
// don't call finishCurrentRequest here, because it will pop event, which we replaced
m_currentEvent = EventId();
struct ConnectionInfo {
std::string appId;
- std::string pkgLabel;
+ std::string pkgId;
std::string user;
};
class EventPopupCheck : public IUIEvent {
public:
- EventPopupCheck(Popupper *popupper, const std::string &pkgLabel, const std::string &privacy)
- : IUIEvent(popupper), m_pkgLabel(pkgLabel), m_privacy(privacy)
+ EventPopupCheck(Popupper *popupper, const std::string &pkgId, const std::string &privacy)
+ : IUIEvent(popupper), m_pkgId(pkgId), m_privacy(privacy)
{}
virtual void process() {
- m_popupper->popupCheck(m_pkgLabel, m_privacy);
+ m_popupper->popupCheck(m_pkgId, m_privacy);
}
private:
- std::string m_pkgLabel;
+ std::string m_pkgId;
std::string m_privacy;
};
{MsgType::MSG_TOAST_FAIL_TEXT, "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"}
};
-void setLocale() {
- char *lang = vconf_get_str(VCONFKEY_LANGSET);
- if (lang)
- {
- elm_language_set(lang);
- free(lang);
- } else {
- ALOGE("Couldn't fetch language from vconf failed.");
- }
-}
-
template <typename ...Args>
std::string makeFromFormat(const char *format, Args... args) {
char *buf;
}
const char *getFormat(enum MsgType type) {
- setLocale();
return dgettext(PROJECT_NAME, MSG_PO[type]);
}
namespace Notification {
namespace Po {
-std::string createPopupCheckMsg(const std::string &pkgLabel, const std::string &privacy) {
- return makeFromFormat(getFormat(MsgType::MSG_POPUP_TEXT), pkgLabel.c_str(),
+void setLocale() {
+ char *lang = vconf_get_str(VCONFKEY_LANGSET);
+ if (lang)
+ {
+ elm_language_set(lang);
+ free(lang);
+ } else {
+ ALOGE("Couldn't fetch language from vconf failed.");
+ }
+}
+
+std::string createPopupCheckMsg(const std::string &pkgId, const std::string &privacy) {
+ PkgMgrPkgInfo pkgInfo;
+ return makeFromFormat(getFormat(MsgType::MSG_POPUP_TEXT), pkgInfo.pkgLabel(pkgId, getuid()).c_str(),
PrivilegeInfo::getPrivacyDisplayName(privacy).c_str());
}
namespace Notification {
namespace Po {
-std::string createPopupCheckMsg(const std::string &pkgLabel, const std::string &priv);
+std::string createPopupCheckMsg(const std::string &pkgId, const std::string &priv);
std::string createPrivilegeDescr(const std::string &priv);
+void setLocale();
std::string getPopupTitleMsg();
std::string getAllowButtonMsg();
std::string getDenyButtonMsg();
class PopupCheckWearable : public PopupCheck {
public:
- PopupCheckWearable(Evas_Object *parent, const std::string msg)
- : PopupCheck(parent, msg)
+ PopupCheckWearable(Evas_Object *parent, const std::string &msg, const std::string &pkgId, const std::string &privacy)
+ : PopupCheck(parent, msg), m_pkgId(pkgId), m_privacy(privacy)
{}
~PopupCheckWearable() {}
static Eina_Bool rotaryChangedCb(void *data, Evas_Object *, Eext_Rotary_Event_Info *info) {
}
return EINA_TRUE;
}
+ static void langChangedCb(keynode_t *, void *data)
+ {
+ PopupCheckWearable *popup = static_cast<PopupCheckWearable*>(data);
+
+ Po::setLocale();
+ elm_object_part_text_set(popup->m_layout, "elm.text.title", Po::getPopupTitleMsg().c_str());
+ elm_atspi_accessible_name_set(popup->ao_title_text, Po::getPopupTitleMsg().c_str());
+ elm_object_text_set(popup->m_content, Po::createPopupCheckMsg(popup->m_pkgId, popup->m_privacy).c_str());
+ elm_object_text_set(popup->m_checkBox, Po::getCheckBoxMsg().c_str());
+ elm_atspi_accessible_name_set(popup->m_allowButton, Po::getAllowButtonMsg().c_str());
+ elm_atspi_accessible_name_set(popup->m_denyButton, Po::getDenyButtonMsg().c_str());
+
+ }
virtual void create() {
elm_object_style_set(m_popup, "circle");
elm_popup_scrollable_set(m_popup, EINA_FALSE);
evas_object_show(icon);
elm_atspi_accessible_name_set(m_denyButton, Po::getDenyButtonMsg().c_str());
+ /* language changed callback */
+ vconf_notify_key_changed(VCONFKEY_LANGSET, &PopupCheckWearable::langChangedCb, this);
+
evas_object_show(m_popup);
}
private:
Evas_Object *m_layout = nullptr;
Evas_Object *m_layoutInner = nullptr;
Evas_Object *m_scroller = nullptr;
+ std::string m_pkgId;
+ std::string m_privacy;
};
} /* namespace Notification */
ecore_event_handler_add(ECORE_EVENT_KEY_UP, &Popupper::hwKeyClickedCb, this);
}
-void Popupper::setLocale()
-{
- char *lang = vconf_get_str(VCONFKEY_LANGSET);
- if (lang)
- {
- elm_language_set(lang);
- free(lang);
- } else {
- ALOGE("Couldn't fetch language from vconf failed.");
- }
-}
-
void Popupper::show() {
evas_object_show(m_win);
}
-void Popupper::popupCheck(const std::string &pkgLabel, const std::string &privacy) {
+void Popupper::popupCheck(const std::string &pkgId, const std::string &privacy) {
std::string profileName = getProfileName();
PopupCheck *popup;
try {
if (profileName[0] != 'w' && profileName[0] != 'W') {
// Not wearable
- popup = new PopupCheckMobile(m_win, Po::createPopupCheckMsg(pkgLabel, privacy));
+ popup = new PopupCheckMobile(m_win, Po::createPopupCheckMsg(pkgId, privacy));
} else {
// Wearable
- popup = new PopupCheckWearable(m_win, Po::createPopupCheckMsg(pkgLabel, privacy));
+ popup = new PopupCheckWearable(m_win, Po::createPopupCheckMsg(pkgId, privacy), pkgId, privacy);
}
popup->create();
} catch (const std::exception &e) {
#include <memory>
#include <string>
#include <vector>
+#include <vconf.h>
#include "Answerable.h"
#include "Popup.h"
Popupper() = default;
void initialize();
- void setLocale();
void registerPopupResponseHandler(PopupHandler handler);
void start();
- void popupCheck(const std::string &pkgLabel, const std::string &privacy);
+ void popupCheck(const std::string &pkgId, const std::string &privacy);
void popupClose();
void stop();