-# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2014-2016 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
PROJECT("askuser")
-SET(ASKUSER_VERSION 0.1.0)
+set(ASKUSER_VERSION 0.1.0)
############################# cmake packages ##################################
INCLUDE(FindPkgConfig)
INCLUDE(CheckCXXCompilerFlag)
-###################### choose modules to compile ##############################
-
-SET(BUILD_ASKUSER OFF CACHE BOOL "Build askuser")
-SET(BUILD_ASKUSER_NOTIFICATION OFF CACHE BOOL "Build askuser-notification")
-
-IF (NOT BUILD_ASKUSER AND NOT BUILD_ASKUSER_NOTIFICATION)
- SET(BUILD_ASKUSER ON)
- SET(BUILD_ASKUSER_NOTIFICATION ON)
-ENDIF (NOT BUILD_ASKUSER AND NOT BUILD_ASKUSER_NOTIFICATION)
-
############################# install dirs ##################################
SET(BIN_INSTALL_DIR
# Don't export symbols by default
ADD_DEFINITIONS("-fvisibility=hidden")
+# Pass project name to sources
+ADD_DEFINITIONS("-DPROJECT_NAME=\"${PROJECT_NAME}\"")
+
IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
IF (RES_DIR)
ADD_DEFINITIONS("-DRES_DIR=\"${RES_DIR}\"")
ELSE (RES_DIR)
- ADD_DEFINITIONS("-DRES_DIR=\"/usr/share/askuser-notification/res/\"")
+ ADD_DEFINITIONS("-DRES_DIR=\"/usr/share/askuser/res/\"")
ENDIF (RES_DIR)
-SET(ASKUSER_PATH ${PROJECT_SOURCE_DIR}/src)
-
-IF (BUILD_ASKUSER)
- SET(TARGET_ASKUSER "askuser")
- SET(TARGET_ASKUSER_COMMON "askuser-common")
- SET(TARGET_PLUGIN_SERVICE "askuser-plugin-service")
- SET(TARGET_PLUGIN_CLIENT "askuser-plugin-client")
- SET(TARGET_PRIVACYDENIED_PLUGIN_CLIENT "privacy-denied-plugin-client")
- SET(TARGET_PRIVACYDENIED_PLUGIN_SERVICE "privacy-denied-plugin-service")
- SET(TARGET_TEST "askuser-test")
- SET(TARGET_TESTS "askuser-tests")
- ADD_SUBDIRECTORY(src/agent)
- ADD_SUBDIRECTORY(src/common)
- ADD_SUBDIRECTORY(src/plugin)
- ADD_SUBDIRECTORY(test)
-ENDIF (BUILD_ASKUSER)
-
-IF (BUILD_ASKUSER_NOTIFICATION)
- SET(TARGET_ASKUSER_NOTIFICATION "askuser-notification")
- SET(TARGET_ASKUSER_NOTIFICATION_LIB "askuser-notification-ipc")
- SET(TARGET_ASKUSER_NOTIFICATION_TEST "askuser-notification-test")
- ADD_SUBDIRECTORY(src/agent/notification-daemon)
- ADD_SUBDIRECTORY(src/common/protocol)
-ENDIF (BUILD_ASKUSER_NOTIFICATION)
+SET(TARGET_ASKUSER "askuser")
+SET(TARGET_ASKUSER_COMMON "askuser-common")
+SET(TARGET_PLUGIN_SERVICE "askuser-plugin-service")
+SET(TARGET_PLUGIN_CLIENT "askuser-plugin-client")
+SET(TARGET_ASKUSER_NOTIFICATION "askuser-notification")
+
+SET(TARGET_TEST "askuser-test")
+SET(TARGET_TESTS "askuser-tests")
+ADD_SUBDIRECTORY(src)
IF (BUILD_WITH_SYSTEMD_DAEMON)
ADD_SUBDIRECTORY(systemd)
ENDIF (BUILD_WITH_SYSTEMD_DAEMON)
+ADD_SUBDIRECTORY(test)
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
+++ /dev/null
-%if !%{defined with_systemd_daemon}
-%define with_systemd_daemon 1
-%endif
-
-Name: askuser-notification
-Summary: User daemon which shows popup with privilege request
-Version: 0.1.13
-Release: 1
-Group: Security/Access Control
-License: Apache-2.0
-Source0: %{name}-%{version}.tar.gz
-Source1001: default.manifest
-BuildRequires: cmake
-BuildRequires: libwayland-egl
-BuildRequires: gettext-tools
-BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(notification)
-%if %{with_systemd_daemon}
-BuildRequires: pkgconfig(libsystemd)
-%endif
-BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: pkgconfig(security-privilege-manager)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(capi-ui-efl-util)
-BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: coregl
-BuildRequires: edje-bin
-
-%if !%{defined build_type}
-%define build_type RELEASE
-%endif
-
-%description
-Daemon allowing user to grant or deny access for given application and privilege
-
-%package libs
-Summary: Askuser notification protocol library
-
-%description libs
-Askuser notification protocol library
-
-%package devel
-Summary: Askuser notification protocol library development files
-
-%description devel
-Askuser notification protocol library development files
-
-%package test
-Summary: Tool for testing askuser-notification
-
-%description test
-Tool for testing askuser-notification
-
-%prep
-%setup -q
-cp -a %{SOURCE1001} .
-
-%build
-%if 0%{?sec_build_binary_debug_enable}
-export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
-%endif
-
-%if %{?build_type} == "DEBUG"
-export CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE"
-%endif
-
-export LDFLAGS+="-Wl,--rpath=%{_libdir}"
-
-%cmake . \
- -DBUILD_ASKUSER_NOTIFICATION=ON \
- -DCMAKE_BUILD_TYPE=%{?build_type} \
- -DBUILD_WITH_SYSTEMD_DAEMON=%{?with_systemd_daemon} \
- -DCMAKE_VERBOSE_MAKEFILE=ON \
- -DRES_DIR="/usr/share/askuser-notification/res"
-make %{?jobs:-j%jobs}
-
-%install
-rm -rf %{buildroot}
-%make_install
-%find_lang %{name}
-
-%if %{with_systemd_daemon}
-mkdir -p %{buildroot}/%{_unitdir_user}/sockets.target.wants
-ln -s ../askuser-notification-stream.socket %{buildroot}/%{_unitdir_user}/sockets.target.wants/askuser-notification-stream.socket
-ln -s ../askuser-notification-datagram.socket %{buildroot}/%{_unitdir_user}/sockets.target.wants/askuser-notification-datagram.socket
-%endif
-
-%post
-%if %{with_systemd_daemon}
-systemctl daemon-reload
-%endif
-
-%preun
-
-%postun
-
-%post libs -p /sbin/ldconfig
-
-%postun libs -p /sbin/ldconfig
-
-%files -f %{name}.lang
-%manifest default.manifest
-%license LICENSE
-%attr(755,root,root) /usr/bin/askuser-notification
-%if %{with_systemd_daemon}
-%{_unitdir_user}/askuser-notification.service
-%{_unitdir_user}/askuser-notification-stream.socket
-%{_unitdir_user}/askuser-notification-datagram.socket
-%{_unitdir_user}/sockets.target.wants/*
-%endif
-%{_datadir}/askuser-notification/res/*
-
-%files libs
-%manifest default.manifest
-%license LICENSE
-%{_libdir}/libaskuser-notification.so.*
-
-%files devel
-%{_libdir}/libaskuser-notification.so
-%{_includedir}/askuser-notification
-%{_libdir}/pkgconfig/askuser-notification.pc
-
-%files test
-%attr(755,root,root) %{_bindir}/askuser-notification-test
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
Group: Security/Access Control
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
-Source1001: default.manifest
+Source1001: %{name}.manifest
+Source1002: libaskuser-common.manifest
+Source1003: askuser-plugins.manifest
+Source1004: askuser-test.manifest
+Source1005: askuser-notification.manifest
BuildRequires: cmake
+BuildRequires: libwayland-egl
+BuildRequires: gettext-tools
BuildRequires: pkgconfig(cynara-agent)
-%if %{with_systemd_daemon}
+BuildRequires: pkgconfig(cynara-creds-socket)
+BuildRequires: pkgconfig(cynara-plugin)
+BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(libsystemd)
-%endif
BuildRequires: pkgconfig(security-manager)
BuildRequires: pkgconfig(security-privilege-manager)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: askuser-notification-devel
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(capi-ui-efl-util)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: coregl
+BuildRequires: edje-bin
%if !%{defined build_type}
%define build_type RELEASE
%description -n libaskuser-common
Askuser common library with common functionalities
-%package plugins
-BuildRequires: pkgconfig(cynara-plugin)
+%package -n askuser-notification
+Summary: User daemon which shows popup with privilege request
+
+%description -n askuser-notification
+User daemon which shows popup with privilege request
+
+%package -n askuser-plugins
Requires: cynara
Requires: libcynara-client
Summary: Askuser cynara plugins
-%description plugins
+%description -n askuser-plugins
Askuser plugin library with cynara service and client side plugins
-%package test
-BuildRequires: pkgconfig(cynara-agent)
-BuildRequires: pkgconfig(cynara-client)
+%package -n askuser-test
BuildRequires: pkgconfig(cynara-admin)
BuildRequires: pkgconfig(gmock)
Summary: Tool for testing askuser packages and unit tests for askuser
-%description test
+%description -n askuser-test
Tool for testing askuser packages and unit tests for askuser
%prep
%setup -q
cp -a %{SOURCE1001} .
+cp -a %{SOURCE1002} .
+cp -a %{SOURCE1003} .
+cp -a %{SOURCE1004} .
+cp -a %{SOURCE1005} .
%build
%if 0%{?sec_build_binary_debug_enable}
export LDFLAGS+="-Wl,--rpath=%{_libdir}"
%cmake . \
- -DBUILD_ASKUSER=ON \
-DCMAKE_BUILD_TYPE=%{?build_type} \
-DBUILD_WITH_SYSTEMD_DAEMON=%{?with_systemd_daemon} \
- -DCMAKE_VERBOSE_MAKEFILE=ON
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DRES_DIR="/usr/share/askuser/res"
make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
%make_install
-rm -f %{buildroot}/%{_libdir}/libaskuser-common.so
-
-%if %{with_systemd_daemon}
-mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
-mkdir -p %{buildroot}/%{_unitdir}/cynara.service.wants
-ln -s ../askuser.service %{buildroot}/%{_unitdir}/multi-user.target.wants/askuser.service
-ln -s ../askuser.service %{buildroot}/%{_unitdir}/cynara.service.wants/askuser.service
-%endif
+%find_lang %{name}
%post
%if %{with_systemd_daemon}
+# todo properly use systemd --user
+ln -s /lib/systemd/user/askuser-notification.service \
+/usr/lib/systemd/user/default.target.wants/askuser-notification.service
+ln -s /lib/systemd/user/askuser-notification.socket \
+/usr/lib/systemd/user/sockets.target.wants/askuser-notification.socket
+ln -s /usr/lib/systemd/system/askuser.service \
+/usr/lib/systemd/system/multi-user.target.wants/askuser.service
+
systemctl daemon-reload
systemctl restart askuser.service
-systemctl restart cynara.service
%endif
+systemctl restart cynara.service
+
%preun
%if %{with_systemd_daemon}
if [ $1 = 0 ]; then
if [ $1 = 0 ]; then
systemctl daemon-reload
fi
+%endif
systemctl restart cynara.service
-%endif
%post -n libaskuser-common -p /sbin/ldconfig
%postun -n libaskuser-common -p /sbin/ldconfig
-%files
-%manifest default.manifest
+%files -f %{name}.lang
+%manifest %{name}.manifest
%license LICENSE
-%attr(755, root, root) %{_bindir}/askuser
+%attr(755, root, root) /usr/bin/askuser
%if %{with_systemd_daemon}
-%{_unitdir}/askuser.service
-%{_unitdir}/multi-user.target.wants/*
-%{_unitdir}/cynara.service.wants/*
+/usr/lib/systemd/system/askuser.service
%endif
+%files -n askuser-notification
+%manifest askuser-notification.manifest
+%license LICENSE
+%attr(755,root,root) /usr/bin/askuser-notification
+%if %{with_systemd_daemon}
+/usr/lib/systemd/user/askuser-notification.service
+/usr/lib/systemd/user/askuser-notification.socket
+%endif
+#/usr/share/locale/en/LC_MESSAGES/askuser.mo
+#/usr/share/locale/pl/LC_MESSAGES/askuser.mo
+/usr/share/askuser/res/*
+
%files -n libaskuser-common
-%manifest default.manifest
+%manifest libaskuser-common.manifest
%license LICENSE
-%{_libdir}/libaskuser-common.so.*
+%{_libdir}/libaskuser-common.so*
-%files plugins
-%manifest default.manifest
+%files -n askuser-plugins
+%manifest askuser-plugins.manifest
%license LICENSE
%{_libdir}/cynara/plugin/client/*
%{_libdir}/cynara/plugin/service/*
-%files test
-%manifest default.manifest
+%files -n askuser-test
+%manifest askuser-test.manifest
%license LICENSE
-%attr(755,root,root) %{_bindir}/askuser-test
-%attr(755,root,root) %{_bindir}/askuser-tests
+%attr(755,root,root) /usr/bin/askuser-test
+%attr(755,root,root) /usr/bin/askuser-tests
+
+++ /dev/null
-<manifest>
- <request>
- <domain name="_" />
- </request>
-</manifest>
--- /dev/null
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# @file CMakeLists.txt
+# @author Adam Malinowski <a.malinowsk2@partner.samsung.com>
+#
+
+SET(ASKUSER_PATH ${PROJECT_SOURCE_DIR}/src)
+
+ADD_SUBDIRECTORY(agent)
+ADD_SUBDIRECTORY(common)
+ADD_SUBDIRECTORY(plugin)
-# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2014-2016 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
REQUIRED
cynara-agent
cynara-plugin
+ cynara-creds-socket
libsystemd
- security-manager
- pkgmgr-info
)
SET(ASKUSER_AGENT_PATH ${ASKUSER_PATH}/agent)
${ASKUSER_AGENT_PATH}/main/CynaraTalker.cpp
${ASKUSER_AGENT_PATH}/main/main.cpp
${ASKUSER_AGENT_PATH}/main/PolicyUpdater.cpp
- ${ASKUSER_AGENT_PATH}/main/Policy.cpp
${ASKUSER_AGENT_PATH}/ui/NotificationBackend.cpp
${ASKUSER_AGENT_PATH}/ui/FdNotifyObject.cpp
)
TARGET_LINK_LIBRARIES(${TARGET_ASKUSER}
${AGENT_DEP_LIBRARIES}
+ ${ASKUSER_DEP_LIBRARIES}
${TARGET_ASKUSER_COMMON}
"-pthread"
"-pie"
)
INSTALL(TARGETS ${TARGET_ASKUSER} DESTINATION ${BIN_INSTALL_DIR})
+
+ADD_SUBDIRECTORY(notification-daemon)
/*
- * Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <utility>
#include <attributes/attributes.h>
+#include <policy/Policy.h>
#include <translator/Translator.h>
#include <types/AgentErrorMsg.h>
#include <types/SupportedTypes.h>
#include <log/alog.h>
#include "Agent.h"
-#include "Policy.h"
namespace AskUser {
auto handler = [&](RequestId requestId, UIResponseType resultType) -> void {
UIResponseHandler(requestId, resultType);
};
-
- std::string appId, pkgLabel;
- identifyApp(data.client, data.user, appId, pkgLabel);
-
- bool ret = ui->start(data.client, pkgLabel, data.user, data.privilege, request->id(), handler);
+ bool ret = ui->start(data.client, data.user, data.privilege, request->id(), handler);
if (ret) {
m_UIs.insert(std::make_pair(request->id(), std::move(ui)));
}
+++ /dev/null
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/main/Policy.cpp
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Implementation of Policy wrappers
- */
-
-#include <memory>
-
-#include <security-manager.h>
-
-#include <exception/Exception.h>
-#include <log/alog.h>
-
-#include <policy/PkgInfo.h>
-#include "Policy.h"
-
-namespace {
-inline void throwOnSMError(std::string err, int ret)
-{
- if (ret != SECURITY_MANAGER_SUCCESS)
- throw AskUser::Exception(err + " : " + std::to_string(ret));
-}
-}
-
-namespace AskUser {
-
-void identifyApp(const std::string &client, const std::string &user,
- std::string &appId, std::string &pkgLabel)
-{
- char *pkgName = nullptr;
- char *appName = nullptr;
-
- int ret = security_manager_identify_app_from_cynara_client(client.c_str(), &pkgName, &appName);
- std::unique_ptr<char, decltype(free)*> pkg_name_p(pkgName, free);
- std::unique_ptr<char, decltype(free)*> app_name_p(appName, free);
- throwOnSMError("security_manager_identify_app_from_cynara_client", ret);
-
- if (!pkgName) {
- ALOGE("Couldn't identify clients package id");
- return;
- }
-
- uid_t uid = std::strtoul(user.c_str(), nullptr, 10);
- PkgInfo pkgInfo(pkgName, uid);
- if (!appName)
- appId = pkgInfo.mainAppId();
-
- pkgLabel = pkgInfo.pkgLabel();
-}
-
-PolicyEntry::PolicyEntry() {
- throwOnSMError("security_manager_policy_entry_new",
- security_manager_policy_entry_new(&m_entry));
-}
-
-PolicyEntry::PolicyEntry(PolicyEntry &&other) : m_entry(std::move(other.m_entry)) {
- other.m_entry = nullptr;
-}
-
-PolicyEntry::~PolicyEntry() {
- security_manager_policy_entry_free(m_entry);
-}
-
-void PolicyEntry::setApp(const std::string &appId) {
- throwOnSMError("security_manager_policy_entry_set_application",
- security_manager_policy_entry_set_application(m_entry, appId.c_str()));
-}
-
-void PolicyEntry::setUser(const std::string &user) {
- throwOnSMError("security_manager_policy_entry_set_user",
- security_manager_policy_entry_set_user(m_entry, user.c_str()));
-}
-
-void PolicyEntry::setPrivilege(const std::string &privilege) {
- throwOnSMError("security_manager_policy_entry_set_privilege",
- security_manager_policy_entry_set_privilege(m_entry, privilege.c_str()));
-}
-
-void PolicyEntry::setLevel(const std::string &level) {
- throwOnSMError("security_manager_policy_entry_admin_set_level",
- security_manager_policy_entry_set_level(m_entry, level.c_str()));
-}
-
-PolicyRequest::PolicyRequest() {
- throwOnSMError("security_manager_policy_update_req_new",
- security_manager_policy_update_req_new(&m_req));
-}
-
-PolicyRequest::~PolicyRequest() {
- m_entries.clear();
- security_manager_policy_update_req_free(m_req);
-}
-
-void PolicyRequest::addEntry(PolicyEntry &&entry) {
- throwOnSMError("security_manager_policy_update_req_add_entry",
- security_manager_policy_update_req_add_entry(m_req, entry.get()));
- m_entries.emplace_back(std::move(entry));
-}
-
-void PolicyRequest::updatePolicy() {
- throwOnSMError("security_manager_policy_update_send",
- security_manager_policy_update_send(m_req));
-}
-
-} /* namespace AskUser */
+++ /dev/null
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/main/Policy.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Definition of Policy wrappers
- */
-
-#pragma once
-
-#include <string>
-#include <vector>
-
-struct policy_entry;
-struct policy_update_req;
-
-namespace AskUser {
-
-void identifyApp(const std::string &client, const std::string &user,
- std::string &appId, std::string &pkgLabel);
-
-class PolicyEntry {
-public:
- PolicyEntry();
- PolicyEntry(PolicyEntry &&other);
- ~PolicyEntry();
- void setApp(const std::string &appId);
- void setUser(const std::string &user);
- void setPrivilege(const std::string &privilege);
- void setLevel(const std::string &level);
-
- policy_entry *get() const { return m_entry; }
-
-private:
- policy_entry *m_entry;
-};
-
-class PolicyRequest {
-public:
- PolicyRequest();
- ~PolicyRequest();
- void addEntry(PolicyEntry &&entry);
- void updatePolicy();
-
-private:
- policy_update_req *m_req;
- std::vector<PolicyEntry> m_entries;
-};
-
-} /* namespace AskUser */
/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <exception/Exception.h>
#include <log/alog.h>
-
+#include <policy/Policy.h>
#include <policy/PrivilegeInfo.h>
-#include "Policy.h"
#include "PolicyUpdater.h"
namespace AskUser {
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/agent/notification-daemon/AskUserTalker.cpp
+ * @author Oskar Ĺwitalski <o.switalski@samsung.com>
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Definition of AskUserTalker class
+ */
+
+#include "AskUserTalker.h"
+
+#include <signal.h>
+#include <string>
+#include <sys/signalfd.h>
+
+#include <policy/Policy.h>
+#include <policy/PrivilegeInfo.h>
+#include <socket/Socket.h>
+#include <socket/Poll.h>
+#include <types/NotificationResponse.h>
+#include <types/NotificationRequest.h>
+#include <exception/ErrnoException.h>
+#include <exception/Exception.h>
+#include <translator/Translator.h>
+#include <config/Path.h>
+
+#ifdef BUILD_WITH_SYSTEMD_DAEMON
+#include <systemd/sd-daemon.h>
+#endif
+
+namespace AskUser {
+
+namespace Notification {
+
+namespace {
+
+} /* namespace */
+
+void AskUserTalker::dissmissCb(int fd, void *data) {
+ AskUserTalker *talker = static_cast<AskUserTalker*>(data);
+ if (fd == talker->m_currentPeerSocket.getFd()) {
+ ALOGD("Client behaved incorrectly");
+ // I would close client socket here but ecore loop doesn't like closing fd while in handler
+ } else if (fd == talker->m_signalSocket.getFd()) {
+ ALOGD("Got signal to close");
+ talker->m_running = false;
+ }
+}
+
+AskUserTalker::AskUserTalker()
+ : m_poller(2),
+ m_signalSocket(Socket::PeerType::SIGNAL),
+ m_serverSocket(Socket::PeerType::SERVER),
+ m_currentPeerSocket(Socket::PeerType::PEER)
+{}
+
+void AskUserTalker::setSignalDescriptor() {
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGTERM);
+
+ if (pthread_sigmask(SIG_BLOCK, &mask, NULL) < 0) {
+ throw ErrnoException("Couldn't set signal mask");
+ }
+
+ int signalFd = signalfd(-1, &mask, 0);
+ if (signalFd < 0) {
+ throw ErrnoException("Couldn't create signalfd");
+ }
+
+ m_signalSocket.setFd(signalFd);
+ m_poller.setEvents(m_signalSocket.getFd(), POLLIN);
+
+ ALOGD("Signal descriptor set for " << m_signalSocket.getFd());
+}
+
+void AskUserTalker::init() {
+#ifdef BUILD_WITH_SYSTEMD_DAEMON
+ int systemdFdCount = sd_listen_fds(0);
+ if (systemdFdCount < 0) {
+ ALOGE("Error in sd_listen_fds");
+ throw Exception("Couldn't setup systemd socket");
+ }
+ if (systemdFdCount > 1) {
+ ALOGE("Systemd passed to many sockets");
+ throw Exception("Too many sockets passed");
+ }
+
+ m_serverSocket.setFd(SD_LISTEN_FDS_START);
+ if (m_serverSocket.getFd() == -1) {
+ ALOGE("Failed to set socket fd from systemd");
+ throw Exception("Cannot set socket from systemd");
+ }
+
+ int ret = sd_notify(0, "READY=1");
+ if (ret == 0) {
+ ALOGW("Agent was not configured to notify its status");
+ } else if (ret < 0) {
+ ALOGE("sd_notify failed: [" << ret << "]");
+ }
+#else
+ m_serverSocket.bindAndListen(Path::getUserSocketPath(getuid()));
+#endif
+ m_poller.setEvents(m_serverSocket.getFd(), POLLIN);
+ setSignalDescriptor();
+ m_gui.setLocale();
+ m_gui.initialize();
+ ALOGD("Initialized");
+}
+
+bool AskUserTalker::fetchRequest(NotificationRequest &request) {
+ std::string requestData;
+
+ if (!m_currentPeerSocket.recv(requestData)) {
+ ALOGI("Failed fetching request, closing...");
+ return false;
+ }
+
+ request = Translator::Gui::dataToNotificationRequest(requestData);
+ ALOGD("Recieved data " << request.data.client << " " << request.data.privilege);
+
+ return true;
+}
+
+bool AskUserTalker::sendResponse(const NotificationResponse &response) {
+ if (!m_currentPeerSocket.send(static_cast<int>(response.id))) {
+ ALOGI("Askuserd closed connection, closing...");
+ return false;
+ }
+ if (!m_currentPeerSocket.send(static_cast<int>(response.response))) {
+ ALOGI("Askuserd closed connection, closing...");
+ return false;
+ }
+ return true;
+}
+
+void AskUserTalker::handlePeer() {
+ NotificationRequest request;
+ if (!fetchRequest(request)) {
+ ALOGE("Couldn't fetch request, closing...");
+ return;
+ }
+
+ m_gui.addDismissFd(m_currentPeerSocket.getFd(), AskUserTalker::dissmissCb, this);
+
+ NotificationResponse response;
+ m_gui.setLocale();
+ response.response = m_gui.popupRun(request.data.client,
+ PrivilegeInfo::getPrivacyDisplayName(request.data.privilege));
+
+ m_gui.delDismissFd(m_currentPeerSocket.getFd());
+
+ response.id = request.id;
+ if (response.response == NResponseType::None) {
+ return;
+ }
+
+ if (!sendResponse(response)) {
+ ALOGE("Couldn't send response, closing...");
+ return;
+ }
+
+ switch (response.response) {
+ case NResponseType::Error:
+ ALOGE("Error in user interface : " << m_gui.getErrorMsg());
+ break;
+ case NResponseType::AllowAlways:
+ case NResponseType::DenyAlways:
+ case NResponseType::Deny:
+ case NResponseType::None:
+ ALOGD("Sending response " << static_cast<int>(response.response));
+ break;
+ default:
+ ALOGW("Unknown response type returned");
+ break;
+ }
+ return;
+}
+
+void AskUserTalker::activateCurrentClient() {
+ ALOGD("Activating current peer : " << m_currentPeerSocket.getFd());
+ m_poller.setEvents(m_currentPeerSocket.getFd(), POLLIN | POLLHUP | POLLERR);
+}
+void AskUserTalker::deactivateCurrentClient() {
+ ALOGD("Deactivating current peer : " << m_currentPeerSocket.getFd());
+ m_poller.unset(m_currentPeerSocket.getFd());
+}
+
+void AskUserTalker::switchToNextClient() {
+ deactivateCurrentClient();
+ m_currentPeerSocket.close();
+ if (m_pendingPeers.empty()) {
+ ALOGD("No pending peers");
+ return;
+ }
+ m_currentPeerSocket = std::move(m_pendingPeers.front());
+ m_pendingPeers.pop_front();
+ activateCurrentClient();
+ ALOGD("Setting current peer : " << m_currentPeerSocket.getFd());
+}
+
+void AskUserTalker::addNewClient(Socket &&newPeer) {
+ if (m_currentPeerSocket.getFd() == -1) {
+ ALOGD("Setting current peer : " << newPeer.getFd());
+ m_currentPeerSocket = std::move(newPeer);
+ activateCurrentClient();
+ } else {
+ m_pendingPeers.emplace_back(std::move(newPeer));
+ ALOGD("Pushing peer to queue : " << newPeer.getFd());
+ }
+}
+
+void AskUserTalker::run()
+{
+ m_running = true;
+ m_gui.addDismissFd(m_signalSocket.getFd(), AskUserTalker::dissmissCb, this);
+ while(m_running) {
+ int ret = m_poller.wait(1);
+ if (ret == -1) {
+ ALOGE_ERRNO("Poll failed: ");
+ break;
+ }
+ if (ret == 0) {
+ ALOGD("Poll timeouted...");
+ break;
+ }
+
+ ALOGD("Poll returned " << ret << " events");
+ // signal fd
+ if (m_poller.getEvents(m_signalSocket.getFd()) & POLLIN) {
+ signalfd_siginfo si;
+ if (!m_signalSocket.recv(si)) {
+ ALOGE_ERRNO("Reading signal info failed");
+ break;
+ }
+ if (si.ssi_signo == SIGTERM) {
+ ALOGD("Got signal to exit, closing...");
+ break;
+ } else {
+ ALOGW("Unknown signal caught, ignoring...");
+ }
+ }
+ // listen fd
+ if (m_poller.getEvents(m_serverSocket.getFd()) & POLLIN) {
+ ALOGD("New peer connected");
+ Socket newPeer = std::move(m_serverSocket.accept());
+ if (newPeer.getFd() == -1) {
+ throw ErrnoException("Failed to accept new peer");
+ }
+
+ addNewClient(std::move(newPeer));
+ continue;
+ }
+ // client fd
+ if ((m_poller.getEvents(m_currentPeerSocket.getFd()) & POLLHUP)
+ || (m_poller.getEvents(m_currentPeerSocket.getFd()) & POLLERR)) {
+ LOGW("Peer disconnected or error");
+ switchToNextClient();
+ continue;
+ }
+ if (m_poller.getEvents(m_currentPeerSocket.getFd()) & POLLIN) {
+ // Handle client then switch to next accepted client
+ ALOGD("Fetching request from client");
+ handlePeer();
+ switchToNextClient();
+ }
+ }
+ m_running = false;
+ stop();
+}
+
+void AskUserTalker::stop()
+{
+ m_gui.delDismissFd(m_currentPeerSocket.getFd());
+ m_gui.delDismissFd(m_signalSocket.getFd());
+ m_gui.stop();
+ m_currentPeerSocket.close();
+ for (auto &peer: m_pendingPeers) {
+ peer.close();
+ }
+ m_serverSocket.close();
+}
+
+} /* namespace Notification */
+
+} /* namespace AskUser */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/agent/notification-daemon/AskUserTalker.h
+ * @author Oskar Ĺwitalski <o.switalski@samsung.com>
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of AskUserTalker class
+ */
+
+#pragma once
+
+#include <list>
+
+#include "GuiRunner.h"
+
+#include <socket/Poll.h>
+#include <socket/Socket.h>
+#include <types/NotificationRequest.h>
+#include <types/NotificationResponse.h>
+
+namespace AskUser {
+
+namespace Notification {
+
+class AskUserTalker
+{
+public:
+ AskUserTalker();
+
+ void init();
+ void run();
+ void stop();
+
+private:
+ static void dissmissCb(int fd, void *data);
+ void setSignalDescriptor();
+ void activateCurrentClient();
+ void deactivateCurrentClient();
+ void addNewClient(Socket &&newPeer);
+ void switchToNextClient();
+ void handlePeer();
+ bool fetchRequest(NotificationRequest &request);
+ bool sendResponse(const NotificationResponse &response);
+ Poll m_poller;
+ Socket m_signalSocket;
+ Socket m_serverSocket;
+ Socket m_currentPeerSocket;
+ GuiRunner m_gui;
+ std::list<Socket> m_pendingPeers;
+ bool m_dismissPopup = false;
+ bool m_running = false;
+};
+
+} /* namespace Notification */
+
+} /* namespace AskUser */
SET(NOTIF_PATH ${PROJECT_SOURCE_DIR}/src/agent/notification-daemon/)
-PROJECT("askuser-notification")
-# Pass project name to sources
-ADD_DEFINITIONS("-DPROJECT_NAME=\"${PROJECT_NAME}\"")
-
PKG_CHECK_MODULES(ASKUSER_NOTIFICATION_DEP
REQUIRED
elementary
+ cynara-agent
libsystemd
- notification
vconf
- pkgmgr-info
- glib-2.0
capi-ui-efl-util
capi-system-info
- security-privilege-manager
)
INCLUDE_DIRECTORIES(SYSTEM
INCLUDE_DIRECTORIES(
${ASKUSER_PATH}
${ASKUSER_PATH}/common
- ${ASKUSER_PATH}/common/protocol
- ${ASKUSER_PATH}/agent/notification-daemon
)
SET(ASKUSER_NOTIFICATION_SOURCES
${NOTIF_PATH}/main.cpp
- ${NOTIF_PATH}/Logic.cpp
- ${NOTIF_PATH}/ServerCallbacks.cpp
- ${NOTIF_PATH}/ui/Po.cpp
- ${ASKUSER_PATH}/common/log/alog.cpp
- ${ASKUSER_PATH}/common/policy/PrivilegeInfo.cpp
- ${NOTIF_PATH}/ui/Popupper.cpp
+ ${NOTIF_PATH}/GuiRunner.cpp
+ ${NOTIF_PATH}/AskUserTalker.cpp
)
+
ADD_EXECUTABLE(${TARGET_ASKUSER_NOTIFICATION} ${ASKUSER_NOTIFICATION_SOURCES})
SET_TARGET_PROPERTIES(${TARGET_ASKUSER_NOTIFICATION} PROPERTIES
TARGET_LINK_LIBRARIES(${TARGET_ASKUSER_NOTIFICATION}
${ASKUSER_NOTIFICATION_DEP_LIBRARIES}
${TARGET_ASKUSER_COMMON}
- ${TARGET_ASKUSER_NOTIFICATION_LIB}
-pie
)
COMMAND edje_cc -no-save res/popup_custom.edc res/popup_custom.edj
DEPENDS res/popup_custom.edc
)
-ADD_DEPENDENCIES(${TARGET_ASKUSER_NOTIFICATION} popup_custom.edj)
+ADD_DEPENDENCIES(${PROJECT_NAME} popup_custom.edj)
INSTALL(TARGETS ${TARGET_ASKUSER_NOTIFICATION} DESTINATION ${BIN_INSTALL_DIR})
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/ DESTINATION ${RES_DIR} FILES_MATCHING PATTERN "*.png")
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/agent/notification-daemon/GuiRunner.cpp
+ * @author Oskar Ĺwitalski <o.switalski@samsung.com>
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Definition of GuiRunner class
+ */
+
+#include "GuiRunner.h"
+
+#include <exception/ErrnoException.h>
+#include <exception/Exception.h>
+#include <policy/Policy.h>
+#include <translator/Translator.h>
+#include <libintl.h>
+#include <vconf.h>
+#include <efl_util.h>
+#include <system_info.h>
+
+#include <unistd.h>
+
+namespace AskUser {
+
+namespace Notification {
+
+void GuiRunner::unfocused(void *data, Evas_Object *, void *)
+{
+ ALOGD("Unfocused");
+ GuiRunner *runner = static_cast<GuiRunner*>(data);
+
+ if (runner->m_shouldRaise) {
+ evas_object_show(runner->m_win);
+ } else {
+ for (auto &fdCbData : runner->m_fdCbDataMap) {
+ ecore_main_fd_handler_del(fdCbData.second.handler);
+ }
+ ecore_main_loop_iterate();
+ elm_exit();
+ }
+
+}
+
+void GuiRunner::winClose()
+{
+ ALOGD("Window close");
+ m_shouldRaise = false;
+ evas_object_hide(m_win);
+}
+
+// responseMap[allow][always]
+const NResponseType responseMap[2][2] = {
+ { NResponseType::Deny, NResponseType::DenyAlways },
+ { NResponseType::AllowAlways, NResponseType::AllowAlways }
+};
+
+void GuiRunner::answer(bool allow)
+{
+ Eina_Bool always = EINA_FALSE;
+
+ if (!m_hwKeyClicked)
+ always = elm_check_state_get(m_checkbox);
+ else
+ m_hwKeyClicked = false;
+
+ m_popupResponse = responseMap[allow][always];
+
+ ALOGD("User selected: " + Translator::Gui::responseToString(m_popupResponse));
+
+ winClose();
+}
+
+void GuiRunner::allowAnswerCb(void *data, Evas_Object *, void *)
+{
+ GuiRunner* runner = static_cast<GuiRunner*>(data);
+ runner->answer(true);
+}
+
+void GuiRunner::denyAnswerCb(void *data, Evas_Object *, void *)
+{
+ GuiRunner* runner = static_cast<GuiRunner*>(data);
+ runner->answer(false);
+}
+
+Eina_Bool GuiRunner::hwKeyClickedCb(void *data, int type, void *event)
+{
+ Ecore_Event_Key *ev = (Ecore_Event_Key*)event;
+ GuiRunner* runner = static_cast<GuiRunner*>(data);
+ ALOGD("HW button pressed. type <" << type << "> pressed key is <" << ev->key << ">");
+ runner->m_hwKeyClicked = true;
+ if (!strcmp("XF86Home", ev->key) || !strcmp("XF86Back", ev->key)) {
+ ALOGD("Close the window and respond as deny once.");
+ runner->m_shouldRaise = false;
+ runner->answer(false);
+ }
+ return EINA_TRUE;
+}
+
+Eina_Bool GuiRunner::dismissFdCb(void *data, Ecore_Fd_Handler *handler) {
+ ALOGD("Dismiss fd awoken");
+ GuiRunner *runner = static_cast<GuiRunner*>(data);
+
+ int fd = ecore_main_fd_handler_fd_get(handler);
+ if (fd == -1) {
+ ALOGE("Failed to fetch fd from handler");
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ ALOGD("Dismiss descriptor " << fd << " is active, closing window...");
+ auto fdIt = runner->m_fdCbDataMap.find(fd);
+ if (fdIt == runner->m_fdCbDataMap.end())
+ return ECORE_CALLBACK_CANCEL;
+
+ auto cbData = fdIt->second;
+ cbData.userCb(fd, cbData.userData);
+ runner->m_fdCbDataMap.erase(fdIt);
+
+ runner->winClose();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+GuiRunner::~GuiRunner()
+{
+ for (auto &fdCbData : m_fdCbDataMap) {
+ ecore_main_fd_handler_del(fdCbData.second.handler);
+ }
+}
+
+void GuiRunner::delDismissFd(int fd)
+{
+ auto fdIt = m_fdCbDataMap.find(fd);
+ if (fdIt == m_fdCbDataMap.end())
+ return;
+ ecore_main_fd_handler_del(fdIt->second.handler);
+ m_fdCbDataMap.erase(fdIt);
+}
+
+void GuiRunner::addDismissFd(int fd, DissmissCb cb, void *data)
+{
+ delDismissFd(fd);
+
+ auto handler = ecore_main_fd_handler_add(fd,
+ // Thank you efl for this ugly code
+ static_cast<Ecore_Fd_Handler_Flags>(ECORE_FD_READ | ECORE_FD_ERROR),
+ &GuiRunner::dismissFdCb, this,
+ nullptr, nullptr);
+ if (handler == nullptr) {
+ throw Exception("Couldn't set fd handler");
+ }
+
+ m_fdCbDataMap[fd] = CbData{cb, data, handler};
+}
+
+void GuiRunner::initialize()
+{
+ char *popupTitle = dgettext(PROJECT_NAME, "IDS_IDLE_HEADER_PRIVACY_REQUEST");
+ char *checkBoxText = dgettext(PROJECT_NAME, "IDS_ST_OPT_DONT_SHOW_AGAIN");
+ elm_init(0, NULL);
+
+ m_win = elm_win_add(NULL, popupTitle, ELM_WIN_NOTIFICATION);
+ if (!m_win) {
+ ALOGE("EFL : Failed to add window");
+ throw Exception("Elementary failed");
+ }
+ efl_util_set_notification_window_level(m_win, EFL_UTIL_NOTIFICATION_LEVEL_TOP);
+
+ if (elm_win_wm_rotation_supported_get(m_win)) {
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(m_win, (const int *)(&rots), 4);
+ }
+
+ elm_win_autodel_set(m_win, EINA_TRUE);
+ elm_win_override_set(m_win, EINA_TRUE);
+ elm_win_alpha_set(m_win, EINA_TRUE);
+
+ char *profileName = nullptr;
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ if (!profileName) {
+ ALOGE("profileName is NULL");
+ throw Exception("get profileName failed");
+ }
+ std::unique_ptr<char, decltype(free)*> profileNamePtr(profileName, free);
+ if (*profileName != 'w' && *profileName != 'W') {
+ // popup
+ m_popup = elm_popup_add(m_win);
+ if (!m_popup) {
+ ALOGE("EFL : Failed to add popup");
+ throw Exception("Elementary failed");
+ }
+ elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_object_part_text_set(m_popup, "title,text", popupTitle);
+ evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ // layout
+ m_layout = elm_layout_add(m_popup);
+ elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_checkview_layout_mobile");
+ evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ // content
+ m_content = elm_label_add(m_layout);
+ if (!m_content) {
+ ALOGE("EFL : Failed to add content");
+ throw Exception("Enlightement failed");
+ }
+ elm_object_style_set(m_content, "popup/default");
+ elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
+
+ // checkbox
+ m_checkbox = elm_check_add(m_layout);
+ if (!m_checkbox) {
+ ALOGE("EFL : Failed to add checkbox");
+ throw Exception("Enlightement failed");
+ }
+ elm_object_part_content_set(m_layout, "elm.swallow.end", m_checkbox);
+ elm_object_text_set(m_checkbox, checkBoxText);
+ elm_check_state_set(m_checkbox, EINA_FALSE);
+ evas_object_show(m_checkbox);
+
+ // buttons
+ m_denyButton = elm_button_add(m_popup);
+ if (!m_denyButton) {
+ ALOGE("EFL : Failed to add deny button");
+ throw Exception("Enlightement failed");
+ }
+ elm_object_part_content_set(m_popup, "button1", m_denyButton);
+ elm_object_text_set(m_denyButton, dgettext(PROJECT_NAME,
+ "IDS_IDLE_BUTTON_DENY"));
+
+ m_allowButton = elm_button_add(m_popup);
+ if (!m_allowButton) {
+ ALOGE("EFL : Failed to add allow button");
+ throw Exception("Enlightement failed");
+ }
+ elm_object_part_content_set(m_popup, "button2", m_allowButton);
+ elm_object_text_set(m_allowButton, dgettext(PROJECT_NAME,
+ "IDS_IDLE_BUTTON_ALLOW_ABB7"));
+ elm_object_content_set(m_popup, m_layout);
+ evas_object_show(m_popup);
+
+ } else {
+ Evas_Object *icon;
+
+ m_popup = elm_popup_add(m_win);
+ elm_object_style_set(m_popup, "circle");
+
+ m_layout = elm_layout_add(m_popup);
+ elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
+ elm_object_part_text_set(m_layout, "elm.text.title", popupTitle);
+ elm_object_content_set(m_popup, m_layout);
+
+ m_layoutInner = elm_layout_add(m_layout);
+ elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
+ evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
+
+ m_content = elm_label_add(m_layoutInner);
+ elm_object_style_set(m_content, "popup/default");
+ elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(m_layoutInner, "label", m_content);
+
+
+ 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);
+
+ m_allowButton = elm_button_add(m_popup);
+ elm_object_style_set(m_allowButton, "popup/circle/right");
+ elm_object_part_content_set(m_popup, "button2", m_allowButton);
+
+ icon = elm_image_add(m_allowButton);
+ elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
+ evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
+ evas_object_show(icon);
+
+ m_denyButton = elm_button_add(m_popup);
+ elm_object_style_set(m_denyButton, "popup/circle/left");
+ elm_object_part_content_set(m_popup, "button1", m_denyButton);
+
+ icon = elm_image_add(m_denyButton);
+ elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
+ elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
+ evas_object_show(icon);
+
+ evas_object_show(m_popup);
+ }
+ // callbacks
+ elm_win_indicator_opacity_set(m_win, ELM_WIN_INDICATOR_OPAQUE);
+ elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
+ evas_object_smart_callback_add(m_win, "unfocused", &GuiRunner::unfocused, this);
+ evas_object_smart_callback_add(m_allowButton, "clicked", &GuiRunner::allowAnswerCb, this);
+ evas_object_smart_callback_add(m_denyButton, "clicked", &GuiRunner::denyAnswerCb, this);
+ elm_win_keygrab_set(m_win, "XF86Home", 0, 0, 0, ELM_WIN_KEYGRAB_SHARED);
+ elm_win_keygrab_set(m_win, "XF86Back", 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST);
+ ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, &GuiRunner::hwKeyClickedCb, this);
+
+ m_initialized = true;
+}
+
+void GuiRunner::setLocale()
+{
+ char *lang = vconf_get_str(VCONFKEY_LANGSET);
+ if (lang)
+ {
+ elm_language_set(lang);
+ free(lang);
+ }
+ else
+ ALOGE("language_set failed.");
+}
+
+NResponseType GuiRunner::popupRun(const std::string &app, const std::string &perm)
+{
+ try {
+ setLocale();
+ initialize();
+
+ m_running = true;
+ m_hwKeyClicked = false;
+
+ std::string appId;
+ std::string pkgLabel;
+ identifyApp(app, std::to_string(getuid()), appId, pkgLabel);
+
+ // create message
+ char *messageFormat = dgettext(PROJECT_NAME, "IDS_IDLE_POP_ALLOW_P1SS_TO_ACCESS_YOUR_P2SS_Q");
+ char buf[BUFSIZ];
+ int ret = std::snprintf(buf, sizeof(buf), messageFormat,
+ pkgLabel.c_str(),
+ perm.c_str());
+
+ if (ret < 0)
+ throw ErrnoException("snprintf failed", errno);
+
+ m_popupResponse = NResponseType::None;
+
+ m_shouldRaise = true;
+
+ elm_object_text_set(m_content, buf);
+
+ evas_object_show(m_popup);
+ evas_object_show(m_win);
+
+ ALOGD("Showing popup");
+ elm_run();
+ ALOGD("Popup closed");
+
+ m_running = false;
+ m_shouldRaise = false;
+ elm_win_keygrab_unset(m_win, "XF86Home", 0, 0);
+ elm_win_keygrab_unset(m_win, "XF86Back", 0, 0);
+
+ evas_object_del(m_win);
+ m_win = nullptr;
+ } catch (const std::exception &e) {
+ m_popupResponse = NResponseType::Error;
+ m_errorMsg = std::move(e.what());
+ }
+
+ return m_popupResponse;
+}
+
+void GuiRunner::stop()
+{
+
+}
+
+} /* namespace Notification */
+
+} /* namespace AskUser */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/agent/notification-daemon/GuiRunner.h
+ * @author Oskar Ĺwitalski <o.switalski@samsung.com>
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Declaration of GuiRunner class
+ */
+
+#pragma once
+
+#include <Elementary.h>
+#include <functional>
+#include <map>
+#include <string>
+
+#include <types/NotificationResponse.h>
+#include <log/alog.h>
+
+namespace AskUser {
+
+namespace Notification {
+
+class GuiRunner {
+public:
+ typedef std::function<void(int, void*)> DissmissCb;
+
+ GuiRunner() = default;
+ void initialize();
+ void setLocale();
+ void addDismissFd(int fd, DissmissCb cb, void *data);
+ void delDismissFd(int fd);
+ ~GuiRunner();
+
+ NResponseType popupRun(const std::string &app, const std::string &perm);
+ void stop();
+
+ std::string getErrorMsg() { return m_errorMsg; }
+
+private:
+ static Eina_Bool dismissFdCb(void *data, Ecore_Fd_Handler *handler);
+ static void unfocused(void *data, Evas_Object *, void *);
+ static void allowAnswerCb(void *data, Evas_Object *, void *);
+ static void denyAnswerCb(void *data, Evas_Object *, void *);
+ static Eina_Bool hwKeyClickedCb(void *data, int type, void *event);
+
+ void answer(bool allow);
+ void winClose();
+
+ struct CbData {
+ DissmissCb userCb;
+ void *userData;
+ Ecore_Fd_Handler *handler;
+ };
+
+ std::map<int, CbData> m_fdCbDataMap;
+ NResponseType m_popupResponse = NResponseType::Error;
+
+ Evas_Object *m_win = nullptr;
+ Evas_Object *m_popup = nullptr;
+ Evas_Object *m_layout = nullptr;
+ Evas_Object *m_layoutInner = nullptr;
+ Evas_Object *m_content = nullptr;
+ Evas_Object *m_checkbox = nullptr;
+ Evas_Object *m_allowButton = nullptr;
+ Evas_Object *m_denyButton = nullptr;
+
+ bool m_running = false;
+ bool m_initialized = false;
+ bool m_shouldRaise = false;
+ bool m_hwKeyClicked = false;
+
+ std::string m_errorMsg;
+};
+
+} /* namespace Notification */
+
+} /* namespace AskUser */
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/Service.cpp
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of Popupper class
- */
-
-#include "Logic.h"
-
-#include <algorithm>
-#include <signal.h>
-#include <string>
-#include <sys/signalfd.h>
-#include <vconf.h>
-#include <Elementary.h>
-
-#include <exception/Exception.h>
-#include <exception/ErrnoException.h>
-#include "ServerCallbacks.h"
-
-namespace AskUser {
-
-namespace Notification {
-
-void Logic::addChannelFd(int fd, Ecore_Fd_Handler_Flags flags) {
- auto it = m_fdInfo.find(fd);
- if (it != m_fdInfo.end()) {
- m_fdInfo[fd].status = FdChange::CHANGE;
- ecore_main_fd_handler_del(m_fdInfo[fd].handler);
- }
-
- auto handler = ecore_main_fd_handler_add(fd, flags, &Logic::clientChHandler, this, nullptr, nullptr);
- if (handler == nullptr) {
- ALOGE("Couldn't set fd handler");
- return;
- }
- m_fdInfo[fd].handler = handler;
- m_fdInfo[fd].status = FdChange::NONE;
-}
-
-void Logic::removeChannelFd(int fd) {
- auto it = m_fdInfo.find(fd);
- if (it == m_fdInfo.end()) {
- return;
- }
- it->second.status = FdChange::DEL;
- ecore_main_fd_handler_del(it->second.handler);
-}
-
-Eina_Bool Logic::clientChHandler(void *data, Ecore_Fd_Handler *handler) {
- Logic *service = static_cast<Logic *>(data);
- int fd = ecore_main_fd_handler_fd_get(handler);
- if (fd == -1) {
- ALOGE("Failed to fetch fd from handler");
- return ECORE_CALLBACK_CANCEL;
- }
- int mask = 0;
- if (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ)) {
- mask = AskUser::Protocol::READ;
- } else if (ecore_main_fd_handler_active_get(handler, ECORE_FD_WRITE)) {
- mask = AskUser::Protocol::WRITE;
- }
- return service->processChannel(fd, mask);
-}
-
-Eina_Bool Logic::processChannel(int fd, int mask) {
- m_fdInfo[fd].status = FdChange::NONE;
- updateChannel(fd, mask);
-
- switch (m_fdInfo[fd].status) {
- case FdChange::NONE:
- return ECORE_CALLBACK_RENEW;
- case FdChange::DEL: {
- // Remove all pending events from this fd
- auto queueIt = std::remove_if(m_pendingEvents.begin(), m_pendingEvents.end(), [fd](const FdEvent &fdEvent) {return fdEvent.fd == fd;});
- m_pendingEvents.erase(queueIt, m_pendingEvents.end());
-
- // Handle next event if removed active fd
- if (fd == m_currentFd) {
- finishCurrentEvent();
- processEvents();
- }
- m_fdInfo.erase(fd);
- return ECORE_CALLBACK_CANCEL;
- }
- case FdChange::CHANGE:
- return ECORE_CALLBACK_CANCEL;
- default:
- ALOGE("Unexpected fd change value : " << static_cast<int>(m_fdInfo[fd].status));
- return ECORE_CALLBACK_CANCEL;
- }
-}
-
-void Logic::addEvent(IUIEvent *event) {
- FdEvent fdEvent{m_currentFd, std::unique_ptr<IUIEvent>(event)};
- m_pendingEvents.emplace_back(std::move(fdEvent));
- processEvents();
-}
-
-bool Logic::isEventProcessed() {
- return m_currentEventId != -1;
-}
-
-void Logic::finishCurrentEvent() {
- m_popupper.popupClose(m_currentEventId);
- m_currentEventId = -1;
- m_currentFd = -1;
-}
-
-void Logic::processEvents() {
- // Active event processing
- if (isEventProcessed())
- return;
-
- // No pending events
- if (m_pendingEvents.empty())
- return;
-
- FdEvent fdEvent = std::move(m_pendingEvents.front());
- m_currentFd = fdEvent.fd;
- m_currentEventId = fdEvent.event->getId();
- m_pendingEvents.pop_front();
-
- fdEvent.event->process();
-}
-
-void Logic::registerSignalFd() {
- // TODO use ecore event EXIT?
- sigset_t mask;
- sigemptyset(&mask);
- sigaddset(&mask, SIGTERM);
-
- if (pthread_sigmask(SIG_BLOCK, &mask, NULL) < 0) {
- throw ErrnoException("Couldn't set signal mask");
- }
-
- int signalFd = signalfd(-1, &mask, 0);
- if (signalFd < 0) {
- throw ErrnoException("Couldn't create signalfd");
- }
- auto handler = ecore_main_fd_handler_add(signalFd, ECORE_FD_READ, &Logic::signalHandler, this, nullptr, nullptr);
- if (handler == nullptr) {
- throw Exception("Couldn't set fd handler");
- }
-}
-
-void Logic::stop() {
- if (isEventProcessed())
- finishCurrentEvent();
- m_popupper.stop();
-}
-
-Eina_Bool Logic::signalHandler(void *data, Ecore_Fd_Handler *) {
- Logic *logic = static_cast<Logic*>(data);
- logic->stop();
- return ECORE_CALLBACK_CANCEL;
-}
-
-void Logic::prepareChannel() {
- m_clientChannel = AskUser::Protocol::createChannel(
- std::unique_ptr<AskUser::Protocol::IServerCallbacks>(new AskUser::Protocol::ServerCallbacks(this, &m_popupper)));
-}
-
-void Logic::updateChannel(int fd, int mask) {
- // TODO errors?
- m_clientChannel->process(fd, mask);
-}
-
-void Logic::init() {
- init_agent_log();
- m_popupper.setLocale();
- m_popupper.initialize();
- m_popupper.registerPopupResponseHandler([&](int popupId, NResponseType response) { popupResponse(popupId, response);});
- m_popupper.registerToastFinishedHandler([&](int toastId) {toastFinished(toastId);});
-
- registerSignalFd();
-
- prepareChannel();
-}
-
-void Logic::run() {
- // TODO ensure we won't throw inside ecore loop
- m_popupper.start();
- m_popupper.shutdown();
-}
-
-void Logic::popupResponse(int popupId, NResponseType response) {
- if (popupId != m_currentEventId) {
- ALOGD("Got different popup id than is being processed");
- return;
- }
- int clientResponse;
- // TODO translate ui response to policy result
- switch (response) {
- case NResponseType::Deny:
- clientResponse = ASKUSER_DENY_ONCE;
- break;
- case NResponseType::DenyAlways:
- clientResponse = ASKUSER_DENY_FOREVER;
- break;
- case NResponseType::Allow:
- clientResponse = ASKUSER_ALLOW_ONCE;
- break;
- case NResponseType::AllowAlways:
- clientResponse = ASKUSER_ALLOW_FOREVER;
- break;
- case NResponseType::None:
- clientResponse = ASKUSER_NONE;
- break;
- case NResponseType::Error:
- clientResponse = -255;
- break;
- default:
- clientResponse = -255; // error
- }
- m_clientChannel->popupResponse(popupId, clientResponse);
- finishCurrentEvent();
- processEvents();
-}
-
-void Logic::toastFinished(int toastId) {
- if (toastId != m_currentEventId) {
- ALOGD("Got different toast id than is being processed");
- return;
- }
- finishCurrentEvent();
- processEvents();
-}
-
-} // namespace Notification
-
-} // namepsace AskUser
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/Service.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of Popupper class
- */
-
-#pragma once
-
-#include <map>
-#include <deque>
-#include <askuser-notification/ask-user-service.h>
-#include <event/Event.h>
-
-namespace AskUser {
-
-namespace Notification {
-
-class Logic {
-public:
- class Exception : public std::exception {
- public:
- Exception(std::string &&s) : m_msg(std::move(s)) {}
- const char *what() const throw () {
- return m_msg.c_str();
- }
- private:
- std::string m_msg;
- };
- Logic() : m_currentFd(-1), m_currentEventId(-1), m_isFdDeleted(false) {}
- void init();
- void run();
- void stop();
-
- void addChannelFd(int fd, Ecore_Fd_Handler_Flags flags);
- void removeChannelFd(int fd);
-
- void addEvent(IUIEvent *event);
-
- ~Logic() {}
-private:
- //Initialization
- void registerSignalFd();
- void prepareChannel();
- void updateChannel(int fd, int mask);
-
- // Descriptor handlers
- static Eina_Bool clientChHandler(void *data, Ecore_Fd_Handler *handler);
- static Eina_Bool signalHandler(void *data, Ecore_Fd_Handler *handler);
- //static Eina_Bool signalHandler(void *data, int type, void *event);
-
- Eina_Bool processChannel(int fd, int mask);
- void processEvents();
- bool isEventProcessed();
- void finishCurrentEvent();
- void popupResponse(int popupId, NResponseType response);
- void toastFinished(int toastId);
-
- AskUser::Protocol::ChannelPtr m_clientChannel;
- Popupper m_popupper;
-
- struct FdEvent {
- int fd;
- std::unique_ptr<IUIEvent> event;
- };
-
- // Workaround for no information about to which fd event belongs to
- int m_currentFd;
- int m_currentEventId;
- int m_isFdDeleted;
- std::deque<FdEvent> m_pendingEvents;
-
- enum class FdChange {
- NONE,
- ADD,
- CHANGE,
- DEL
- };
- struct FdInfo {
- Ecore_Fd_Handler* handler;
- FdChange status;
- };
-
- std::map<int, FdInfo> m_fdInfo;
-};
-
-} // namespace Notification
-
-} // namespace AskUser
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ServerCallbacks.cpp
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Implementation ServerCallbacks classes
- */
-#include <unistd.h>
-
-#include "ServerCallbacks.h"
-#include "event/Event.h"
-
-namespace {
-Ecore_Fd_Handler_Flags maskToFlags(int mask) {
- int flags = ECORE_FD_ERROR;
- if (mask & AskUser::Protocol::READ)
- flags |= static_cast<int>(ECORE_FD_READ);
- if (mask & AskUser::Protocol::WRITE)
- flags |= static_cast<int>(ECORE_FD_WRITE);
- return static_cast<Ecore_Fd_Handler_Flags>(flags);
-}
-}
-
-namespace AskUser {
-namespace Protocol {
-
-void ServerCallbacks::updateFd(int fd, int mask) {
- if (mask == 0)
- m_service->removeChannelFd(fd);
- else
- m_service->addChannelFd(fd, maskToFlags(mask));
-}
-
-void ServerCallbacks::popup_launch(int requestId, const std::string &pkgName,
- const std::string &appName, uid_t,
- const AskUser::Protocol::PrivilegeVector &privileges)
-{
- m_service->addEvent(new AskUser::Notification::EventPopupLaunch(m_popupper, requestId, appName, pkgName, privileges));
-}
-void ServerCallbacks::toast_deny(const std::string &pkgName, const std::string &appName,
- uid_t, const AskUser::Protocol::Privilege &privilege)
-{
- m_service->addEvent(new AskUser::Notification::EventToastDeny(m_popupper, 0, appName, pkgName, privilege));
-}
-void ServerCallbacks::toast_fail_launch(const std::string &pkgName, const std::string &appName,
- uid_t)
-{
- m_service->addEvent(new AskUser::Notification::EventToastFail(m_popupper, 0, appName, pkgName));
-}
-
-} /* namespace Notification */
-} /* namespace Askuser */
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ServerCallbacks.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of ServerCallbacks classes
- */
-#pragma once
-
-#include <memory>
-
-#include <askuser-notification/ask-user-service.h>
-
-#include "Logic.h"
-#include "ui/Popupper.h"
-
-namespace AskUser {
-namespace Protocol {
-
-class ServerCallbacks : public IServerCallbacks {
-public:
- ServerCallbacks(AskUser::Notification::Logic *logic, AskUser::Notification::Popupper *popupper)
- : m_service(logic), m_popupper(popupper)
- {}
- virtual void updateFd(int fd, int mask);
- virtual void popup_launch(int requestId, const std::string &pkgName,
- const std::string &appName, uid_t uid,
- const AskUser::Protocol::PrivilegeVector &privileges);
- virtual void toast_deny(const std::string &pkgName, const std::string &appName,
- uid_t uid, const AskUser::Protocol::Privilege &privilege);
- virtual void toast_fail_launch(const std::string &pkgName, const std::string &appName,
- uid_t uid);
- virtual ~ServerCallbacks() {}
-private:
- AskUser::Notification::Logic *m_service;
- AskUser::Notification::Popupper *m_popupper;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/event/Event.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of main loop Event classes
- */
-
-#pragma once
-
-#include <string>
-#include <vector>
-
-#include <ui/Popupper.h>
-
-namespace AskUser {
-namespace Notification {
-
-class IUIEvent {
-public:
- IUIEvent(Popupper *popupper) : m_popupper(popupper), m_eventId(-1) {}
- virtual void process() = 0;
- void setId(int id) { m_eventId = id; }
- int getId() { return m_eventId; }
- virtual ~IUIEvent() {}
-protected:
- Popupper *m_popupper;
- int m_eventId;
-};
-
-class EventPopupCheck : public IUIEvent {
-public:
- EventPopupCheck(Popupper *popupper, int popupId, const std::string &appName,
- const std::string &pkgName, const std::string &privilege)
- : IUIEvent(popupper), m_popupId(popupId), m_appName(appName),
- m_pkgName(pkgName), m_privilege(privilege)
- {
- setId(popupId);
- }
-
- virtual void process() {
- m_popupper->popupCheck(m_popupId, m_appName, m_pkgName, m_privilege);
- }
-private:
- int m_popupId;
- std::string m_appName;
- std::string m_pkgName;
- std::string m_privilege;
-};
-
-class EventPopupLaunch : public IUIEvent {
-public:
- EventPopupLaunch(Popupper *popupper, int popupId, const std::string &appName,
- const std::string &pkgName, const std::vector<std::string> &privileges)
- : IUIEvent(popupper), m_popupId(popupId), m_appName(appName),
- m_pkgName(pkgName), m_privileges(privileges)
- {
- setId(popupId);
- }
-
- virtual void process() {
- m_popupper->popupLaunch(m_popupId, m_appName, m_pkgName, m_privileges);
- }
-private:
- int m_popupId;
- std::string m_appName;
- std::string m_pkgName;
- std::vector<std::string> m_privileges;
-};
-
-class EventToastDeny : public IUIEvent {
-public:
- EventToastDeny(Popupper *popupper, int toastId, const std::string &appName,
- const std::string &pkgName, const std::string &privilege)
- : IUIEvent(popupper), m_toastId(toastId), m_appName(appName),
- m_pkgName(pkgName), m_privilege(privilege)
- {
- setId(toastId);
- }
-
- virtual void process() {
- m_popupper->toastDeny(m_toastId, m_appName, m_pkgName, m_privilege);
- }
-private:
- int m_toastId;
- std::string m_appName;
- std::string m_pkgName;
- std::string m_privilege;
-};
-
-class EventToastFail : public IUIEvent {
-public:
- EventToastFail(Popupper *popupper, int toastId, const std::string &appName,
- const std::string &pkgName)
- : IUIEvent(popupper), m_toastId(toastId), m_appName(appName),
- m_pkgName(pkgName)
- {
- setId(toastId);
- }
-
- virtual void process() {
- m_popupper->toastFail(m_toastId, m_appName, m_pkgName);
- }
-private:
- int m_toastId;
- std::string m_appName;
- std::string m_pkgName;
-};
-
-} //namespace AskUser
-} //namespace Notification
-
-
* @brief Main askuser notification daemon file
*/
+#include <clocale>
+#include <csignal>
+#include <cstdlib>
+#include <string>
+#include <thread>
+#include <unistd.h>
+#include <vconf.h>
+
#ifdef BUILD_WITH_SYSTEMD_DAEMON
#include <systemd/sd-daemon.h>
#endif
-#include <exception>
#include <exception/Exception.h>
#include <log/alog.h>
-#include "Logic.h"
+#include "GuiRunner.h"
+#include "AskUserTalker.h"
int main()
{
using namespace AskUser::Notification;
+ init_agent_log();
+ char *lang = vconf_get_str(VCONFKEY_LANGSET);
+ if (lang)
+ {
+ elm_language_set(lang);
+ free(lang);
+ }
+ else
+ ALOGE("language_set failed.");
+
try {
- Logic logic;
- logic.init();
+ AskUserTalker askUserTalker;
+ askUserTalker.init();
#ifdef BUILD_WITH_SYSTEMD_DAEMON
int ret = sd_notify(0, "READY=1");
}
#endif
- logic.run();
+ askUserTalker.run();
} catch (std::exception &e) {
ALOGE("Askuser-notification stopped because of: <" << e.what() << ">.");
} catch (...) {
-# Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
DEPENDS ${absPofile}
)
INSTALL(FILES ${moFile}
- DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME ${TARGET_ASKUSER_NOTIFICATION}.mo)
+ DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
SET(moFiles ${moFiles} ${moFile})
ENDFOREACH(pofile)
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ؚدŮ
اŮؼظŮاع Ů
؏دداŮ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "ŘşŮŘą Ů
ŘłŮ
ŮŘ ŮŮ %1$s باست؎داŮ
%2$s. ŘŘŻŘŻ ؜بء اŮŘŽŘľŮŘľŮŘŠ Ů٠اŮ؜بء > اŮŘŽŘľŮŘľŮŘŠ ŮاŮŘŮ
اŮŘŠ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ءŮب اŮŘŽŘľŮŘľŮŘŠ"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ŘąŮŘś"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "ŘŤŮ
ŘŠ ءŮب Ů
Ů %s ŮŮŘŘľŮŮ ŘšŮ٠ؼذ٠ŮŮŮŘľŮŮ ŘĽŮ٠اŮŘšŮاؾع اŮتاŮŮŘŠ:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "اسŮ
Ř Ř¨Ů٠اŮأذŮŮات ذات اŮŘľŮŘŠ Ůاست؎داŮ
اŮتءبŮŮ."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Bir daha gĂśstÉrmÉ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s-yÉ %2$s-dÉn istifadÉ icazÉsi verilmÉmiĹdir. ParametrlÉr > MÉxfilik vÉ tÉhlĂźkÉsilikdÉn MÉxfilik parametrlÉrini seçin."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "MÉxfilik sorÄusu"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "RÉdd et"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s aĹaÄÄądakÄą elementlÉrÉ Ă§ÄąxĹŠicazÉsi istÉyir:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Proqramdan istifadÉ etmÉk ßçßn bĂźtĂźn mĂźvafiq icazÉlÉri verin."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Đа но ŃĐľ пОкаСва пОвоŃĐľ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s Đ˝ŃПа ĐżŃавО да иСпОНСва %2$s. ĐСйоŃĐľŃĐľ âĐаŃŃŃОКки Са пОвоŃиŃоНнОŃŃâ в ĐаŃŃŃОКки > ĐОвоŃиŃоНнОŃŃ Đ¸ СаŃиŃа."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ĐаŃвка Са пОвоŃиŃоНна инŃĐžŃПаŃиŃ"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ĐŃкаС"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s иŃка ŃаСŃĐľŃонио Са Đ´ĐžŃŃŃĐż Đ´Đž ŃНодниŃĐľ оНоПонŃи:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Đа да иСпОНСваŃĐľ ĐżŃиНОМониоŃĐž, пОСвОНоŃĐľ вŃиŃки ŃвŃŃСани ŃаСŃĐľŃониŃ."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "No tornar a mostrar"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s no tĂŠ permĂs per utilitzar %2$s. Seleccioni Ajustaments de privadesa a Ajustaments > Privadesa i seguretat."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Sol¡licitud de privadesa"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Denegar"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s estĂ demanant permĂs per accedir als elements segĂźents:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Per utilitzar l'aplicaciĂł, concedeixi tots els permisos corresponents."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Znovu nezobrazovat"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s nesmĂ pouĹžĂvat %2$s. Vyberte NastavenĂ soukromĂ v NastavenĂ > Ochrana osobnĂch ĂşdajĹŻ a zabezpeÄenĂ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "PoĹžadavek na ochranu osobnĂch ĂşdajĹŻ"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "OdmĂtnout"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s vyĹžaduje pĹĂstup k nĂĄsledujĂcĂm poloĹžkĂĄm:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Chcete-li pouĹžĂt aplikaci, povolte vĹĄechna pĹĂsluĹĄnĂĄ oprĂĄvnÄnĂ."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Vis ikke igen"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s mĂĽ ikke bruge %2$s. VĂŚlg Fortrolighedsindstillinger under Indstillinger > Fortrolighed og sikkerhed."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Fortrolighedsanmodning"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Afvis"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s anmoder om tilladelse til at fü adgang til følgende elementer:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Hvis du vil bruge appen, skal du aktivere alle relevante tilladelser."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Nicht erneut anzeigen"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s darf %2$s nicht nutzen. Wählen Sie unter âEinstellungen > Gerätesicherheitâ die Option âDatenschutzâ aus."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Datenschutzanfrage"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Ablehnen"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s benĂśtigt eine Berechtigung, um auf die folgenden Elemente zuzugreifen:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Erteilen Sie alle relevanten Genehmigungen, um die App zu verwenden."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ÎÎą ΟΡν ξΟĎινΚĎĎξί ΞινΏ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "Î ÎľĎÎąĎΟογΎ %1$s δξν ÎľĎΚĎĎÎĎÎľĎιΚ νι ĎĎΡĎΚΟοĎοΚΎĎξΚ ĎΡ ΝξΚĎÎżĎ
Ďγίι %2$s. ÎÎľĎιβξίĎÎľ ĎĎÎšĎ ÎĄĎ
θΟίĎÎľÎšĎ > ÎĎĎĎĎΡĎÎż κιΚ ÎąĎĎΏΝξΚι κιΚ ÎľĎΚΝÎΞĎÎľ ÂŤÎĄĎ
θΟίĎÎľÎšĎ ÎąĎĎĎĎΡĎÎżĎ
Âť."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ÎÎŻĎΡĎΡ ÎąĎÎżĎĎÎŽĎÎżĎ
"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ÎĎĎĎĎΚĎΡ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "Î ÎľĎÎąĎΟογΎ %s ΜΡĎΏξΚ ĎĎĎĎβιĎΡ ĎĎÎą ĎÎąĎικΏĎĎ ĎĎοΚĎξίι:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ÎΚι νι ĎĎΡĎΚΟοĎοΚΎĎÎľĎÎľ ĎΡν ÎľĎÎąĎΟογΎ, ĎÎąĎÎąĎĎĎÎŽĎĎÎľ ĎΝι ĎÎą ĎĎÎľĎΚκΏ δΚκιΚĎΟιĎÎą."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Don't show again"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s not allowed to use %2$s. Select Privacy settings in Settings > Privacy and security."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Privacy request"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Deny"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s is requesting permission to access the following items:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "To use app, allow all relevant permissions."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Don't show again"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s not allowed to use %2$s. Select Privacy settings in Settings > Privacy and security."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Privacy request"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Deny"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s is requesting permission to access the following items:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "To use app, allow all relevant permissions."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Don't show again"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s not allowed to use %2$s. Select Privacy settings in Settings > Privacy and security."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Privacy request"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Deny"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s is requesting permission to access the following items:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "To use app, allow all relevant permissions."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "No volver a mostrar"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s no estĂĄ autorizado para utilizar %2$s. Seleccione Ajustes de privacidad en Ajustes > Privacidad y seguridad."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Solicitud de privacidad"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Rechazar"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s estĂĄ solicitando permiso para acceder a los siguientes elementos:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Para usar la aplicaciĂłn, conceda todos los permisos correspondientes."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "No mostrar de nuevo"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s no tiene permiso para usar %2$s. Seleccione Ajustes de privacidad en Ajustes > Privacidad y seguridad."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Solicitud de privacidad"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Rechazar"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s estĂĄ solicitando permiso para acceder a los siguientes elementos:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Para usar la aplicaciĂłn, otorgue todos los permisos necesarios."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ăra näita enam"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "Ăksusel %1$s pole lubatud rakendust %2$s kasutada. Valige privaatsuse seaded menßßs Seaded > Privaatsus ja turvalisus."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Privaatsustaotlus"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Keela"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s taotleb luba järgmistele ßksustele juurdepääsemiseks:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Kinnitage rakenduse kasutamiseks kĂľik vajalikud Ăľigused."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ez erakutsi berriz"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s aplikazioak ez du %2$s erabiltzeko baimenik. Ezarpenak > Pribatutasuna eta segurtasuna atalean, hautatu Pribatutasun ezarpenak."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Pribatutasun eskaera"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Ukatu"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "Hauetan sartzeko baimena eskatzen ari zaizu %s:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Aplikazioa erabiltzeko, eman beharrezko baimenak."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ălä näytä uudelleen"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ei salli resurssien %2$s käyttÜä. Valitse Asetukset > Yksityisyys ja tietoturva ja sitten Tietosuoja-asetukset."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "TietosuojapyyntĂś"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Estä"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s pyytää lupaa seuraavien kohteiden käyttÜÜn:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Jos haluat käyttää sovellusta, myÜnnä kaikki tarvittavat käyttÜoikeudet."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ne plus afficher"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "L'application %1$s n'est pas autorisÊe à utiliser %2$s. SÊlectionnez Paramètres de confidentialitÊ dans Paramètres > ConfidentialitÊ et sÊcuritÊ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Demande de confidentialitĂŠ"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Refuser"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s demande l'autorisation d'accĂŠder aux ĂŠlĂŠments suivants :"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Pour utiliser l'application, accordez toutes les autorisations appropriĂŠes."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ne plus afficher"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "L'application %1$s n'est pas autorisÊe à utiliser %2$s. SÊlectionnez Paramètres de confidentialitÊ dans Paramètres > ConfidentialitÊ et sÊcuritÊ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Demande de confidentialitĂŠ"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Refuser"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s demande l'autorisation d'accĂŠder aux ĂŠlĂŠments suivants :"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Pour utiliser l'application, accordez toutes les autorisations appropriĂŠes."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "NĂĄ taispeĂĄin arĂs"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "NĂ cheadaĂtear do %1$s %2$s a ĂşsĂĄid. Roghnaigh Socruithe prĂobhĂĄide i Socruithe > PrĂobhĂĄid agus slĂĄndĂĄil."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Iarratas prĂobhĂĄide"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "DiĂşltaigh"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "TĂĄ %s ag iarraidh ceada leis na mĂreanna seo a leanas a rochtain:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Leis an bhfeidhmchlĂĄr a ĂşsĂĄid, ceadaigh na ceadanna ĂĄbhartha uile."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Non mostrar de novo"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s non pode utilizar %2$s. Selecciona Axustes de privacidade en Axustes > Privacidade e seguridade."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Solicitude de privacidade"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Denegar"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s estĂĄ solicitando permiso para acceder aos seguintes elementos:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Para usar a aplicaciĂłn, concede todos os permisos correspondentes."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ऍिर स༠न ऌिŕ¤ŕ¤žŕ¤ŕ¤"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ŕ¤ŕĽ %2$s ŕ¤ŕ¤ž ŕ¤ŕ¤Şŕ¤ŻŕĽŕ¤ ŕ¤ŕ¤°ŕ¤¨ŕĽ ŕ¤ŕĽ ŕ¤
नŕĽŕ¤Žŕ¤¤ŕ¤ż नचŕĽŕ¤ चŕĽŕĽ¤ सŕĽŕ¤ŕ¤żŕ¤ŕ¤ŕĽŕ¤¸ > ŕ¤ŕĽŕ¤Şŕ¤¨ŕĽŕ¤Żŕ¤¤ŕ¤ž ŕ¤ŕ¤° सŕĽŕ¤°ŕ¤ŕĽŕ¤ˇŕ¤ž ऎŕĽŕ¤ ŕ¤ŕĽŕ¤Şŕ¤¨ŕĽŕ¤Żŕ¤¤ŕ¤ž सŕĽŕ¤ŕ¤żŕ¤ŕ¤ŕĽŕ¤¸ ŕ¤ŕĽŕ¤¨ŕĽŕ¤ŕĽ¤"
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ŕ¤ŕĽŕ¤Şŕ¤¨ŕĽŕ¤Żŕ¤¤ŕ¤ž ŕ¤
नŕĽŕ¤°ŕĽŕ¤§"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ŕ¤
सŕĽŕ¤ľŕĽŕ¤ŕ¤žŕ¤°ŕĽŕ¤"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s निऎŕĽŕ¤¨ ऎऌŕĽŕ¤ ŕ¤ŕ¤ŕĽŕ¤¸ŕĽŕ¤¸ ŕ¤ŕ¤°ŕ¤¨ŕĽ ŕ¤ŕĽ ŕ¤
नŕĽŕ¤Žŕ¤¤ŕ¤ż ŕ¤ŕ¤ž ŕ¤
नŕĽŕ¤°ŕĽŕ¤§ ŕ¤ŕ¤° रचञ चŕĽ:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ŕ¤ŕ¤Ş ŕ¤ŕ¤ž ŕ¤ŕ¤Şŕ¤ŻŕĽŕ¤ ŕ¤ŕ¤°ŕ¤¨ŕĽ ŕ¤ŕĽ लिŕ¤, सŕ¤ŕĽ सŕ¤ŕ¤Źŕ¤ŕ¤§ŕ¤żŕ¤¤ ŕ¤
नŕĽŕ¤Žŕ¤¤ŕ¤żŕ¤ŻŕĽŕ¤ ŕ¤ŕĽ ŕ¤
नŕĽŕ¤Žŕ¤¤ŕ¤ż ऌŕĽŕ¤ŕĽ¤"
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ne prikazuj viĹĄe"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "Aplikaciji %1$s nije dopuĹĄtena uporaba %2$s. Odaberite Postavke privatnosti u izborniku Postavke > Privatnost i sigurnost."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Zahtjev za pristup privatnim podacima"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Odbij"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s traĹži dopuĹĄtenje za pristup sljedeÄim stavkama:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Da biste upotrebljavali aplikaciju, odobrite sva odgovarajuÄa dopuĹĄtenja."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ne jelenjen meg Ăşjra"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "A(z) %1$s nem rendelkezik engedĂŠllyel a(z) %2$s hasznĂĄlatĂĄhoz. LĂŠpjen be a BeĂĄllĂtĂĄsok > AdatvĂŠdelem ĂŠs biztonsĂĄg menĂźpontba, ĂŠs vĂĄlassza az AdatvĂŠdelmi beĂĄllĂtĂĄsok lehetĹsĂŠget."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "AdatvĂŠdelmi kĂŠrĂŠs"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Tilt"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "A(z) %s hozzĂĄ szeretne fĂŠrni a kĂśvetkezĹ elemekhez:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Az alkalmazĂĄs hasznĂĄlatĂĄhoz adja meg az Ăśsszes megfelelĹ engedĂŠlyt."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ÔąŐľŐŹÖŐ˝ ÖŐ¸ÖŐľÖ ŐšŐżŐĄŐŹ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s-ŐŤŐś ŐšŐŤ ŐŠŐ¸ÖŐľŐŹŐĄŐżÖŐžŐ¸ÖŐ´ Ö
ŐŁŐżŐĄŐŁŐ¸ÖŐŽŐĽŐŹ %2$s: Ô¸ŐśŐżÖŐĽÖ ÔłŐĄŐ˛ŐżŐśŐŤŐ¸ÖŐŠŐľŐĄŐś Ő¤ÖŐžŐĄŐŽÖŐśŐĽÖŐ ŐŁŐśŐĄŐŹŐ¸Őž Ô´ÖŐžŐĄŐŽÖŐśŐĽÖ > ÔłŐĄŐ˛ŐżŐśŐŤŐ¸ÖŐŠŐľŐ¸ÖŐś Ö ŐĄŐśŐžŐżŐĄŐśŐŁŐ¸ÖŐŠŐľŐ¸ÖŐś:"
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ÔłŐĄŐ˛ŐżŐśŐŤŐ¸ÖŐŠŐľŐĄŐś ŐşŐĄŐ°ŐĄŐśŐť"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ŐŐĽÖŐŞŐĽŐŹ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s-Ő¨ Ő°ŐĄÖÖŐśŐ¸ÖŐ´ Ő§ Ő°ŐĽŐżÖŐľŐĄŐŹ ŐżŐĄÖÖŐĽÖŐ¨ Ő´Ő¸ÖŐżÖ ŐŁŐ¸ÖŐŽŐĽŐŹŐ¸Ö ŐŠŐ¸ÖŐľŐŹŐżŐžŐ¸ÖŐŠŐľŐ¸ÖŐśŐ"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ÔžÖŐĄŐŁŐŤÖŐś Ö
ŐŁŐżŐĄŐŁŐ¸ÖŐŽŐĽŐŹŐ¸Ö Ő°ŐĄŐ´ŐĄÖ ŐżŐžŐĽÖ Ő˘Ő¸ŐŹŐ¸Ö Ő°ŐĄŐ´ŐĄŐşŐĄŐżŐĄŐ˝ŐŐĄŐś ŐŠŐ¸ÖŐľŐŹŐżŐžŐ¸ÖŐŠŐľŐ¸ÖŐśŐśŐĽÖŐ¨:"
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ekki sýna aftur"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s hefur ekki leyfi til að nota %2$s. Veldu âPersĂłnuverndarstillingarâ Ă âStillingar > PersĂłnuvernd og Ăśryggiâ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Persónuverndarbeiðni"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Hafna"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s biður um leyfi til að få aðgang að eftirfarandi hlutum:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Til að nota forritið skaltu gefa allar viðeigandi heimildir."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Non mostrare piĂš"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "L'applicazione %1$s non è autorizzata a utilizzare %2$s. Selezionate le impostazioni sulla privacy in Impostazioni > Privacy e protezione."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Richiesta sulla privacy"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Nega"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s sta chiedendo l'autorizzazione per accedere a questi elementi:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Per utilizzare l'applicazione, concedete tutte le autorizzazioni pertinenti."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "äťĺžčĄ¨ç¤şăăŞă"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$săŻă%2$să使ç¨ă§ăăžăăă[č¨ĺŽ] > [ăăŠă¤ăăˇăźă¨ăťăăĽăŞăăŁ]ă§[ăăŠă¤ăăˇăźč¨ĺŽ]ăé¸ćăăŚăă ăăă"
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ăăŠă¤ăăˇăźăŽčŚćą"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ćĺŚ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%să䝼ä¸ăŽă˘ă¤ăă ăŤă˘ăŻăťăšăă樊éăčŚćąăăŚăăžăă"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ă˘ăăŞă使ç¨ăăăŤăŻăé˘éŁăăĺ
¨ăŚăŽć¨Šéă訹ĺŻăăŚăă ăăă"
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ááŚáá áááŠáááá"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s-ᥠáá ááĽáᥠáŁá¤áááá, áááááá§áááᥠ%2$s. áááŽáĄáááá âááá áááá˘á áááâ > âáááá¤áááááŞááááŁá ááá áá áŁáĄáá¤á ááŽááááâ áá ááá áŠááá âááá ááá ááá áááá˘á áááâ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "áááá¤áááááŞááááŁá áááᥠááááŽáááá"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "áŁáá á§áá¤á"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s áááŽááᥠáŹáááááᥠááááá áááᥠá¨ááááááá:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "áááááááŞáá á áá áááááá§áááá, ááááŞáá áĄááááááá ááááá ááááá."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ŇаКŃа ĐşÓŠŃŃĐľŃпоŃ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ŇŻŃŃĐ˝ %2$s паКдаНанŃŇа ŃŇąŇŃĐ°Ń ĐąĐľŃŃНПогон. ĐаŃаПоŃŃĐťĐľŃ > ŇҹпиŃĐťŃĐťŃŇ ĐśÓно ŇаŃŃĐżŃŃСдŃĐş ŃаŃПаŇŃнда ŇҹпиŃĐťŃĐťŃŇ ĐżĐ°ŃаПоŃŃНоŃŃĐ˝ ŃаңдаңŃС."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ŇҹпиŃĐťŃĐťŃŇ ŃŇąŃаŃŃ"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ĐĐ°Ń ŃаŃŃŃ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s коНоŃŃ ŃНоПонŃŃĐľŃго ŇаŃŃнаŃŃ ŃŇąŇŃаŃŃĐ˝ ŃŇąŃаŃда:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ŇĐžĐťĐ´Đ°Đ˝ĐąĐ°Đ˝Ń ĐżĐ°ĐšĐ´Đ°ĐťĐ°Đ˝Ń ŇŻŃŃĐ˝, йаŃĐťŃŇ ŃиŃŃŃŃ ŃŇąŇŃаŃŃаŃĐ´Ń ĐąĐľŃŃŇŁŃС."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ë¤ě ëł´ě§ ě기"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ěąě %2$s í몊ě ěŹěŠí ě ěěľëë¤. [ě¤ě > ę°ě¸ě ëł´ ëł´í¸]ěě [ę°ě¸ě ëł´ ě¤ě ]ě ě ííě¸ě."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ę°ě¸ě ëł´ ěě˛"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "íěŠ ě í¨"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s ěąěě ë¤ě í몊ě ě ꡟě ěě˛íŠëë¤."
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ěąě ěŹěŠíë ¤ëŠ´ 모ë ę´ë ¨ ęśíě íěŠíě¸ě."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Neberodyti"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s neleido naudoti %2$s. Pasirinkite privatumo nustatymus eidami ÄŻ Nustatymai > Privatumas ir sauga."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Privatumo uĹžklausa"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Atmesti"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s praĹĄo leidimo pasiekti ĹĄiuos elementus:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Jei norite naudoti programÄ
, suteikite visus reikiamus leidimus."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Vairs nerÄdÄŤt"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "Programmai %1$s nav atÄźauts lietot %2$s. IzvÄlnÄ IestatÄŤjumi izvÄlieties KonfidencialitÄtes iestatÄŤjumi > KonfidencialitÄte un droĹĄÄŤba."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "KonfidencialitÄtes pieprasÄŤjums"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "NoraidÄŤt"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s pieprasa atÄźauju piekğōt ĹĄÄdiem objektiem:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Lai izmantotu programmu, pieťġiriet visas nepiecieĹĄamÄs atÄźaujas."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ĐĐľ ĐżŃикаМŃĐ˛Đ°Ń ĐżĐžĐ˛ŃĐžŃнО"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s но ŃПоо да кОŃиŃŃи %2$s. ĐСйоŃĐľŃĐľ ĐĐžŃŃавŃваŃа Са ĐżŃиваŃнОŃŃ Đ˛Đž ĐĐžŃŃавŃваŃа > ĐŃиваŃнОŃŃ Đ¸ йоСйоднОŃŃ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ĐаŃаŃĐľ Са ĐżŃиваŃнОŃŃ"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ĐŃŃŃНи"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s йаŃа дОСвОНа да ĐżŃиŃŃапи Đ´Đž ŃНодниво СапиŃи:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Đа да Ńа кОŃиŃŃиŃĐľ апНикаŃиŃаŃа, ОвОСПОМоŃĐľ ги ŃиŃĐľ ŃоНованŃни дОСвОНи."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ikke vis igjen"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s er ikke tillatt ĂĽ bruke %2$s. Velg Personverninnstillinger i Innstillinger > Personvern og sikkerhet."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Personvernforespørsel"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "AvslĂĽ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s ber om tillatelse til ü fü tilgang til følgende elementer:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "For ĂĽ bruke appen mĂĽ du gi alle de relevante tillatelsene."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Niet opnieuw weergeven"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s mag %2$s niet gebruiken. Selecteer Privacy-instellingen in Instellingen > Privacy en beveiliging."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Verzoek om privacy"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Weigeren"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s vraagt toestemming om de volgende items te openen:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Als u de app wilt gebruiken, staat u alle relevante machtigingen toe."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Nie pokazuj ponownie"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "Aplikacja %1$s nie ma uprawnieĹ do uĹźywania zasobĂłw %2$s. PrzejdĹş do opcji Ustawienia prywatnoĹci w menu Ustawienia > PrywatnoĹÄ i bezpieczeĹstwo."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ĹťÄ
danie zwiÄ
zane z prywatnoĹciÄ
"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "OdmĂłw"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "UrzÄ
dzenie %s ĹźÄ
da uprawnienia dostÄpu nastÄpujÄ
cych elementĂłw:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "W celu uĹźywania aplikacji zezwĂłl na wszystkie odpowiednie uprawnienia."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "NĂŁo exibir novamente"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s não permitiu usar %2$s. Selecione Configuraçþes de privacidade em Configuraçþes > Privacidade e segurança."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Solicitação de privacidade"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Negar"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s estĂĄ solicitando permissĂŁo para acessar os seguintes itens:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Para usar o aplicativo, conceda todas as permissĂľes relevantes."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "NĂŁo voltar a mostrar"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s não estå autorizado a utilizar %2$s. Seleccione Definiçþes de privacidade em Definiçþes > Privacidade e segurança."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Pedido de privacidade"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Recusar"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s estĂĄ a pedir permissĂŁo para aceder aos seguintes itens:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Para utilizar a aplicação, autorize todas as permissþes relevantes."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Nu se mai afiČeazÄ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s nu are permisiunea sÄ utilizeze %2$s. SelectaČi SetÄri confidenČialitate din meniul SetÄri > ConfidenČialitate Či securitate."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Solicitare confidenČialitate"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Refuz"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s solicitÄ permisiunea de a accesa urmÄtoarele elemente:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Pentru a utiliza aplicaČia, acordaČi toate permisiunile corespunzÄtoare."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ĐОНŃŃĐľ но пОкаСŃваŃŃ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "ĐОНŃСОваŃĐľĐťŃ %1$s но ŃаСŃĐľŃонО иŃпОНŃСОваŃŃ %2$s. ĐадаКŃĐľ паŃаПоŃŃŃ ĐşĐžĐ˝ŃидонŃиаНŃнОŃŃи в ĐźĐľĐ˝Ń âĐаŃŃŃОКкиâ > âĐОнŃидонŃиаНŃнОŃŃŃ Đ¸ йоСОпаŃнОŃŃŃâ."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ĐапŃĐžŃ Đ˝Đ° ĐżŃодОŃŃавНонио кОнŃидонŃиаНŃĐ˝ŃŃ
даннŃŃ
"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ĐапŃĐľŃиŃŃ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s СапŃаŃĐ¸Đ˛Đ°ĐľŃ ŃаСŃĐľŃонио на Đ´ĐžŃŃŃĐż Đş ŃНодŃŃŃиП ŃНоПонŃаП:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ĐĐťŃ Đ¸ŃпОНŃĐˇĐžĐ˛Đ°Đ˝Đ¸Ń ĐżŃĐ¸ĐťĐžĐśĐľĐ˝Đ¸Ń ĐżŃодОŃŃавŃŃĐľ вŃĐľ ноОйŃ
ОдиПŃĐľ ŃаСŃĐľŃониŃ."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "UĹž nezobrazovaĹĽ"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s nemĂĄ povolenĂŠ pouĹžĂvaĹĽ %2$s. Vyberte poloĹžku Nastavenia sĂşkromia v menu Nastavenia > Ochrana osobnĂ˝ch Ăşdajov a zabezpeÄenie."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Žiadosż o ochranu osobných údajov"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ZamietnuĹĽ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s Ĺžiada o povolenie na prĂstup k nasledujĂşcim poloĹžkĂĄm:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Ak chcete pouĹžĂvaĹĽ tĂşto aplikĂĄciu, udeÄžte vĹĄetky prĂsluĹĄnĂŠ povolenia."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ne pokaĹži znova"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ne sme uporabljati %2$s. V meniju nastavitve > Zasebnost in varnost izberite Nastavitve zasebnosti."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Zahteva za zasebnost"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Zavrni"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "Aplikacija %s zahteva dovoljenje za dostop do naslednjih elementov:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Äe Ĺželite uporabljati aplikacijo, omogoÄite vsa ustrezna dovoljenja."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Ne prikazuj ponovo"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ne sme da koristi %2$s. Izaberite opciju PodeĹĄavanja privatnosti u okviru PodeĹĄavanja > Privatnost i bezbednost."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Zahtev za privatnim informacijama"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Odbij"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "Aplikacija %s traĹži dozvolu da pristupi sledeÄim stavkama:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Da biste koristili aplikaciju, dozvolite sve odgovarajuÄe dozvole."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Visa inte igen"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s har inte tillĂĽtelse att använda %2$s. Ăppna Sekretessinställningar i Inställningar > Sekretess och säkerhet."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Sekretessbegäran"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Neka"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s begär att fü komma üt dessa objekt:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Tillüt alla relevanta behÜrigheter om du vill använda programmet."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Tekrar gĂśsterme"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s için %2$s ĂśÄesini kullanma izni yok. Ayarlar > Gizlilik ve gĂźvenlik bĂślĂźmĂźnde Gizlilik ayarlarÄąnÄą seçin."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Gizlilik isteÄi"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Reddet"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s, aĹaÄÄądaki ĂśÄelere eriĹim izni istiyor:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "UygulamayĹ kullanmak için ilgili izinlerin tßmßnß verin."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ĐŃĐťŃŃĐľ но пОкаСŃваŃи"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "ĐĐžŃиŃŃŃĐ˛Đ°Ń %1$s но ĐźĐ°Ń Đ´ĐžĐˇĐ˛ĐžĐťŃ Đ˝Đ° викОŃиŃŃĐ°Đ˝Đ˝Ń %2$s. ĐĐźŃĐ˝ŃŃŃ ĐżĐ°ŃаПоŃŃи Ń ŃОСдŃĐťŃ ÂŤĐаНаŃŃŃваннŃÂť > ÂŤĐОнŃŃдонŃŃКнŃŃŃŃ Ńа йоСпока."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ĐĐ°ĐżĐ¸Ń Đ˝Đ° Đ˝Đ°Đ´Đ°Đ˝Đ˝Ń ĐşĐžĐ˝ŃŃдонŃŃКниŃ
даниŃ
"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ĐайОŃОниŃи"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "ĐŃОгŃаПа %s СапиŃŃŃ Đ´ĐžĐˇĐ˛ŃĐť на ĐžŃŃĐ¸ĐźĐ°Đ˝Đ˝Ń Đ´ĐžŃŃŃĐżŃ Đ´Đž наŃŃŃпниŃ
ОйâŃĐşŃŃв:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "ĐĐťŃ Đ˛Đ¸ĐşĐžŃиŃŃĐ°Đ˝Đ˝Ń ĐżŃОгŃаПи надаКŃĐľ вŃŃ Đ˛ŃдпОвŃĐ´Đ˝Ń Đ´ĐžĐˇĐ˛ĐžĐťĐ¸."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "Qayta koârsatilmasin"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$sâga %2$sâdan foydalanish uchun ruxsat berilmagan. Parametrlar > Maxfiylik va xavfsizlik menyusida Maxfiylik parametrlarini tanlang."
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "Maxfiylik soârovi"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "Rad etish"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s quyidagi elementlarga kirish uchun ruxsat soâramoqda:"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "Ilovadan foydalanish uchun barcha tegishli ruxsatlarga ijozat bering."
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ä¸ĺćžç¤ş"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ä¸ĺ
čŽ¸ä˝żç¨ %2$să诡čżĺ
Ľă莞罎ă>ăéç§ĺĺŽĺ
¨ăĺšśéćŠăéç§čŽžç˝Žăă"
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "éç§čݎćą"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ćçť"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%sćŁĺ¨čݎćąčŽżéŽäťĽä¸ĺ
厚ç莸ĺŻďź"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "čĽčŚä˝żç¨ĺşç¨ç¨ĺşďźčݎĺ
莸ĺ
¨é¨ç¸ĺ
łćéă"
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ä¸ĺ饯示"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "%1$s ä¸ĺ
č¨ąä˝żç¨ %2$săčŤĺ¨ [č¨ĺŽ] > [éąç§čĺŽĺ
¨] ä¸é¸ć [éąç§č¨ĺŽ]ă"
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "ç§éąčŤćą"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ćçľ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s ćŁĺ¨čŤćąĺĺ䝼ä¸é
çŽçćŹéďź"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "čĽčŚä˝żç¨ćç¨ç¨ĺźďźčŤĺ
訹ç¸éćŹéă"
-
msgid "IDS_ST_OPT_DONT_SHOW_AGAIN"
msgstr "ä¸čŚĺ饯示"
-msgid "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"
-msgstr "ä¸ĺ
訹 %1$s ä˝żç¨ %2$săčŤĺĺž [č¨ĺŽ] > [éąç§čĺŽĺ
¨ć§]ďźçśĺžé¸ć [éąç§č¨ĺŽ]ă"
-
msgid "IDS_IDLE_HEADER_PRIVACY_REQUEST"
msgstr "éąç§ćŹčŚćą"
msgid "IDS_IDLE_BUTTON_DENY"
msgstr "ćçľ"
-msgid "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"
-msgstr "%s ćŁĺ¨čŚćąĺĺä¸ĺé
çŽçćŹéďź"
-
-msgid "IDS_IDLE_TPOP_TO_USE_APP_ALLOW_ALL_RELEVANT_PERMISSIONS"
-msgstr "čĽčŚä˝żç¨ćç¨ç¨ĺźďźčŤĺ
訹ç¸éćŹéă"
-
scale: 1;
desc { "default";
align: 0.5 0.5;
- fixed: 0 1;
rel1.relative: 0.00 0.00;
rel2.relative: 1.00 0.04;
}
scale: 1;
desc { "default";
align: 0.5 0.5;
- fixed: 0 1;
rel1.relative: 0.00 0.94;
rel2.relative: 1.00 1.00;
}
scale: 1;
desc { "default";
align: 0.5 0.5;
- fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.91 1.00;
scale: 1;
desc { "default";
align: 0.5 0.5;
- fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.00 1.00;
desc { "default";
visible: 1;
align: 0.5 0.5;
- fixed: 0 1;
rel1.to_x: "spacer_r";
rel1.to_y: "elm.swallow.content";
rel2.to_x: "spacer_l";
scale: 1;
desc { "default";
align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.00 1.00;
- rel2.relative: 0.05 0.00;
- }
- }
- spacer { "spacer_ll";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.95 1.00;
- rel2.relative: 1.00 0.00;
- }
- }
- }
-}
-
-group { "popup_layout_mobile";
- parts {
- spacer { "spacer_t";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 0 1;
- rel1.relative: 0.00 0.00;
- rel2.relative: 1.00 0.04;
- }
- }
- spacer { "spacer_b";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 0 1;
- rel1.relative: 0.00 0.94;
- rel2.relative: 1.00 1.00;
- }
- }
- spacer { "spacer_l";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.91 1.00;
- rel2.relative: 1.00 0.00;
- }
- }
- spacer { "spacer_r";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
- rel1.to_y: "spacer_t";
- rel2.to_y: "spacer_b";
- rel1.relative: 0.00 1.00;
- rel2.relative: 0.09 0.00;
- }
- }
- swallow { "elm.swallow.content";
- scale: 1;
- desc { "default";
- visible: 1;
- align: 0.5 0.5;
- rel1.to_x: "spacer_rr";
- rel1.to_y: "spacer_t";
- rel2.to_x: "spacer_ll";
- rel2.to_y: "spacer_b";
- rel1.relative: 1.00 1.00;
- rel2.relative: 0.00 0.64;
- }
- }
- spacer { "spacer_rr";
- scale: 1;
- desc { "default";
- align: 0.5 0.5;
- fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.00 1.00;
scale: 1;
desc { "default";
align: 0.5 0.5;
- fixed: 1 0;
rel1.to_y: "spacer_t";
rel2.to_y: "spacer_b";
rel1.relative: 0.95 1.00;
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/Answerable.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Implementation Answerable button pressed events classes
- */
-#pragma once
-
-#include "PopupCheck.h"
-#include "Popup.h"
-
-#include <types/NotificationResponse.h>
-
-namespace AskUser {
-namespace Notification {
-
-class IAnswerable {
-public:
- enum class Button {
- ALLOW,
- DENY
- };
- typedef std::function<void(int, NResponseType)> AnswerHandler;
-
- IAnswerable(AnswerHandler handler) : m_handler(handler) {}
- virtual void process(enum Button) const = 0;
- virtual ~IAnswerable() {}
-protected:
- AnswerHandler m_handler;
-};
-
-class AnswerablePopupCheck : public IAnswerable {
-public:
- AnswerablePopupCheck(PopupCheck *popup, AnswerHandler handler)
- : IAnswerable(handler), m_popup(popup) {}
- virtual void process(enum Button button) const {
- NResponseType answer;
- switch (button) {
- case IAnswerable::Button::ALLOW:
- if (m_popup->getCheckboxState())
- answer = NResponseType::AllowAlways;
- else
- answer = NResponseType::Allow;
- break;
- case IAnswerable::Button::DENY:
- if (m_popup->getCheckboxState())
- answer = NResponseType::DenyAlways;
- else
- answer = NResponseType::Deny;
- break;
- default:
- answer = NResponseType::Error;
- }
- m_handler(m_popup->getId(), answer);
- }
-private:
- PopupCheck *m_popup;
-};
-
-class AnswerablePopupLaunch : public IAnswerable {
-public:
- AnswerablePopupLaunch(Popup *popup, AnswerHandler handler)
- : IAnswerable(handler), m_popup(popup) {}
- virtual void process(enum Button button) const {
- NResponseType answer;
- switch (button) {
- case IAnswerable::Button::ALLOW:
- answer = NResponseType::AllowAlways;
- break;
- case IAnswerable::Button::DENY:
- answer = NResponseType::DenyAlways;
- break;
- default:
- answer = NResponseType::Error;
- }
- m_handler(m_popup->getId(), answer);
- }
-private:
- Popup *m_popup;
-};
-
-} // namespace AskUser
-} // namespace Notification
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/Po.cpp
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of Po message generation class
- */
-
-#include <cstdio>
-#include <cstdlib>
-#include <libintl.h>
-#include <map>
-#include <memory>
-#include <string>
-#include <unistd.h>
-#include <vconf.h>
-#include <Elementary.h>
-
-#include "Po.h"
-
-#include <exception/ErrnoException.h>
-#include <policy/PkgInfo.h>
-#include <policy/PrivilegeInfo.h>
-
-namespace AskUser {
-
-namespace {
-enum class MsgType {
- MSG_POPUP_TITLE,
-
- MSG_POPUP_TEXT,
- MSG_POPUP_LAUNCH_TEXT,
-
- MSG_POPUP_CHECKBOX,
- MSG_POPUP_ALLOW_BTN,
- MSG_POPUP_DENY_BTN,
-
- MSG_TOAST_DENY_TEXT,
- MSG_TOAST_FAIL_TEXT,
-};
-
-std::map<MsgType, const char*> MSG_PO = {
- {MsgType::MSG_POPUP_TITLE, "IDS_IDLE_HEADER_PRIVACY_REQUEST"},
- {MsgType::MSG_POPUP_TEXT, "IDS_IDLE_POP_ALLOW_P1SS_TO_ACCESS_YOUR_P2SS_Q"},
- {MsgType::MSG_POPUP_LAUNCH_TEXT, "IDS_IDLE_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_THE_FOLLOWING_ITEMS_C"},
- {MsgType::MSG_POPUP_CHECKBOX, "IDS_ST_OPT_DONT_SHOW_AGAIN"},
- {MsgType::MSG_POPUP_ALLOW_BTN,"IDS_IDLE_BUTTON_ALLOW_ABB7"},
- {MsgType::MSG_POPUP_DENY_BTN, "IDS_IDLE_BUTTON_DENY"},
- {MsgType::MSG_TOAST_DENY_TEXT, "IDS_ST_TPOP_P1SS_NOT_ALLOWED_TO_USE_P2SS_SELECT_PRIVACY_SETTINGS_IN_SETTINGS_PRIVACY_AND_SECURITY"},
- {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;
- int ret = asprintf(&buf, format, args...);
- if (ret == -1) {
- throw ErrnoException("asprintf failed");
- }
- std::unique_ptr<char, decltype(std::free) *> bufPtr(buf, std::free);
- return std::string(buf);
-}
-
-const char *getFormat(enum MsgType type) {
- setLocale();
- return dgettext(PROJECT_NAME, MSG_PO[type]);
-}
-
-std::string getPkgLabel(const std::string &pkgName) {
- PkgInfo pkgInfo(pkgName, geteuid());
- return pkgInfo.pkgLabel();
-}
-
-std::string getPrivacyList(const std::vector<std::string> &privs) {
- setLocale();
- std::string privacyList = "";
- for (auto &priv : privs) {
- std::string privacyName = PrivilegeInfo::getPrivacyDisplayName(priv);
- if (privacyList.find(privacyName) == std::string::npos) {
- privacyList.append("<br/>");
- privacyList.append(privacyName);
- }
- }
- return privacyList;
-}
-} // namespace anonymous
-
-namespace Notification {
-namespace Po {
-std::string createPopupCheckMsg(const std::string &, const std::string &pkgName, const std::string &priv) {
- return makeFromFormat(getFormat(MsgType::MSG_POPUP_TEXT), getPkgLabel(pkgName).c_str(),
- PrivilegeInfo::getPrivacyDisplayName(priv).c_str());
-}
-std::string createPopupLaunchMsg(const std::string &, const std::string &pkgName, const std::vector<std::string> &privs) {
- std::string launchTextFormat = makeFromFormat(getFormat(MsgType::MSG_POPUP_LAUNCH_TEXT), getPkgLabel(pkgName).c_str());
- return makeFromFormat("%s%s", launchTextFormat.c_str(), getPrivacyList(privs).c_str());
-}
-
-std::string createToastDenyMsg(const std::string &, const std::string &pkgName, const std::string &priv) {
- return makeFromFormat(getFormat(MsgType::MSG_TOAST_DENY_TEXT), getPkgLabel(pkgName).c_str(),
- PrivilegeInfo::getPrivacyDisplayName(priv).c_str());
-}
-std::string createToastFailMsg(const std::string &, const std::string &pkgName) {
- return makeFromFormat(getFormat(MsgType::MSG_TOAST_FAIL_TEXT), getPkgLabel(pkgName).c_str());
-}
-
-std::string getPopupTitleMsg() {
- return makeFromFormat("%s", getFormat(MsgType::MSG_POPUP_TITLE));
-}
-std::string getAllowButtonMsg() {
- return makeFromFormat("%s", getFormat(MsgType::MSG_POPUP_ALLOW_BTN));
-}
-std::string getDenyButtonMsg() {
- return makeFromFormat("%s", getFormat(MsgType::MSG_POPUP_DENY_BTN));
-}
-std::string getCheckBoxMsg() {
- return makeFromFormat("%s", getFormat(MsgType::MSG_POPUP_CHECKBOX));
-}
-
-} //namespace Po
-} //namepace Notification
-} //namespace AskUser
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/Po.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of Po message generation class
- */
-
-#include <string>
-#include <vector>
-
-namespace AskUser {
-namespace Notification {
-namespace Po {
-
-std::string createPopupCheckMsg(const std::string &appName, const std::string &pkgName, const std::string &priv);
-std::string createPopupLaunchMsg(const std::string &appName, const std::string &pkgName, const std::vector<std::string> &privs);
-std::string createPrivilegeDescr(const std::string &priv);
-std::string createToastDenyMsg(const std::string &appName, const std::string &pkgName, const std::string &priv);
-std::string createToastFailMsg(const std::string &appName, const std::string &pkgName);
-
-std::string getPopupTitleMsg();
-std::string getAllowButtonMsg();
-std::string getDenyButtonMsg();
-std::string getCheckBoxMsg();
-
-} // namespace Po
-} // namespace Notification
-} // namespace AskUser
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/Popup.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of Popup class
- */
-
-#pragma once
-
-#include <string>
-
-#include <log/alog.h>
-#include <exception/Exception.h>
-#include <Elementary.h>
-
-#include "UIElement.h"
-
-namespace AskUser {
-namespace Notification {
-
-class Popup : public UIElement {
-public:
- Popup(Evas_Object *parent, const std::string &msg)
- : UIElement(parent), m_msg(msg)
- {
- m_popup = elm_popup_add(m_parent);
- if (m_popup == nullptr) {
- ALOGE("Failed to add popup");
- throw Exception("Enlightenment failed");
- }
- }
-
- Popup(const Popup &other) = delete;
- Popup& operator=(const Popup &other) = delete;
-
- Evas_Object *getAllowButton() const { return m_allowButton; }
- Evas_Object *getDenyButton() const { return m_denyButton; }
-
- virtual ~Popup() {
- evas_object_del(m_popup);
- }
-protected:
- Evas_Object *m_popup = nullptr;
- Evas_Object *m_allowButton = nullptr;
- Evas_Object *m_denyButton = nullptr;
-
- std::string m_msg;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/PopupCheck.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of PopupCheck class
- */
-
-#pragma once
-
-#include <string>
-
-#include <Elementary.h>
-
-#include "Popup.h"
-
-namespace AskUser {
-namespace Notification {
-
-class PopupCheck : public Popup {
-public:
- PopupCheck(Evas_Object *parent, const std::string &msg)
- : Popup(parent, msg)
- {}
-
- Evas_Object *getCheckBox() const { return m_checkBox; }
- bool getCheckboxState() const {
- if (m_checkBox == nullptr)
- return false;
- return elm_check_state_get(m_checkBox);
- }
-
- virtual ~PopupCheck() {}
-
-protected:
- Evas_Object *m_checkBox = nullptr;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/PopupCheckMobile.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of PopupCheckMobile class
- */
-
-#pragma once
-
-#include <Elementary.h>
-
-#include <exception/Exception.h>
-#include "Po.h"
-#include "PopupCheck.h"
-
-namespace AskUser {
-namespace Notification {
-
-class PopupCheckMobile : public PopupCheck {
-public:
- PopupCheckMobile(Evas_Object *parent, int popupId, const std::string &msg)
- : PopupCheck(parent, msg)
- {
- setId(popupId);
- }
- virtual void create() {
- // popup
- elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
- elm_object_part_text_set(m_popup, "title,text", Po::getPopupTitleMsg().c_str());
- evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- // layout
- m_layout = elm_layout_add(m_popup);
- if (m_layout == nullptr) {
- ALOGE("EFL : Failed to add layout");
- throw Exception("Enlightenment failed");
- }
- elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_checkview_layout_mobile");
- evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- // content
- m_content = elm_label_add(m_layout);
- if (!m_content) {
- ALOGE("EFL : Failed to add content");
- throw Exception("Enlightenment failed");
- }
- elm_object_text_set(m_content, m_msg.c_str());
- elm_object_style_set(m_content, "popup/default");
- elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
- evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
-
- // checkbox
- m_checkBox = elm_check_add(m_layout);
- if (!m_checkBox) {
- ALOGE("EFL : Failed to add checkbox");
- throw Exception("Enlightenment failed");
- }
- elm_object_part_content_set(m_layout, "elm.swallow.end", m_checkBox);
- elm_object_text_set(m_checkBox, Po::getCheckBoxMsg().c_str());
- elm_check_state_set(m_checkBox, EINA_FALSE);
- evas_object_show(m_checkBox);
-
- // buttons
- m_denyButton = elm_button_add(m_popup);
- if (!m_denyButton) {
- ALOGE("EFL : Failed to add deny button");
- throw Exception("Enlightenment failed");
- }
- elm_object_part_content_set(m_popup, "button1", m_denyButton);
- elm_object_text_set(m_denyButton, Po::getDenyButtonMsg().c_str());
-
- m_allowButton = elm_button_add(m_popup);
- if (!m_allowButton) {
- ALOGE("EFL : Failed to add allow button");
- throw Exception("Enlightenment failed");
- }
- elm_object_part_content_set(m_popup, "button2", m_allowButton);
- elm_object_text_set(m_allowButton, Po::getAllowButtonMsg().c_str());
- elm_object_content_set(m_popup, m_layout);
- evas_object_show(m_popup);
- }
- virtual ~PopupCheckMobile() {
-
- }
-private:
- Evas_Object *m_content = nullptr;
- Evas_Object *m_layout = nullptr;
- Evas_Object *m_layoutInner = nullptr;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/PopupCheckWearable.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of PopupCheckWearable class
- */
-
-#pragma once
-
-#include <Elementary.h>
-
-#include <exception/Exception.h>
-#include "Po.h"
-#include "PopupCheck.h"
-
-namespace AskUser {
-namespace Notification {
-
-class PopupCheckWearable : public PopupCheck {
-public:
- PopupCheckWearable(Evas_Object *parent, int popupId, const std::string msg)
- : PopupCheck(parent, msg)
- {
- setId(popupId);
- }
- ~PopupCheckWearable() {}
-
- virtual void create() {
- elm_object_style_set(m_popup, "circle");
-
- m_layout = elm_layout_add(m_popup);
- if (m_layout == nullptr) {
- ALOGE("EFL : Failed to add layout");
- throw Exception("Enlightenment failed");
- }
- elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
- elm_object_part_text_set(m_layout, "elm.text.title", Po::getPopupTitleMsg().c_str());
- elm_object_content_set(m_popup, m_layout);
-
- m_layoutInner = elm_layout_add(m_layout);
- if (m_layoutInner == nullptr) {
- ALOGE("EFL : Failed to add layout");
- throw Exception("Enlightenment failed");
- }
- elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
- evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
-
- m_content = elm_label_add(m_layoutInner);
- if (m_content == nullptr) {
- ALOGE("EFL : Failed to add content");
- throw Exception("Enlightenment failed");
- }
- elm_object_text_set(m_content, m_msg.c_str());
- elm_object_style_set(m_content, "popup/default");
- elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
- evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_part_content_set(m_layoutInner, "label", m_content);
-
- m_checkBox = elm_check_add(m_popup);
- if (m_checkBox == nullptr) {
- ALOGE("EFL : Failed to add checkbox");
- throw Exception("Enlightenment failed");
- }
- elm_object_style_set(m_checkBox, "popup");
- elm_object_text_set(m_checkBox, Po::getCheckBoxMsg().c_str());
- 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);
-
- m_allowButton = elm_button_add(m_popup);
- if (m_allowButton == nullptr) {
- ALOGE("EFL : Failed to add allow button");
- throw Exception("Enlightenment failed");
- }
- elm_object_style_set(m_allowButton, "popup/circle/right");
- elm_object_part_content_set(m_popup, "button2", m_allowButton);
-
- Evas_Object *icon;
- icon = elm_image_add(m_allowButton);
- if (icon == nullptr) {
- ALOGE("EFL : Failed to add allow button icon");
- throw Exception("Enlightenment failed");
- }
- elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
- evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
- evas_object_show(icon);
-
- m_denyButton = elm_button_add(m_popup);
- if (m_denyButton == nullptr) {
- ALOGE("EFL : Failed to add deny button");
- throw Exception("Enlightenment failed");
- }
- elm_object_style_set(m_denyButton, "popup/circle/left");
- elm_object_part_content_set(m_popup, "button1", m_denyButton);
-
- icon = elm_image_add(m_denyButton);
- if (icon == nullptr) {
- ALOGE("EFL : Failed to add deny button icon");
- throw Exception("Enlightenment failed");
- }
- elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
- elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
- evas_object_show(icon);
-
- evas_object_show(m_popup);
- }
-private:
- Evas_Object *m_content = nullptr;
- Evas_Object *m_layout = nullptr;
- Evas_Object *m_layoutInner = nullptr;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/PopupLaunchMobile.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of PopupLaunchMobile class
- */
-
-#pragma once
-
-#include <Elementary.h>
-
-#include <exception/Exception.h>
-#include "Po.h"
-#include "Popup.h"
-
-namespace AskUser {
-namespace Notification {
-
-class PopupLaunchMobile : public Popup {
-public:
- PopupLaunchMobile(Evas_Object *parent, int popupId, const std::string &msg)
- : Popup(parent, msg)
- {
- setId(popupId);
- }
- virtual ~PopupLaunchMobile() {}
-
- virtual void create() {
- // popup
- elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
- elm_object_part_text_set(m_popup, "title,text", Po::getPopupTitleMsg().c_str());
- evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- // layout
- m_layout = elm_layout_add(m_popup);
- if (m_layout == nullptr) {
- ALOGE("EFL : Failed to add layout");
- throw Exception("Enlightenment failed");
- }
- elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_layout_mobile");
- evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- // content
- m_content = elm_label_add(m_layout);
- if (!m_content) {
- ALOGE("EFL : Failed to add content");
- throw Exception("Enlightement failed");
- }
- elm_object_text_set(m_content, m_msg.c_str());
- elm_object_style_set(m_content, "popup/default");
- elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
- evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
-
- // buttons
- m_denyButton = elm_button_add(m_popup);
- if (!m_denyButton) {
- ALOGE("EFL : Failed to add deny button");
- throw Exception("Enlightement failed");
- }
- elm_object_part_content_set(m_popup, "button1", m_denyButton);
- elm_object_text_set(m_denyButton, Po::getDenyButtonMsg().c_str());
-
- m_allowButton = elm_button_add(m_popup);
- if (!m_allowButton) {
- ALOGE("EFL : Failed to add allow button");
- throw Exception("Enlightement failed");
- }
- elm_object_part_content_set(m_popup, "button2", m_allowButton);
- elm_object_text_set(m_allowButton, Po::getAllowButtonMsg().c_str());
- elm_object_content_set(m_popup, m_layout);
- evas_object_show(m_popup);
- }
-private:
- Evas_Object *m_content = nullptr;
- Evas_Object *m_layout = nullptr;
- Evas_Object *m_layoutInner = nullptr;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/PopupLaunchWearable.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of PopupLaunchWearableper class
- */
-
-#pragma once
-
-#include <Elementary.h>
-
-#include <exception/Exception.h>
-#include "Po.h"
-#include "Popup.h"
-
-namespace AskUser {
-namespace Notification {
-
-class PopupLaunchWearable : public Popup {
-public:
- PopupLaunchWearable(Evas_Object *parent, int popupId, const std::string msg)
- : Popup(parent, msg)
- {
- setId(popupId);
- }
- virtual ~PopupLaunchWearable() {}
-
- virtual void create() {
- Evas_Object *icon;
- elm_object_style_set(m_popup, "circle");
-
- m_layout = elm_layout_add(m_popup);
- if (m_layout == nullptr) {
- ALOGE("EFL : Failed to add layout");
- throw Exception("Enlightenment failed");
- }
- elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
- elm_object_part_text_set(m_layout, "elm.text.title", Po::getPopupTitleMsg().c_str());
- elm_object_content_set(m_popup, m_layout);
-
- m_layoutInner = elm_layout_add(m_layout);
- if (m_layoutInner == nullptr) {
- ALOGE("EFL : Failed to add layout");
- throw Exception("Enlightenment failed");
- }
- elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
- evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
-
- m_content = elm_label_add(m_layoutInner);
- if (m_content == nullptr) {
- ALOGE("EFL : Failed to add content");
- throw Exception("Enlightenment failed");
- }
- elm_object_text_set(m_content, m_msg.c_str());
- elm_object_style_set(m_content, "popup/default");
- elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
- evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_part_content_set(m_layoutInner, "label", m_content);
-
- m_allowButton = elm_button_add(m_popup);
- if (m_allowButton == nullptr) {
- ALOGE("EFL : Failed to add allow button");
- throw Exception("Enlightenment failed");
- }
- elm_object_style_set(m_allowButton, "popup/circle/right");
- elm_object_part_content_set(m_popup, "button2", m_allowButton);
-
- icon = elm_image_add(m_allowButton);
- if (icon == nullptr) {
- ALOGE("EFL : Failed to add allow button icon");
- throw Exception("Enlightenment failed");
- }
- elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
- evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
- evas_object_show(icon);
-
- m_denyButton = elm_button_add(m_popup);
- if (m_denyButton == nullptr) {
- ALOGE("EFL : Failed to add deny button");
- throw Exception("Enlightenment failed");
- }
- elm_object_style_set(m_denyButton, "popup/circle/left");
- elm_object_part_content_set(m_popup, "button1", m_denyButton);
-
- icon = elm_image_add(m_denyButton);
- if (icon == nullptr) {
- ALOGE("EFL : Failed to add deny button icon");
- throw Exception("Enlightenment failed");
- }
- elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
- elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
- evas_object_show(icon);
-
- evas_object_show(m_popup);
- }
-private:
- std::vector<std::string> m_privs;
- Evas_Object *m_content = nullptr;
- Evas_Object *m_layout = nullptr;
- Evas_Object *m_layoutInner = nullptr;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/Popupper.cpp
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Definition of Popupper class
- */
-
-#include "Popupper.h"
-
-#include "Answerable.h"
-#include "Po.h"
-#include "PopupLaunchMobile.h"
-#include "PopupLaunchWearable.h"
-#include "PopupCheckMobile.h"
-#include "PopupCheckWearable.h"
-#include "Toast.h"
-
-#include <exception/ErrnoException.h>
-#include <exception/Exception.h>
-#include <log/alog.h>
-#include <libintl.h>
-#include <vconf.h>
-#include <efl_util.h>
-#include <system_info.h>
-
-#include <unistd.h>
-
-namespace AskUser {
-
-namespace Notification {
-
-namespace {
- std::string getProfileName() {
- char *profileName = nullptr;
- system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
- if (!profileName) {
- ALOGE("profileName is NULL");
- throw Exception("get profileName failed");
- }
- std::unique_ptr<char, decltype(free)*> profileNamePtr(profileName, free);
- return std::string(profileName);
- }
-}
-
-
-void Popupper::registerPopupResponseHandler(PopupHandler handler) {
- m_popupResponseHandler = handler;
-}
-
-void Popupper::registerToastFinishedHandler(ToastHandler handler) {
- m_toastFinishedHandler = handler;
-}
-
-void Popupper::unfocusedCb(void *data, Evas_Object *, void *)
-{
- ALOGD("Unfocused");
- Popupper *popupper = static_cast<Popupper*>(data);
-
- if (popupper->m_shouldRaise) {
- evas_object_show(popupper->m_win);
- }
-}
-
-void Popupper::popupClose(int popupId)
-{
- ALOGD("Window close");
- m_shouldRaise = false;
-
- if (!m_elementPtr || popupId == -1 || popupId != m_elementPtr->getId())
- ALOGD("Closing non-existing popup");
-
- m_elementPtr.reset(nullptr);
- m_answerablePtr.reset(nullptr);
- evas_object_hide(m_win);
-}
-
-
-void Popupper::allowPressedCb(void *data, Evas_Object *, void *)
-{
- IAnswerable *answerable = static_cast<IAnswerable *>(data);
- answerable->process(IAnswerable::Button::ALLOW);
-}
-
-void Popupper::denyPressedCb(void *data, Evas_Object *, void *)
-{
- IAnswerable *answerable = static_cast<IAnswerable *>(data);
- answerable->process(IAnswerable::Button::DENY);
-}
-
-Eina_Bool Popupper::hwKeyClickedCb(void *data, int type, void *event)
-{
- Ecore_Event_Key *ev = static_cast<Ecore_Event_Key*>(event);
- Popupper* runner = static_cast<Popupper*>(data);
- ALOGD("HW button pressed. type <" << type << "> pressed key is <" << ev->key << ">");
- if ((!strcmp("XF86Home", ev->key) || !strcmp("XF86Back", ev->key)) && runner->m_elementPtr) {
- ALOGD("Respond as deny once.");
- runner->m_popupResponseHandler(runner->m_elementPtr->getId(), NResponseType::None);
- }
- return EINA_TRUE;
-}
-
-void Popupper::timeoutToastCb(void *data, Evas_Object *, void *) {
- Popupper *popupper = static_cast<Popupper*>(data);
- popupper->m_toastFinishedHandler(popupper->m_elementPtr->getId());
-}
-
-Popupper::~Popupper()
-{}
-
-void Popupper::initialize()
-{
- elm_init(0, NULL);
- m_win = elm_win_add(NULL, Po::getPopupTitleMsg().c_str(), ELM_WIN_NOTIFICATION);
- if (!m_win) {
- ALOGE("EFL : Failed to add window");
- throw Exception("Elementary failed");
- }
- efl_util_set_notification_window_level(m_win, EFL_UTIL_NOTIFICATION_LEVEL_TOP);
-
- if (elm_win_wm_rotation_supported_get(m_win)) {
- int rots[4] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(m_win, (const int *)(&rots), 4);
- }
-
- elm_win_autodel_set(m_win, EINA_TRUE);
- elm_win_override_set(m_win, EINA_TRUE);
- elm_win_alpha_set(m_win, EINA_TRUE);
-
- // callbacks
- elm_win_indicator_opacity_set(m_win, ELM_WIN_INDICATOR_OPAQUE);
- elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
- evas_object_smart_callback_add(m_win, "unfocused", &Popupper::unfocusedCb, this);
-
- elm_win_keygrab_set(m_win, "XF86Home", 0, 0, 0, ELM_WIN_KEYGRAB_SHARED);
- elm_win_keygrab_set(m_win, "XF86Back", 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST);
- ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, &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(int popupId, const std::string &appId, const std::string &pkgId, const std::string &priv) {
- std::string profileName = getProfileName();
- PopupCheck *popup;
- try {
- if (profileName[0] != 'w' && profileName[0] != 'W') {
- // Not wearable
- popup = new PopupCheckMobile(m_win, popupId, Po::createPopupCheckMsg(appId, pkgId, priv));
- } else {
- // Wearable
- popup = new PopupCheckWearable(m_win, popupId, Po::createPopupCheckMsg(appId, pkgId, priv));
- }
- popup->create();
- } catch (const std::exception &e) {
- ALOGE("Failed to create popup check : " << e.what());
- m_popupResponseHandler(popupId, NResponseType::Error);
- return;
- }
-
- m_answerablePtr.reset(new AnswerablePopupCheck(popup, m_popupResponseHandler));
- evas_object_smart_callback_add(popup->getAllowButton(), "clicked", &Popupper::allowPressedCb,
- m_answerablePtr.get());
- evas_object_smart_callback_add(popup->getDenyButton(), "clicked", &Popupper::denyPressedCb,
- m_answerablePtr.get());
-
- m_elementPtr.reset(popup);
- show();
-
-}
-void Popupper::popupLaunch(int popupId, const std::string &appId, const std::string &pkgId, const std::vector<std::string> &privs) {
- std::string profileName = getProfileName();
- Popup *popup;
- try {
- if (profileName[0] != 'w' && profileName[0] != 'W') {
- // Not wearable
- popup = new PopupLaunchMobile(m_win, popupId, Po::createPopupLaunchMsg(appId, pkgId, privs));
- } else {
- // Wearable
- popup = new PopupLaunchWearable(m_win, popupId, Po::createPopupLaunchMsg(appId, pkgId, privs));
- }
- popup->create();
- } catch (const std::exception &e) {
- ALOGE("Failed to create popup launch : " << e.what());
- m_popupResponseHandler(popupId, NResponseType::Error);
- return;
- }
-
- m_answerablePtr.reset(new AnswerablePopupLaunch(popup, m_popupResponseHandler));
- evas_object_smart_callback_add(popup->getAllowButton(), "clicked", &Popupper::allowPressedCb,
- m_answerablePtr.get());
- evas_object_smart_callback_add(popup->getDenyButton(), "clicked", &Popupper::denyPressedCb,
- m_answerablePtr.get());
-
- m_elementPtr.reset(popup);
- show();
-}
-void Popupper::toastDeny(int toastId, const std::string &appId, const std::string &pkgId, const std::string &priv) {
- try {
- Toast *toast = new Toast(m_win, toastId, Po::createToastDenyMsg(appId, pkgId, priv));
- toast->create();
- m_elementPtr.reset(toast);
- } catch (const std::exception &e) {
- ALOGE("Failed to create toast deny : " << e.what());
- return;
- }
- m_toastFinishedHandler(toastId);
-}
-void Popupper::toastFail(int toastId, const std::string &appId, const std::string &pkgId) {
- try {
- Toast *toast = new Toast(m_win, toastId, Po::createToastFailMsg(appId, pkgId));
- toast->create();
- m_elementPtr.reset(toast);
- } catch (const std::exception &e) {
- ALOGE("Failed to create toast fail : " << e.what());
- return;
- }
- m_toastFinishedHandler(toastId);
-}
-
-void Popupper::start()
-{
- elm_run();
-}
-
-void Popupper::stop()
-{
- m_shouldRaise = false;
- elm_win_keygrab_unset(m_win, "XF86Home", 0, 0);
- elm_win_keygrab_unset(m_win, "XF86Back", 0, 0);
- m_elementPtr.reset(nullptr);
- m_answerablePtr.reset(nullptr);
- evas_object_del(m_win);
- m_win = nullptr;
- elm_exit();
-}
-
-void Popupper::shutdown() {
- elm_shutdown();
-}
-
-} /* namespace Notification */
-
-} /* namespace AskUser */
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/Popupper.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of Popupper class
- */
-
-#pragma once
-
-#include <Elementary.h>
-#include <functional>
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "Answerable.h"
-#include "Popup.h"
-#include "Toast.h"
-#include <types/NotificationResponse.h>
-#include <log/alog.h>
-
-namespace AskUser {
-
-namespace Notification {
-
-class Popupper {
-public:
- typedef std::function<void(int, NResponseType)> PopupHandler;
- typedef std::function<void(int)> ToastHandler;
-
- Popupper() = default;
- void initialize();
- void setLocale();
- void registerPopupResponseHandler(PopupHandler handler);
- void registerToastFinishedHandler(ToastHandler handler);
- void start();
-
- void popupCheck(int popupId, const std::string &appId, const std::string &pkgId, const std::string &priv);
- void popupLaunch(int popupId, const std::string &appId, const std::string &pkgId, const std::vector<std::string> &privs);
- void toastDeny(int toastId, const std::string &appId, const std::string &pkgId, const std::string &priv);
- void toastFail(int toastId, const std::string &appId, const std::string &pkgId);
-
- void popupClose(int popupId);
- void stop();
- void shutdown();
-
- ~Popupper();
-private:
- static void unfocusedCb(void *data, Evas_Object *, void *);
- static void allowPressedCb(void *data, Evas_Object *, void *);
- static void denyPressedCb(void *data, Evas_Object *, void *);
- static void timeoutToastCb(void *data, Evas_Object *, void *);
- static Eina_Bool hwKeyClickedCb(void *data, int type, void *event);
-
- void show();
-
- PopupHandler m_popupResponseHandler;
- ToastHandler m_toastFinishedHandler;
-
- Evas_Object *m_win = nullptr;
- std::unique_ptr<UIElement> m_elementPtr;
- std::unique_ptr<IAnswerable> m_answerablePtr;
-
- bool m_shouldRaise = false;
-};
-
-} /* namespace Notification */
-
-} /* namespace AskUser */
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/ui/Toast.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of Toast class
- */
-
-#pragma once
-
-#include <exception>
-#include <string>
-
-#include <notification_status.h>
-#include <notification_error.h>
-
-#include <log/alog.h>
-#include "UIElement.h"
-
-namespace AskUser {
-namespace Notification {
-
-class Toast : public UIElement {
-public:
- Toast(Evas_Object *m_parentWindow, int toastId, const std::string msg) : UIElement(m_parentWindow), m_msg(msg)
- {
- setId(toastId);
- }
- virtual void create() {
- int ret = notification_status_message_post(m_msg.c_str());
- if (ret != NOTIFICATION_ERROR_NONE) {
- ALOGE("notification_status_message_post failed with " << ret);
- throw std::runtime_error("notification_status_message_post failed with " + std::to_string(ret));
- }
- }
-private:
- std::string m_msg;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/agent/notification-daemon/UIElement.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Declaration of UIElement class
- */
-
-#pragma once
-
-#include <Elementary.h>
-
-namespace AskUser {
-namespace Notification {
-
-class UIElement {
-public:
- explicit UIElement(Evas_Object *parent) : m_parent(parent), m_elementId(-1) {}
- void setId(int id) { m_elementId = id;}
- int getId() { return m_elementId; }
- virtual void create() = 0;
- virtual ~UIElement() {}
-protected:
- Evas_Object *m_parent;
- int m_elementId;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
/*
- * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public:
virtual ~AskUIInterface() {};
- virtual bool start(const std::string &client, const std::string &pkgLabel,
- const std::string &user, const std::string &privilege,
- RequestId requestId, UIResponseCallback) = 0;
+ virtual bool start(const std::string &client, const std::string &user,
+ const std::string &privilege, RequestId requestId, UIResponseCallback) = 0;
virtual bool setOutdated() = 0;
virtual bool dismiss() = 0;
virtual bool isDismissing() const = 0;
/*
- * Copyright (c) 2016-2017 Samsung Electronics Co.
+ * Copyright (c) 2016 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <socket/Poll.h>
#include <socket/Socket.h>
#include <translator/Translator.h>
-#include <translator/GuiTranslator.h>
#include <config/Path.h>
namespace AskUser {
}
}
-bool NotificationBackend::start(const std::string &client, const std::string &pkgLabel,
- const std::string &user, const std::string &privilege,
- RequestId requestId, UIResponseCallback responseCb) {
+bool NotificationBackend::start(const std::string &client, const std::string &user,
+ const std::string &privilege, RequestId requestId,
+ UIResponseCallback responseCb) {
if (!m_notify.init()) {
ALOGW("Couldn't initialize notification object.");
return false;
}
m_responseHandler = responseCb;
- m_request.id = static_cast<NotificationRequestId>(requestId);
+ m_request.id = requestId;
m_request.data.client = client;
m_request.data.user = user;
m_request.data.privilege = privilege;
- m_request.pkgLabel = pkgLabel;
m_thread = std::thread(&NotificationBackend::run, this);
return true;
}
void NotificationBackend::reportError() {
- m_responseHandler(static_cast<RequestId>(m_request.id), NResponseTypeToUI(NResponseType::Error));
+ m_responseHandler(m_request.id, NResponseTypeToUI(NResponseType::Error));
}
bool NotificationBackend::sendRequest()
{
std::string data = Translator::Gui::notificationRequestToData(m_request.id,
m_request.data.client,
- m_request.pkgLabel,
m_request.data.privilege);
return m_clientSocket.send(data);
}
ALOGE("Failed to fetch response");
return false;
}
- response.id = static_cast<NotificationRequestId>(requestId);
+ response.id = static_cast<RequestId>(requestId);
response.response = static_cast<NResponseType>(responseType);
return true;
}
ALOGE("Incorrect response received");
return false;
}
- m_responseHandler(static_cast<RequestId>(m_request.id), NResponseTypeToUI(response.response));
+ m_responseHandler(m_request.id, NResponseTypeToUI(response.response));
return true;
}
/*
- * Copyright (c) 2016-2017 Samsung Electronics Co.
+ * Copyright (c) 2016 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
NotificationBackend() : m_poller(2), m_clientSocket(Socket::PeerType::CLIENT), m_running(false) {}
virtual ~NotificationBackend();
- virtual bool start(const std::string &client, const std::string &pkgLabel,
- const std::string &user, const std::string &privilege, RequestId requestId,
+ virtual bool start(const std::string &client, const std::string &user,
+ const std::string &privilege, RequestId requestId,
UIResponseCallback responseCb);
virtual bool setOutdated();
virtual bool dismiss();
-# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2014-2016 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# @file CMakeLists.txt
# @author Adam Malinowski <a.malinowsk2@partner.samsung.com>
#
-
PKG_CHECK_MODULES(COMMON_DEP
REQUIRED
cynara-plugin
cynara-agent
glib-2.0
libsystemd
+ pkgmgr-info
+ security-manager
security-privilege-manager
)
SET(COMMON_SOURCES
${COMMON_PATH}/log/alog.cpp
+ ${COMMON_PATH}/policy/Policy.cpp
${COMMON_PATH}/policy/PrivilegeInfo.cpp
${COMMON_PATH}/socket/Socket.cpp
${COMMON_PATH}/socket/Poll.cpp
${COMMON_PATH}/translator/Translator.cpp
- ${COMMON_PATH}/translator/GuiTranslator.cpp
${COMMON_PATH}/types/AgentErrorMsg.cpp
${COMMON_PATH}/util/SafeFunction.cpp
${COMMON_PATH}/config/Limits.cpp
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file PrivacyConfig.h
- * @author
- * @brief Implementation of PrivacyDenied plugin.
- */
-#pragma once
-
-#include <cynara-plugin.h>
-
-namespace PrivacyDeniedPlugin {
-namespace Config {
-
-// this code is used in security-manager as information
-// that it should show popup at application launch
-const Cynara::PolicyType ASK_USER_LEGACY = 48; // 0x30
-// this policy is used to trigger toast during runtime
-const Cynara::PolicyType PRIVACY_DENY = 49; // 0x31
-
-} // namespace Config
-} // namespace PrivacyDeniedPlugin
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file src/common/policy/PkgInfo.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @brief Definition of pkgmgr-info wrappers
- */
-
-#pragma once
-
-#include <string>
-#include <sys/types.h>
-#include <pkgmgr-info.h>
-
-#include <log/alog.h>
-
-struct PkgInfo {
- PkgInfo(const std::string &pkgId, uid_t uid) : m_handle(nullptr) {
- int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId.c_str(), uid, &m_handle);
- if (ret != PMINFO_R_OK) {
- ALOGE("pkgmgrinfo_pkginfo_get_usr_pkginfo failed for " << pkgId << " with " << ret);
- m_handle = nullptr;
- }
- }
- ~PkgInfo() {
- if (m_handle)
- pkgmgrinfo_pkginfo_destroy_pkginfo(m_handle);
- }
- const std::string mainAppId(){
- if (!m_handle) {
- return "";
- }
- char *mainAppId;
- int ret = pkgmgrinfo_pkginfo_get_mainappid(m_handle, &mainAppId);
- if (ret != PMINFO_R_OK) {
- ALOGE("pkgmgrinfo_pkginfo_get_mainappid failed with " << ret);
- return "";
- }
- return mainAppId ? mainAppId : "";
- }
- const std::string pkgLabel() {
- if (!m_handle) {
- return "";
- }
- char *pkgLabel;
- int ret = pkgmgrinfo_pkginfo_get_label(m_handle, &pkgLabel);
- if (ret != PMINFO_R_OK) {
- ALOGE("pkgmgrinfo_pkginfo_get_label failed with " << ret);
- return "";
- }
- return pkgLabel ? pkgLabel : "";
- }
- pkgmgrinfo_pkginfo_h m_handle;
-};
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/agent/notification-daemon/Policy.cpp
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Implementation of Policy wrappers
+ */
+
+#include <memory>
+
+#include <pkgmgr-info.h>
+#include <security-manager.h>
+
+#include <exception/Exception.h>
+#include <log/alog.h>
+
+#include "Policy.h"
+
+namespace {
+inline void throwOnSMError(std::string err, int ret)
+{
+ if (ret != SECURITY_MANAGER_SUCCESS)
+ throw AskUser::Exception(err + " : " + std::to_string(ret));
+}
+
+struct PkgInfo {
+ PkgInfo(const std::string &pkgId, uid_t uid) : m_handle(nullptr) {
+ int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId.c_str(), uid, &m_handle);
+ if (ret != PMINFO_R_OK) {
+ ALOGE("pkgmgrinfo_pkginfo_get_usr_pkginfo failed for " << pkgId << " with " << ret);
+ m_handle = nullptr;
+ }
+ }
+ ~PkgInfo() {
+ if (m_handle)
+ pkgmgrinfo_pkginfo_destroy_pkginfo(m_handle);
+ }
+ const std::string mainAppId(){
+ if (!m_handle) {
+ return "";
+ }
+ char *mainAppId;
+ int ret = pkgmgrinfo_pkginfo_get_mainappid(m_handle, &mainAppId);
+ if (ret != PMINFO_R_OK) {
+ ALOGE("pkgmgrinfo_pkginfo_get_mainappid failed with " << ret);
+ return "";
+ }
+ return mainAppId ? mainAppId : "";
+ }
+ const std::string pkgLabel() {
+ if (!m_handle) {
+ return "";
+ }
+ char *pkgLabel;
+ int ret = pkgmgrinfo_pkginfo_get_label(m_handle, &pkgLabel);
+ if (ret != PMINFO_R_OK) {
+ ALOGE("pkgmgrinfo_pkginfo_get_label failed with " << ret);
+ return "";
+ }
+ return pkgLabel ? pkgLabel : "";
+ }
+ pkgmgrinfo_pkginfo_h m_handle;
+};
+}
+
+namespace AskUser {
+
+void identifyApp(const std::string &client, const std::string &user,
+ std::string &appId, std::string &pkgLabel)
+{
+ char *pkgName = nullptr;
+ char *appName = nullptr;
+
+ int ret = security_manager_identify_app_from_cynara_client(client.c_str(), &pkgName, &appName);
+ std::unique_ptr<char, decltype(free)*> pkg_name_p(pkgName, free);
+ std::unique_ptr<char, decltype(free)*> app_name_p(appName, free);
+ throwOnSMError("security_manager_identify_app_from_cynara_client", ret);
+
+ if (!pkgName) {
+ ALOGE("Couldn't identify clients package id");
+ return;
+ }
+
+ uid_t uid = std::strtoul(user.c_str(), nullptr, 10);
+ PkgInfo pkgInfo(pkgName, uid);
+ if (!appName)
+ appId = pkgInfo.mainAppId();
+
+ pkgLabel = pkgInfo.pkgLabel();
+}
+
+PolicyEntry::PolicyEntry() {
+ throwOnSMError("security_manager_policy_entry_new",
+ security_manager_policy_entry_new(&m_entry));
+}
+
+PolicyEntry::PolicyEntry(PolicyEntry &&other) : m_entry(std::move(other.m_entry)) {
+ other.m_entry = nullptr;
+}
+
+PolicyEntry::~PolicyEntry() {
+ security_manager_policy_entry_free(m_entry);
+}
+
+void PolicyEntry::setApp(const std::string &appId) {
+ throwOnSMError("security_manager_policy_entry_set_application",
+ security_manager_policy_entry_set_application(m_entry, appId.c_str()));
+}
+
+void PolicyEntry::setUser(const std::string &user) {
+ throwOnSMError("security_manager_policy_entry_set_user",
+ security_manager_policy_entry_set_user(m_entry, user.c_str()));
+}
+
+void PolicyEntry::setPrivilege(const std::string &privilege) {
+ throwOnSMError("security_manager_policy_entry_set_privilege",
+ security_manager_policy_entry_set_privilege(m_entry, privilege.c_str()));
+}
+
+void PolicyEntry::setLevel(const std::string &level) {
+ throwOnSMError("security_manager_policy_entry_admin_set_level",
+ security_manager_policy_entry_set_level(m_entry, level.c_str()));
+}
+
+PolicyRequest::PolicyRequest() {
+ throwOnSMError("security_manager_policy_update_req_new",
+ security_manager_policy_update_req_new(&m_req));
+}
+
+PolicyRequest::~PolicyRequest() {
+ m_entries.clear();
+ security_manager_policy_update_req_free(m_req);
+}
+
+void PolicyRequest::addEntry(PolicyEntry &&entry) {
+ throwOnSMError("security_manager_policy_update_req_add_entry",
+ security_manager_policy_update_req_add_entry(m_req, entry.get()));
+ m_entries.emplace_back(std::move(entry));
+}
+
+void PolicyRequest::updatePolicy() {
+ throwOnSMError("security_manager_policy_update_send",
+ security_manager_policy_update_send(m_req));
+}
+
+} /* namespace AskUser */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/agent/notification-daemon/Policy.h
+ * @author Zofia Abramowska <z.abramowska@samsung.com>
+ * @brief Definition of Policy wrappers
+ */
+
+#pragma once
+
+#include <string>
+#include <vector>
+
+struct policy_entry;
+struct policy_update_req;
+
+namespace AskUser {
+
+void identifyApp(const std::string &client, const std::string &user,
+ std::string &appId, std::string &pkgLabel);
+
+class PolicyEntry {
+public:
+ PolicyEntry();
+ PolicyEntry(PolicyEntry &&other);
+ ~PolicyEntry();
+ void setApp(const std::string &appId);
+ void setUser(const std::string &user);
+ void setPrivilege(const std::string &privilege);
+ void setLevel(const std::string &level);
+
+ policy_entry *get() const { return m_entry; }
+
+private:
+ policy_entry *m_entry;
+};
+
+class PolicyRequest {
+public:
+ PolicyRequest();
+ ~PolicyRequest();
+ void addEntry(PolicyEntry &&entry);
+ void updatePolicy();
+
+private:
+ policy_update_req *m_req;
+ std::vector<PolicyEntry> m_entries;
+};
+
+} /* namespace AskUser */
return privilege;
}
std::unique_ptr<char, decltype(free)*> displaNamePtr(displayName, free);
- return std::string(displayName);
+ return displayName;
}
std::string getPrivacyName(const std::string &privilege) {
int ret = privilege_info_get_privacy_by_privilege(privilege.c_str(), &privacyName);
if (ret != PRVMGR_ERR_NONE || !privacyName) {
ALOGE("Unable to get privacy group for privilege: <" << privilege << ">, err: <" << ret << ">");
- return privilege;
+ throw Exception("Can't get privacy group name for privilege " + privilege);
}
std::unique_ptr<char, decltype(free) *> privacyNamePtr(privacyName, free);
- return std::string(privacyName);
+ return privacyName;
}
-
std::vector<std::string> getPrivacyPrivileges(const std::string &privacy) {
GList *privilegeList = nullptr;
int ret = privilege_info_get_privilege_list_by_privacy(privacy.c_str(), &privilegeList);
if (ret != PRVMGR_ERR_NONE || !privilegeList) {
ALOGE("Unable to get privacy group list of privileges; err: <" << ret << ">" );
- return {privacy};
+ return {};
}
GListWrap privList(privilegeList);
+++ /dev/null
-# Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# @file CMakeLists.txt
-# @author Dariusz Michaluk <d.michaluk@samsung.com>
-#
-
-SET(PROTOCOL_PATH ${ASKUSER_PATH}/common/protocol)
-
-SET(ASKUSER_NOTIFICATION_VERSION_MAJOR 0)
-SET(ASKUSER_NOTIFICATION_VERSION ${ASKUSER_NOTIFICATION_VERSION_MAJOR}.1.0)
-
-SET(PC_FILE "askuser-notification.pc")
-
-PKG_CHECK_MODULES(ASKUSER_NOTIFICATION_DEP
- REQUIRED
- libsystemd
- )
-
-INCLUDE_DIRECTORIES(
- ${PROTOCOL_PATH}
- SYSTEM
- ${ASKUSER_NOTIFICATION_DEP_INCLUDE_DIRS}
- )
-
-SET(ASKUSER_NOTIFICATION_SOURCES
- ${PROTOCOL_PATH}/channel.cpp
- ${PROTOCOL_PATH}/ask-user-client.cpp
- ${PROTOCOL_PATH}/sock.cpp
- ${PROTOCOL_PATH}/ask-user-config.cpp
- )
-
-SET(ASKUSER_NOTIFICATION_TEST_SOURCES
- ${PROTOCOL_PATH}/main.cpp
- )
-
-ADD_DEFINITIONS("-fvisibility=default")
-
-ADD_LIBRARY(${TARGET_ASKUSER_NOTIFICATION_LIB} SHARED ${ASKUSER_NOTIFICATION_SOURCES})
-ADD_EXECUTABLE(${TARGET_ASKUSER_NOTIFICATION_TEST} ${ASKUSER_NOTIFICATION_TEST_SOURCES})
-
-SET_TARGET_PROPERTIES(${TARGET_ASKUSER_NOTIFICATION_LIB}
- PROPERTIES
- SOVERSION ${ASKUSER_NOTIFICATION_VERSION_MAJOR}
- VERSION ${ASKUSER_NOTIFICATION_VERSION}
- OUTPUT_NAME "askuser-notification"
- )
-
-LINK_DIRECTORIES(${ASKUSER_NOTIFICATION_DEP_LIBRARY_DIRS})
-
-TARGET_LINK_LIBRARIES(${TARGET_ASKUSER_NOTIFICATION_LIB} ${ASKUSER_NOTIFICATION_DEP_LIBRARIES})
-TARGET_LINK_LIBRARIES(${TARGET_ASKUSER_NOTIFICATION_TEST} ${TARGET_ASKUSER_NOTIFICATION_LIB})
-
-INSTALL(TARGETS ${TARGET_ASKUSER_NOTIFICATION_LIB}
- DESTINATION ${LIB_INSTALL_DIR})
-
-CONFIGURE_FILE(${PC_FILE}.in ${PROTOCOL_PATH}/${PC_FILE} @ONLY)
-INSTALL(FILES ${PROTOCOL_PATH}/${PC_FILE}
- DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-FILE(GLOB HEADERS ${PROTOCOL_PATH}/askuser-notification/*.h)
-INSTALL(FILES ${HEADERS}
- DESTINATION ${INCLUDE_INSTALL_DIR}/askuser-notification)
-
-INSTALL(TARGETS ${TARGET_ASKUSER_NOTIFICATION_TEST}
- DESTINATION ${BIN_INSTALL_DIR})
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file ipc-client.cpp
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#include <sstream>
-#include <string>
-#include <vector>
-#include <memory>
-
-#include <askuser-notification/ask-user-client.h>
-#include <askuser-notification/ask-user-service.h>
-
-#include <ask-user-config.h>
-#include <sock.h>
-
-#define UNUSED __attribute__((unused))
-
-namespace AskUser {
-namespace Protocol {
-
-int popup_launch(const std::string &pkgName,
- const std::string &appName,
- uid_t uid,
- const PrivilegeVector &privileges,
- int &result)
-{
- try {
- Sock s(Sock::CLI_STREAM);
- if (0 > s.connect(getStreamSocketPath(uid)))
- return -1;
-
- std::stringstream ss;
- ss << MSGID_POPUP << " " << pkgName << " " << appName << " " << uid;
- for (auto &e : privileges) {
- ss << " " << e;
- }
-
- std::string str = ss.str();
-
- if (0 > s.send(RawBuffer(str.begin(), str.end())))
- return -1;
-
- RawBuffer resp;
- if (0 > s.wait(FdMask::READ))
- return -1;
- if (0 > s.recv(resp))
- return -1;
-
- std::string input(resp.begin(), resp.end());
- std::stringstream sss(input);
- sss >> result;
-
- return 0;
- } catch (const std::exception &) {
- return -1;
- }
-}
-
-int popup_runtime(UNUSED const std::string &pkgName,
- UNUSED const std::string &appName,
- UNUSED uid_t uid,
- UNUSED std::string &privilege,
- UNUSED int &result)
-{
- return -1;
-}
-
-
-int toast_deny(const std::string &pkgName,
- const std::string &appName,
- uid_t uid,
- const std::string &privilege)
-{
- try {
- Sock s(Sock::CLI_DGRAM);
- if (0 > s.connect(getDatagramSocketPath(uid)))
- return -1;
-
- std::string str = std::to_string(MSGID_TOAST1) + " " + pkgName + " " + appName + " " + std::to_string(uid) + " " + privilege;
-
- return s.send(RawBuffer(str.begin(), str.end()));
- } catch (const std::exception &) {
- return -1;
- }
-}
-
-int toast_fail_launch(const std::string &pkgName, const std::string &appName, uid_t uid) {
- try {
- Sock s(Sock::CLI_DGRAM);
- if (0 > s.connect(getDatagramSocketPath(uid)))
- return -1;
-
- std::string str = std::to_string(MSGID_TOAST2) + " " + pkgName + " " + appName + " " + std::to_string(uid);
-
- return s.send(RawBuffer(str.begin(), str.end()));
- } catch (const std::exception &) {
- return -1;
- }
-}
-
-} // namespace Protocol
-} // namespace AskUser
-
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file ask-user-config.cpp
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#include <ask-user-config.h>
-
-namespace {
-const std::string USER_EXT_PATH("/run/user_ext/");
-const std::string SOCKET_STREAM_NAME("/askuser-notification-stream.socket");
-const std::string SOCKET_DGRAM_NAME("/askuser-notification-datagram.socket");
-} // namespace anonymous
-
-std::string getDatagramSocketPath(uid_t uid) {
- return USER_EXT_PATH + std::to_string(uid) + SOCKET_DGRAM_NAME;
-}
-
-std::string getStreamSocketPath(uid_t uid) {
- return USER_EXT_PATH + std::to_string(uid) + SOCKET_STREAM_NAME;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file ask-user-config.h
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#pragma once
-
-#include <string>
-#include <sys/types.h>
-
-// We want to use it constat expressions (this is the reason why it's not in cpp file
-const int MSGID_POPUP = 1;
-const int MSGID_TOAST1 = 2;
-const int MSGID_TOAST2 = 3;
-
-std::string getDatagramSocketPath(uid_t uid);
-std::string getStreamSocketPath(uid_t uid);
-
+++ /dev/null
-# Package Information for pkg-config
-
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
-
-Name: askuser-notification
-Description: askuser-notification library
-Version: @ASKUSER_NOTIFICATION_VERSION@
-Libs: -L${libdir} -laskuser-notification
-Cflags: -I${includedir}/askuser-notification
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file ask-user-client.h
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#pragma once
-
-#include <sys/types.h>
-
-#include <string>
-#include <vector>
-#include <memory>
-#include <askuser-notification/ask-user-types.h>
-
-namespace AskUser {
-namespace Protocol {
-/**
- * Synchronous request for showing popup.
- *
- * \param[in] pkgName Application package name.
- * \param[in] appName Application name.
- * \param[in] uid Information about user that should see popup.
- * \param[in] privileges List of privileges that should be shown to user.
- * \param[out] result Result returned by ask-user application.
- *
- * \return Value less that 0 means ipc error.
- */
- int popup_launch(const std::string &pkgName, const std::string &appName, uid_t uid, const PrivilegeVector &privileges, int &result);
-
- /**
- * Synchronous request for showing popup.
- *
- * \param[in] pkgName Application package name.
- * \param[in] appName Application name.
- * \param[in] uid Information about user that should see popup.
- * \param[in] privilege Privilege that should be shown to user.
- * \param[out] result Result returned by ask-user application.
- *
- * \return Value less that 0 means ipc error.
- */
- int popup_runtime(const std::string &pkgName, const std::string &appName, uid_t uid, std::string &privilege, int &result);
-
-/**
- * Nonblocking request for showing toast.
- *
- * \param[in] pkgName Application package name.
- * \param[in] appName Application name.
- * \param[in] uid Information about user that should see popup.
- * \param[in] privilege Name of privilege that was denied.
- *
- * \return Value less that 0 means ipc error.
- */
-int toast_deny(const std::string &pkgName, const std::string &appName, uid_t uid, const std::string &privilege);
-
-/**
- * Nonblocking request for showing toast.
- *
- * \param[in] pkgName Application package name.
- * \param[in] appName Application name.
- * \param[in] uid Information about user that should see popup.
- *
- * \return Value less that 0 means ipc error.
- */
-int toast_fail_launch(const std::string &pkgName, const std::string &appName, uid_t uid);
-
-} // namespace Protocol
-} // namespace AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file ask-user-service.h
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#pragma once
-
-#include <sys/types.h>
-
-#include <string>
-#include <vector>
-#include <memory>
-
-#include <askuser-notification/ask-user-types.h>
-
-namespace AskUser {
-namespace Protocol {
-
-enum FdMask {
- READ = 1,
- WRITE = 2,
-};
-
-/**
- * IServiceCallbacks defines set of callbacks that must be implemented in service.
- */
-
-struct IServerCallbacks {
-
- virtual ~IServerCallbacks(){}
- /**
- * This function gives you number of descriptor that should be watched by poll/select.
- *
- * \param[in] fd Number of opened descriptor.
- * \param[in] mask Type of acction that is required on this descriptor.
- * mask == 0 remove descriptor fd from watched pool
- * mask == 1 watch descriptor for READ
- * mask == 2 watch descriptor for WRITE
- * maks == 3 watch descriptor for READ and WRITE
- */
- virtual void updateFd(int fd, int mask) = 0;
- /**
- * some client called popup function with parameters.
- */
- virtual void popup_launch(int requestId, const std::string &pkgName, const std::string &appName, uid_t uid, const PrivilegeVector &privileges) = 0;
- /**
- * some client called test_deny function with parameters.
- */
- virtual void toast_deny(const std::string &pkgName, const std::string &appName, uid_t uid, const Privilege &privilege) = 0;
- /**
- * some client called toast_fail_launch function with parameters.
- */
- virtual void toast_fail_launch(const std::string &pkgName, const std::string &appName, uid_t uid) = 0;
-};
-
-struct IChannel {
- virtual ~IChannel(){}
-
- /**
- * Process function should be called each time some event is reported by poll/select on
- * descriptor.
- *
- * \param[in] fd Number of descriptor.
- * \param[in] mask Information about event that is waiting on descriptor
- * (FdMask::READ or FdMask::WRITE). If you pass 0 for some reason
- * the descriptor will be closed and callback updateFd will be called
- * with mask = 0
- */
- virtual void process(int fd, int mask) = 0;
-
- /**
- * Information about action that was choosed by user.
- *
- * \param[in] requestId Request number.
- * \param[in] response Information about action choosed by user.
- */
- virtual void popupResponse(int requestId, int response) = 0;
-};
-
-typedef std::unique_ptr<IChannel> ChannelPtr;
-typedef std::unique_ptr<IServerCallbacks> ServerCallbacksPtr;
-
-ChannelPtr createChannel(ServerCallbacksPtr ptr);
-
-} // namespace Protocol
-} // namespace AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file ask-user-types.h
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#pragma once
-
-#define ASKUSER_NONE 0
-#define ASKUSER_DENY_ONCE 1
-#define ASKUSER_DENY_FOREVER 2
-#define ASKUSER_ALLOW_ONCE 3
-#define ASKUSER_ALLOW_FOREVER 4
-#define ASKUSER_UNKNOWN_ERROR -255
-
-namespace AskUser {
-namespace Protocol {
-
-typedef std::string Privilege;
-typedef std::vector<Privilege> PrivilegeVector;
-
-} // namespace Protocol
-} // AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file channel.cpp
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#include <string>
-
-#include <askuser-notification/ask-user-service.h>
-
-#include <ask-user-config.h>
-#include <channel.h>
-#include <sock.h>
-
-namespace AskUser {
-namespace Protocol {
-
-void Channel::init() {
- Sock stream(Sock::SRV_STREAM);
- Sock datagram(Sock::SRV_DGRAM);
-
- stream.connect(getStreamSocketPath(getuid()));
- datagram.connect(getDatagramSocketPath(getuid()));
-
- int fd1 = stream.getFd();
- int fd2 = datagram.getFd();
-
- m_socket[fd1] = SockDesc(std::move(stream));
- m_socket[fd2] = SockDesc(std::move(datagram));
-
- m_callbacks->updateFd(fd1, FdMask::READ);
- m_callbacks->updateFd(fd2, FdMask::READ);
-}
-
-void Channel::parse(const std::string &data, std::vector<std::string> &parsedData)
-{
- size_t begin = 0;
-
- while (begin < data.size()) {
- size_t end = data.find(' ', begin);
-
- if (end == std::string::npos) {
- parsedData.push_back(data.substr(begin));
- return;
- }
-
- parsedData.push_back(data.substr(begin, end - begin));
- begin = end + 1;
- }
-}
-
-void Channel::process(int fd, int mask) {
- try {
- auto it = m_socket.find(fd);
- if (it == m_socket.end())
- return;
-
- if (0 == mask) {
- m_callbacks->updateFd(fd, 0);
- m_socket.erase(it);
- return;
- }
-
- auto &desc = it->second;
-
- if (desc.sock.getType() == Sock::SRV_STREAM) {
- Sock client = desc.sock.accept();
- int fd = client.getFd();
- if (fd < 0)
- return;
- m_socket[fd] = SockDesc(std::move(client));
- m_callbacks->updateFd(fd, FdMask::READ);
- return;
- }
-
- if (mask & FdMask::READ) {
- int ret = desc.sock.recv(desc.input);
-
- if (ret <= 0) {
- m_callbacks->updateFd(fd, 0);
- m_socket.erase(fd);
- return;
- }
-
- std::vector<std::string> params;
- parse(std::string(desc.input.begin(), desc.input.end()), params);
- desc.input.clear();
-
- int command = std::stoi(params[0]);
- std::string &pkgName = params[1];
- std::string &appName = params[2];
- uid_t uid = std::stoi(params[3]);
-
- switch (command) {
- case MSGID_POPUP:
- {
- PrivilegeVector vect(params.begin() + 4, params.end());
- m_callbacks->popup_launch(fd, pkgName, appName, uid, vect);
- break;
- }
- case MSGID_TOAST1:
- {
- std::string &privilege = params[4];
- m_callbacks->toast_deny(pkgName, appName, uid, privilege);
- break;
- }
- case MSGID_TOAST2:
- {
- m_callbacks->toast_fail_launch(pkgName, appName, uid);
- break;
- }
- }
- }
-
- if (mask & FdMask::WRITE) {
- int size = static_cast<int>(desc.output.size());
- int result = desc.sock.send(desc.output);
- if (result < 0) {
- m_callbacks->updateFd(fd, 0);
- m_socket.erase(fd);
- return;
- }
-
- if (result == size) {
- desc.output.clear();
- m_callbacks->updateFd(fd, FdMask::READ);
- }
-
- if (result < size) {
- desc.output.erase(desc.output.begin(), desc.output.begin()+result);
- }
- }
- } catch (const std::exception &){}
-}
-
-void Channel::popupResponse(int requestId, int response) {
- try {
- auto it = m_socket.find(requestId);
- if (it == m_socket.end())
- return;
-
- auto &desc = it->second;
-
- std::string o = std::to_string(response);
- std::copy(o.begin(), o.end(), std::back_inserter(desc.output));
- m_callbacks->updateFd(requestId, FdMask::READ | FdMask::WRITE);
- } catch (const std::exception &){}
-}
-
-Channel::~Channel() {
- for (auto &e : m_socket)
- m_callbacks->updateFd(e.first, 0);
-}
-
-ChannelPtr createChannel(ServerCallbacksPtr ptr) {
- try {
- Channel *c = new Channel(std::move(ptr));
- c->init();
- return ChannelPtr(c);
- } catch (const std::exception &) {
- return ChannelPtr(nullptr);
- }
-}
-
-} // namespace Protocol
-} // namespace AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file channel.h
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#pragma once
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <askuser-notification/ask-user-service.h>
-
-#include <raw-buffer.h>
-#include <sock.h>
-
-
-namespace AskUser {
-namespace Protocol {
-
-struct SockDesc {
- SockDesc(Sock psock)
- : sock(std::move(psock))
- {}
- SockDesc(){}
- Sock sock;
- RawBuffer input;
- RawBuffer output;
-};
-
-typedef std::map<int, SockDesc> SocketMap;
-
-class Channel : public IChannel {
-public:
- Channel(ServerCallbacksPtr ptr)
- : m_callbacks(std::move(ptr))
- {}
-
- void init();
- virtual void process(int fd, int mask);
- virtual void popupResponse(int requestId, int response);
- virtual ~Channel();
-
-private:
- virtual void parse(const std::string &data, std::vector<std::string> &parsedData);
-
- ServerCallbacksPtr m_callbacks;
- SocketMap m_socket;
-};
-
-} // namespace Protocol
-} // namespace AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file main.cpp
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#include <map>
-
-#include <poll.h>
-#include <unistd.h>
-
-#include <askuser-notification/ask-user-client.h>
-#include <askuser-notification/ask-user-service.h>
-
-std::map<int, int> m_sockets;
-
-#define UNUSED __attribute__((unused))
-
-using namespace AskUser::Protocol;
-
-struct Callbacks : public IServerCallbacks {
- Callbacks() : m_channel(nullptr) {}
-
- virtual void updateFd(int fd, int mask) {
- printf("call updateFd %d %d\n", fd, mask);
- if (mask == 0) {
- m_sockets.erase(fd);
- return;
- }
- m_sockets[fd] = mask;
- }
-
- virtual void popup_launch(int requestId, const std::string &pkgName, const std::string &appName, uid_t uid, UNUSED const PrivilegeVector &priv) {
- printf("call popup %s %s %d\n", pkgName.c_str(), appName.c_str(), uid);
- if (m_channel)
- m_channel->popupResponse(requestId, 0xdeadbeef);
- }
-
- virtual void toast_deny(const std::string &pkgName, const std::string &appName, uid_t uid, UNUSED const Privilege &privilege) {
- printf("call toast_deny %s %s %d\n", pkgName.c_str(), appName.c_str(), uid);
- }
-
- virtual void toast_fail_launch(const std::string &pkgName, const std::string &appName, uid_t uid) {
- printf("call toast_fail_launch %s %s %d\n", pkgName.c_str(), appName.c_str(), uid);
- }
-
- void setChannel(IChannel *ptr) {
- m_channel = ptr;
- }
-
-private:
- IChannel *m_channel;
-};
-
-void server(void) {
- Callbacks *c = new Callbacks;
- ChannelPtr ptr = createChannel(ServerCallbacksPtr(c));
- c->setChannel(ptr.get());
-
- pollfd fd[100];
-
- while(1) {
- int last = 0;
- for (auto &e : m_sockets) {
- fd[last].fd = e.first;
- fd[last].revents = 0;
- fd[last].events = ((e.second & FdMask::READ) ? POLLIN : 0) | ((e.second & FdMask::WRITE) ? POLLOUT : 0);
- last++;
- }
- if (-1 == poll(fd, last, -1)) {
- printf("Error in poll. Quit\n");
- return;
- }
- for (int i=0; i<last; ++i) {
- if (fd[i].revents & POLLIN)
- ptr->process(fd[i].fd, FdMask::READ);
- if (fd[i].revents & POLLOUT)
- ptr->process(fd[i].fd, FdMask::WRITE);
- }
- }
-}
-
-void stream() {
- PrivilegeVector vect = {"http://tizen.org/privilege/camera", "http://tizen.org/privilege/contacts"};
- int result;
- UNUSED int ret = popup_launch("org.tizen.memo", "org.tizen.memo", getuid(), vect, result);
- printf("Sended stream. Result: %x\n", result);
-}
-
-void toust1() {
- toast_deny("org.tizen.memo", "org.tizen.memo", getuid(), "http://tizen.org/privilege/camera");
- printf("sended\n");
-}
-
-void toust2() {
- toast_fail_launch("org.tizen.memo", "org.tizen.memo", getuid());
- printf("sended\n");
-}
-
-int main(){
- int com;
- printf("0 - server, 1 - send popup, 2 - send toust1, 3 - send toust2\n>");
- UNUSED int ret = scanf("%d", &com);
-
- switch(com) {
- case 0:
- server();
- break;
- case 1:
- stream();
- break;
- case 2:
- toust1();
- break;
- case 3:
- toust2();
- break;
- }
-
- return 0;
-}
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file raw-buffer.h
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief
- */
-#pragma once
-
-#include <vector>
-
-namespace AskUser {
-namespace Protocol {
-
-typedef std::vector<unsigned char> RawBuffer;
-
-} // namespace Protocol
-} // namespace AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file Sock.cpp
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief Implementation of Sock methods
- */
-#include <poll.h>
-#include <stdexcept>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-#ifdef BUILD_WITH_SYSTEMD_DAEMON
-#include <systemd/sd-daemon.h>
-#endif // BUILD_WITH_SYSTEMD_DAEMON
-
-#include <string>
-#include <vector>
-
-#include <askuser-notification/ask-user-service.h>
-
-#include <sock.h>
-
-namespace AskUser {
-namespace Protocol {
-
-Sock::Sock(Sock &&second)
- : m_type(second.m_type)
- , m_fd(second.m_fd)
-{
- second.m_fd = -1;
-}
-
-Sock::Sock(Sock::Type type, int fd)
- : m_type(type)
- , m_fd(fd)
-{}
-
-Sock& Sock::operator=(Sock &&second) {
- if (this == &second)
- return *this;
-
- close();
-
- m_fd = second.m_fd;
- m_type = second.m_type;
-
- second.m_fd = -1;
-
- return *this;
-}
-
-
-int Sock::getUnixSockType() const {
- switch(m_type) {
- case SRV_DGRAM:
- case CLI_DGRAM:
- return SOCK_DGRAM;
- case SRV_STREAM:
- case CLI_STREAM:
- return SOCK_STREAM;
- }
- return 0;
-}
-
-int Sock::getSocketFromSystemD() const {
-#ifdef BUILD_WITH_SYSTEMD_DAEMON
- int n = sd_listen_fds(0);
-
- if (n < 0)
- return -1;
-
- for (int fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START+n; ++fd)
- if (0 < sd_is_socket_unix(fd, getUnixSockType(), -1, m_path.c_str(), 0))
- return fd;
-#endif // BUILD_WITH_SYSTEMD_DAEMON
- return -1;
-}
-
-int Sock::connect(const std::string &path) {
- if (m_fd != -1)
- return -1;
-
- m_path = path;
-
- bool policySystemD = true;
- bool policyUnlink = true;
- bool policySocket = true;
- bool policyBind = true;
- bool policyListen = true;
- bool policyConnect = true;
-
- switch(m_type) {
- case SRV_STREAM:
- policyConnect = false;
- break;
- case CLI_STREAM:
- policySystemD = false;
- policyUnlink = false;
- policyBind = false;
- policyListen = false;
- break;
- case SRV_DGRAM:
- policyListen = false;
- policyConnect = false;
- break;
- case CLI_DGRAM:
- policySystemD = false;
- policyUnlink = false;
- policyBind = false;
- policyListen = false;
- policyConnect = false;
- break;
- }
-
- if (m_fd != -1) {
- return -1;
- }
-
- if (policySystemD) {
- m_fd = getSocketFromSystemD();
- if (m_fd >= 0) {
- policyUnlink = false;
- policySocket = false;
- policyBind = false;
- }
- }
-
- if (policyUnlink)
- ::unlink(m_path.c_str()); // we ignore return value by design
-
- if (policySocket)
- m_fd = ::socket(AF_UNIX, getUnixSockType(), 0);
-
- if (m_fd < 0)
- return -1;
-
- // remote is used in bind and in connect
- sockaddr_un remote;
- auto length = sizeof(sockaddr_un);
- if (policyBind || policyConnect) {
- remote.sun_family = AF_UNIX;
- if (path.size() >= sizeof(remote.sun_path)) {
- close();
- return -1;
- }
- memcpy(remote.sun_path, path.c_str(), path.size()+1);
- }
-
- if (policyBind && (-1 == ::bind(m_fd, reinterpret_cast<sockaddr *>(&remote), sizeof(remote)))) {
- close();
- return -1;
- }
-
- if (policyListen && (-1 == ::listen(m_fd, 5))) {
- close();
- return -1;
- }
-
- if (policyConnect && (-1 == TEMP_FAILURE_RETRY(::connect(m_fd, reinterpret_cast<sockaddr *>(&remote), static_cast<socklen_t>(length)))))
- {
- close();
- return -1;
- }
- return 0;
-}
-
-Sock Sock::accept() {
- int retFd = TEMP_FAILURE_RETRY(::accept(m_fd, nullptr, nullptr));
- if (retFd < 0) {
- return Sock(CLI_STREAM, -1);
- }
- return Sock(CLI_STREAM, retFd);
-}
-
-int Sock::send(const RawBuffer &buffer) {
- static const int flags = MSG_NOSIGNAL | MSG_DONTWAIT;
- if (m_fd < 0)
- return -1;
-
- switch(m_type) {
- default:
- return -1;
- case CLI_STREAM:
- {
- return static_cast<int>(
- TEMP_FAILURE_RETRY(::send(m_fd, buffer.data(), buffer.size(), flags)));
- }
- case CLI_DGRAM:
- {
- struct sockaddr_un addr;
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_UNIX;
- memcpy(addr.sun_path, m_path.data(), m_path.size());
- return static_cast<int>(
- TEMP_FAILURE_RETRY(::sendto(m_fd, buffer.data(), buffer.size(), flags,
- reinterpret_cast<const struct sockaddr*>(&addr), sizeof(addr))));
- }
- }
-}
-
-int Sock::wait(int mask) {
- pollfd fd = {0, 0, 0};
-
- fd.fd = m_fd;
- fd.events = (mask & FdMask::READ ? POLLIN : 0) | (mask & FdMask::WRITE ? POLLOUT : 0);
-
- if (fd.events == 0)
- return -1;
-
- if (0 > ::poll(&fd, 1, -1))
- return -1;
- return 0;
-}
-
-int Sock::recv(RawBuffer &output) {
- if (m_fd < 0)
- return -1;
-
- switch(m_type) {
- default:
- return -1;
- case CLI_STREAM:
- case SRV_DGRAM:
- {
- RawBuffer buffer(4096);
- int result = TEMP_FAILURE_RETRY(::recv(m_fd, buffer.data(), buffer.size(), MSG_DONTWAIT));
- if (result > 0)
- std::copy(buffer.begin(), buffer.begin()+result, std::back_inserter(output));
- return static_cast<int>(result);
- }
- }
-}
-
-void Sock::close() {
- if (m_fd >= 0)
- ::close(m_fd);
- m_fd = -1;
-}
-
-} // namespace Protocol
-} // namespace AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file Sock.cpp
- * @author Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- * @brief Declaration of client/server Sock wrapper
- */
-
-#pragma once
-
-#include <string>
-#include <unistd.h>
-
-#include <raw-buffer.h>
-
-namespace AskUser {
-namespace Protocol {
-
-class Sock {
-public:
- enum Type {
- SRV_STREAM, // server side STREAM socket (you may call accept on it)
- // accept will always return CLI_STREAM
- CLI_STREAM, // client side STREAM socket
- SRV_DGRAM, // server side DATAGRAM socket
- CLI_DGRAM, // client side DATAGRAM socket
- };
-
- Sock(Type type = SRV_STREAM, int fd = -1);
-
- Sock(const Sock &other) = delete;
- Sock &operator=(const Sock &other) = delete;
-
- Sock(Sock &&other);
- Sock &operator=(Sock &&other);
-
- virtual ~Sock() { close(); }
-
- int getFd() const { return m_fd; }
- int getType() const { return m_type; }
- int getUnixSockType() const;
-
- int connect(const std::string &path);
- Sock accept();
- void close();
-
- int wait(int mask);
- int recv(RawBuffer &buffer);
- int send(const RawBuffer &buffer);
-
-private:
- int getSocketFromSystemD() const;
-
- Type m_type;
- int m_fd;
- std::string m_path;
-};
-
-} // namespace Protocol
-} // namespace AskUser
-
+++ /dev/null
-/*
- * Copyright (c) 2014-2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file GuiTranslator.cpp
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @author Oskar Ĺwitalski <o.switalski@samsung.com>
- * @brief Implementation of GuiTranslator methods
- */
-
-#include "GuiTranslator.h"
-
-#include <sstream>
-#include <vector>
-
-namespace AskUser {
-namespace Translator {
-namespace Gui {
-
-std::string responseToString(NResponseType response)
-{
- switch (response) {
- case NResponseType::Allow:
- return "Allow once";
- case NResponseType::Deny:
- return "Deny once";
- case NResponseType::AllowAlways:
- return "Allow always";
- case NResponseType::DenyAlways:
- return "Deny always";
- case NResponseType::Error:
- return "Error";
- default:
- return "None";
- }
-}
-
-NotificationRequest dataToNotificationRequest(const std::string &data) {
- std::stringstream stream(data);
- std::size_t strSize;
- char separator;
-
- NotificationRequestId id;
- std::string members[3];
-
- stream >> id;
- stream.read(&separator, 1);
-
- for (auto &member : members) {
- stream >> strSize;
- std::vector<char> buffer(strSize, '\0');
- char separator;
- //Consume separator
- stream.read(&separator, 1);
- stream.read(buffer.data(), strSize);
- //read doesn't append null
- member.assign(buffer.begin(), buffer.end());
- }
-
- return NotificationRequest({id, std::move(members[0]), std::move(members[1]), "", std::move(members[2])});
-}
-
-std::string notificationRequestToData(NotificationRequestId id, const std::string &client,
- const std::string &pkgLabel, const std::string &privilege)
-{
- const char separator = ' ';
- return std::to_string(id) + separator +
- std::to_string(client.length()) + separator + client + separator +
- std::to_string(pkgLabel.length()) + separator + pkgLabel + separator +
- std::to_string(privilege.length()) + separator + privilege + separator + separator;
-}
-
-} //namespace Gui
-} //namespace Translator
-} //namespace AskUser
+++ /dev/null
-/*
- * Copyright (c) 2014-2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file GuiTranslator.h
- * @author Zofia Abramowska <z.abramowska@samsung.com>
- * @author Oskar Ĺwitalski <o.switalski@samsung.com>
- * @brief Definition of GuiTranslator methods
- */
-
-#pragma once
-
-#include <types/NotificationRequest.h>
-#include <types/NotificationResponse.h>
-#include <types/NotificationRequestId.h>
-
-#include <string>
-
-namespace AskUser {
-namespace Translator {
-namespace Gui {
-
-std::string responseToString(NResponseType response);
-NotificationRequest dataToNotificationRequest(const std::string &data);
-std::string notificationRequestToData(NotificationRequestId id, const std::string &client,
- const std::string &pkgLabel, const std::string &privilege);
-} // namespace Gui
-} // namespace Translator
-} // namespace AskUser
/*
- * Copyright (c) 2014-2017 Samsung Electronics Co.
+ * Copyright (c) 2014-2016 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <limits>
#include <stdexcept>
#include <sstream>
-#include <vector>
namespace AskUser {
namespace Translator {
}
} //namespace Plugin
+
+namespace Gui {
+std::string responseToString(NResponseType response)
+{
+ switch (response) {
+ case NResponseType::Allow:
+ return "Allow once";
+ case NResponseType::Deny:
+ return "Deny once";
+ case NResponseType::AllowAlways:
+ return "Allow always";
+ case NResponseType::DenyAlways:
+ return "Deny always";
+ case NResponseType::Error:
+ return "Error";
+ default:
+ return "None";
+ }
+}
+
+NotificationRequest dataToNotificationRequest(const std::string &data) {
+ std::stringstream stream(data);
+ std::size_t strSize;
+ char separator;
+
+ cynara_agent_req_id id;
+ std::string members[2];
+
+ stream >> id;
+ stream.read(&separator, 1);
+
+ for (auto &member : members) {
+ stream >> strSize;
+ std::vector<char> buffer(strSize, '\0');
+ char separator;
+ //Consume separator
+ stream.read(&separator, 1);
+ stream.read(buffer.data(), strSize);
+ //read doesn't append null
+ member.assign(buffer.begin(), buffer.end());
+ }
+
+ return NotificationRequest({id, std::move(members[0]), "", std::move(members[1])});
+}
+
+std::string notificationRequestToData(RequestId id, const std::string &client,
+ const std::string &privilege)
+{
+ const char separator = ' ';
+ return std::to_string(id) + separator +
+ std::to_string(client.length()) + separator + client + separator +
+ std::to_string(privilege.length()) + separator + privilege + separator + separator;
+}
+
+} //namespace Gui
} //namespace Translator
} //namespace AskUser
/*
- * Copyright (c) 2014-2017 Samsung Electronics Co.
+ * Copyright (c) 2014-2016 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#pragma once
+#include <types/NotificationRequest.h>
+#include <types/NotificationResponse.h>
#include <types/RequestData.h>
#include <types/SupportedTypes.h>
#include <cynara-plugin.h>
const std::string &privilege);
} // namespace Plugin
+namespace Gui {
+
+std::string responseToString(NResponseType response);
+NotificationRequest dataToNotificationRequest(const std::string &data);
+std::string notificationRequestToData(RequestId id, const std::string &client,
+ const std::string &privilege);
+} // namespace Gui
} // namespace Translator
} // namespace AskUser
/*
- * Copyright (c) 2016-2017 Samsung Electronics Co.
+ * Copyright (c) 2016 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License
*/
/**
- * @file src/common/types/NotificationRequest.h
+ * @file src/common/types/NotificationResponse.h
* @author Oskar Ĺwitalski <o.switalski@samsung.com>
* @brief Definition of common types and consts
*/
#pragma once
-#include <string>
-#include <types/NotificationRequestId.h>
+#include <types/RequestId.h>
#include <types/RequestData.h>
namespace AskUser {
struct NotificationRequest {
NotificationRequest() : id(-1) {};
- NotificationRequest(NotificationRequestId id_) : id(id_) {};
- NotificationRequest(NotificationRequestId id_, std::string client, std::string pkgLabel,
- std::string user, std::string privilege)
+ NotificationRequest(RequestId id_) : id(id_) {};
+ NotificationRequest(RequestId id_, std::string client, std::string user, std::string privilege)
: id(id_),
- data{std::move(client), std::move(user), std::move(privilege)},
- pkgLabel(std::move(pkgLabel))
+ data{std::move(client), std::move(user), std::move(privilege)}
{}
- NotificationRequestId id;
+ RequestId id;
RequestData data;
- std::string pkgLabel;
};
} // namespace AskUser
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file NotificationRequestId.h
- * @author Dariusz Michaluk <d.michaluk@samsung.com>
- * @brief NotificationRequestId typedef
- */
-
-#pragma once
-
-#include <cstdint>
-
-namespace AskUser {
-
-typedef uint16_t NotificationRequestId;
-
-} // namespace AskUser
/*
- * Copyright (c) 2016-2017 Samsung Electronics Co.
+ * Copyright (c) 2016 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#pragma once
-#include <types/NotificationRequestId.h>
+#include <cynara-agent.h>
+#include <types/RequestId.h>
namespace AskUser {
};
struct NotificationResponse {
- NotificationRequestId id;
+ RequestId id;
NResponseType response;
};
DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/service/)
INSTALL(TARGETS ${TARGET_PLUGIN_CLIENT}
DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/client/)
-
-########################## PRIVACY DENIED PLUGINS ##############################
-
-PKG_CHECK_MODULES(PDP_DEP
- REQUIRED
- cynara-plugin
- security-manager
- askuser-notification
- )
-
-INCLUDE_DIRECTORIES(
- ${ASKUSER_PATH}/common/config
- SYSTEM
- ${PDP_DEP_INCLUDE_DIRS}
- )
-
-SET(PDP_CLIENT_SOURCES
- ${PLUGIN_PATH}/client/PrivacyPlugin.cpp
- )
-
-SET(PDP_SERVICE_SOURCES
- ${PLUGIN_PATH}/service/PrivacyPlugin.cpp
- )
-
-LINK_DIRECTORIES(${PDP_DEP_LIBRARY_DIRS})
-
-ADD_LIBRARY(${TARGET_PRIVACYDENIED_PLUGIN_SERVICE} SHARED ${PDP_SERVICE_SOURCES})
-ADD_LIBRARY(${TARGET_PRIVACYDENIED_PLUGIN_CLIENT} SHARED ${PDP_CLIENT_SOURCES})
-
-TARGET_LINK_LIBRARIES(${TARGET_PRIVACYDENIED_PLUGIN_SERVICE} ${PDP_DEP_LIBRARIES})
-TARGET_LINK_LIBRARIES(${TARGET_PRIVACYDENIED_PLUGIN_CLIENT} ${PDP_DEP_LIBRARIES})
-
-INSTALL(TARGETS ${TARGET_PRIVACYDENIED_PLUGIN_SERVICE}
- DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/service/)
-INSTALL(TARGETS ${TARGET_PRIVACYDENIED_PLUGIN_CLIENT}
- DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/client/)
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file PrivacyPlugin.cpp
- * @author
- * @brief Implementation of cynara client side PrivacyDenied plugin.
- */
-
-#include <vector>
-#include <cynara-client-plugin.h>
-#include <cynara-error.h>
-
-#include <attributes/attributes.h>
-#include <PrivacyConfig.h>
-
-using namespace Cynara;
-
-namespace PrivacyDeniedPlugin {
-const std::vector<PolicyDescription> clientDescriptions = {
- { Config::ASK_USER_LEGACY, "ASK_USER_LEGACY" },
- { Config::PRIVACY_DENY, "PRIVACY_DENY" }
-};
-
-class ClientPlugin : public ClientPluginInterface {
-public:
- const std::vector<PolicyDescription> &getSupportedPolicyDescr() {
- return clientDescriptions;
- }
-
- bool isCacheable(const ClientSession &session UNUSED, const PolicyResult &result UNUSED) {
- return true;
- }
-
- bool isUsable(const ClientSession &session,
- const ClientSession &prevSession,
- bool &updateSession,
- PolicyResult &result UNUSED)
- {
- updateSession = false;
- return (session.compare(prevSession) == 0);
- }
-
- void invalidate() {}
-
- int toResult(const ClientSession &session UNUSED, PolicyResult &result UNUSED) {
- return CYNARA_API_ACCESS_DENIED;
- }
-};
-
-} // namespace PrivacyDeniedPlugin
-
-extern "C" {
-
-ExternalPluginInterface *create(void) {
- return new PrivacyDeniedPlugin::ClientPlugin();
-}
-
-void destroy(ExternalPluginInterface *ptr) {
- delete ptr;
-}
-
-} // extern "C"
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-/**
- * @file PrivacyPlugin.cpp
- * @author
- * @brief Implementation of cynara service side PrivacyDenied plugin.
- */
-
-#include <memory>
-#include <string>
-#include <vector>
-#include <cynara-plugin.h>
-
-#include <app-runtime.h>
-#include <attributes/attributes.h>
-#include <PrivacyConfig.h>
-#include <askuser-notification/ask-user-client.h>
-
-using namespace Cynara;
-
-namespace PrivacyDeniedPlugin {
-
-const std::vector<PolicyDescription> serviceDescriptions = {
- { Config::ASK_USER_LEGACY, "ASK_USER_LEGACY" },
- { Config::PRIVACY_DENY, "PRIVACY_DENY" }
-};
-
-class ServicePlugin : public ServicePluginInterface {
-public:
- ServicePlugin() {}
-
- const std::vector<PolicyDescription> &getSupportedPolicyDescr() {
- return serviceDescriptions;
- }
-
- PluginStatus check(const std::string &client,
- const std::string &user,
- const std::string &privilege,
- PolicyResult &result UNUSED,
- AgentType &requiredAgent UNUSED,
- PluginData &pluginData UNUSED) noexcept
- {
- toast(client, user, privilege);
- return PluginStatus::ANSWER_READY;
- }
-
- PluginStatus update(const std::string &client UNUSED,
- const std::string &user UNUSED,
- const std::string &privilege UNUSED,
- const PluginData &agentData UNUSED,
- PolicyResult &result UNUSED) noexcept
- {
- // This function should be never called
- return PluginStatus::ERROR;
- }
-
- void invalidate() {}
-
-private:
- void toast(const std::string &client, const std::string &user, const std::string &privilege) {
- char *pkgName = nullptr, *appName = nullptr;
- int ret = security_manager_identify_app_from_cynara_client(client.c_str(), &pkgName, &appName);
- if (ret != SECURITY_MANAGER_SUCCESS || pkgName == nullptr)
- return;
-
- std::unique_ptr<char, decltype(free)*> pkgNamePtr(pkgName, free);
- std::unique_ptr<char, decltype(free)*> appNamePtr(appName, free);
- AskUser::Protocol::toast_deny(pkgName, (appName ? appName : ""), std::stoi(user), privilege);
- }
-};
-
-} // namespace PrivacyDeniedPlugin
-
-extern "C" {
-ExternalPluginInterface *create(void) {
- return new PrivacyDeniedPlugin::ServicePlugin();
-}
-
-void destroy(ExternalPluginInterface *ptr) {
- delete ptr;
-}
-} // extern "C"
-# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# @author Adam Malinowski <a.malinowsk2@partner.samsung.com>
#
-IF (BUILD_ASKUSER)
INSTALL(FILES
- ${CMAKE_SOURCE_DIR}/systemd/askuser.service
+ ${CMAKE_SOURCE_DIR}/systemd/${PROJECT_NAME}.service
DESTINATION
lib/systemd/system
)
-ENDIF (BUILD_ASKUSER)
-IF (BUILD_ASKUSER_NOTIFICATION)
INSTALL(FILES
${CMAKE_SOURCE_DIR}/systemd/askuser-notification.service
- ${CMAKE_SOURCE_DIR}/systemd/askuser-notification-stream.socket
- ${CMAKE_SOURCE_DIR}/systemd/askuser-notification-datagram.socket
+ ${CMAKE_SOURCE_DIR}/systemd/askuser-notification.socket
DESTINATION
lib/systemd/user
)
-ENDIF (BUILD_ASKUSER_NOTIFICATION)
+++ /dev/null
-[Socket]
-ListenDatagram=/run/user_ext/%U/askuser-notification-datagram.socket
-SocketMode=0777
-
-Service=askuser-notification.service
-
-[Install]
-WantedBy=sockets.target
+++ /dev/null
-[Socket]
-ListenStream=/run/user_ext/%U/askuser-notification-stream.socket
-SocketMode=0777
-
-Service=askuser-notification.service
-
-[Install]
-WantedBy=sockets.target
[Service]
ExecStart=/usr/bin/askuser-notification
Type=notify
-Sockets=askuser-notification-datagram.socket
-Sockets=askuser-notification-stream.socket
+Sockets=askuser-notification.socket
TimeoutStopSec=10
TimeoutStartSec=10
--- /dev/null
+[Socket]
+ListenStream=/run/user_ext/%U/askuser-notification.socket
+SocketMode=0770
+
+Service=askuser-notification.service
+ExecStartPost=/usr/bin/chmod 0666 /run/user_ext/%U/askuser-notification.socket
+
+[Install]
+WantedBy=sockets.target
[Unit]
Description=Ask user agent
+Before=dbus.service
[Service]
ExecStart=/usr/bin/askuser
#Environment="ASKUSER_LOG_LEVEL=LOG_DEBUG"
[Install]
-WantedBy=multi-user.target cynara.service
+WantedBy=multi-user.target
PKG_CHECK_MODULES(TESTS_DEP
QUIET gmock
- cynara-agent
+ cynara-client
+ cynara-creds-socket
+ cynara-admin
+ libsystemd-daemon
)
INCLUDE_DIRECTORIES(
- ${ASKUSER_PATH}/common
+ ${PROJECT_SOURCE_DIR}/src
+ ${PROJECT_SOURCE_DIR}/src/common
+ ${PROJECT_SOURCE_DIR}/src/agent
+ ${PROJECT_SOURCE_DIR}/src/agent/main
${gmock_INCLUDE_DIRS}
)
${TESTS_PATH}/main.cpp
${TESTS_PATH}/common/exception.cpp
${TESTS_PATH}/common/translator.cpp
+
+ ${PROJECT_SOURCE_DIR}/src/common/config/Limits.cpp
+ ${PROJECT_SOURCE_DIR}/src/common/config/Path.cpp
+ ${PROJECT_SOURCE_DIR}/src/common/log/alog.cpp
+ ${PROJECT_SOURCE_DIR}/src/common/socket/Socket.cpp
+ ${PROJECT_SOURCE_DIR}/src/common/socket/Poll.cpp
+ ${PROJECT_SOURCE_DIR}/src/common/translator/Translator.cpp
+ ${PROJECT_SOURCE_DIR}/src/common/types/AgentErrorMsg.cpp
)
ADD_DEFINITIONS(${TESTS_DEP_CFLAGS})
TARGET_LINK_LIBRARIES(${TARGET_TESTS}
${TESTS_DEP_LIBRARIES}
- ${TARGET_ASKUSER_COMMON}
- ${gmock_LDFLAGS}
- ${gmock_LIBRARIES}
+ ${gmock_LDFLAGS}
+ ${gmock_LIBRARIES}
-pie
)
/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <gtest/gtest.h>
#include <translator/Translator.h>
-#include <translator/GuiTranslator.h>
using namespace AskUser;
}
TEST(TranslatorTest, NotificationRequest) {
- NotificationRequestId id = 1234;
- std::string client = "lorem ipsum dolor est amet";
- std::string pkgLabel = "My app";
+ cynara_agent_req_id id = 1234;
+ std::string app = "lorem ipsum dolor est amet";
std::string privilege = "http://example.com/permissions/example";
- auto data = Translator::Gui::notificationRequestToData(id, client, pkgLabel, privilege);
+ auto data = Translator::Gui::notificationRequestToData(id, app, privilege);
auto request = Translator::Gui::dataToNotificationRequest(data);
ASSERT_EQ(id, request.id);
- ASSERT_EQ(client, request.data.client);
+ ASSERT_EQ(app, request.data.client);
ASSERT_EQ(privilege, request.data.privilege);
- ASSERT_EQ(pkgLabel, request.pkgLabel);
}
)
INCLUDE_DIRECTORIES(
- ${ASKUSER_PATH}/common
+ ${PROJECT_SOURCE_DIR}/src
+ ${PROJECT_SOURCE_DIR}/src/common
)
SET(TEST_SOURCES