#include <tizen.h>
#include <unistd.h>
+#include <memory>
+
#include "aul/api/aul_app_context.h"
#include "aul/app_manager/app_manager.hh"
#include "aul/common/api.hh"
#include <glib.h>
+#include <string>
+#include <utility>
+
#include "aul/app_manager/app_event.hh"
#include "aul/common/api.hh"
#include "aul/common/exception.hh"
#include <bundle_cpp.h>
+#include <memory>
+#include <string>
+
#include "aul/api/aul_app_lifecycle.h"
#include "aul/common/api.hh"
#include "aul/common/exception.hh"
}
extern "C" API int aul_app_lifecycle_deregister_state_changed_cb(void) {
- return listener.Deregister();
+ return listener.Deregister();
}
extern "C" API int aul_app_lifecycle_update_state(
bool is_sub_app_;
};
- AppContext(tizen_base::Bundle b);
+ explicit AppContext(tizen_base::Bundle b);
virtual ~AppContext();
const std::string& GetAppId() const;
};
AppEvent(std::string app_id, IEvent* ev);
- AppEvent(IEvent* ev);
+ explicit AppEvent(IEvent* ev);
virtual ~AppEvent();
private:
class FileDescriptor {
public:
- FileDescriptor(int fd = -1) : fd_(fd) {}
+ explicit FileDescriptor(int fd = -1) : fd_(fd) {}
virtual ~FileDescriptor() {
if (fd_ > -1)
class ComponentPort {
public:
- ComponentPort(std::string name);
+ explicit ComponentPort(std::string name);
virtual ~ComponentPort();
bool Exist();
class Client : public Socket {
public:
- Client(std::string path, int timeout_msec = 5000);
+ explicit Client(std::string path, int timeout_msec = 5000);
int Send(const Packet& packet);
int Recv(Packet** packet);
};
parcel->ReadInt32(&size);
parcel->ReadInt32(&opt_);
if (size > 0) {
- auto* data = new (std::nothrow) unsigned char [size];
+ auto* data = new (std::nothrow) unsigned char[size];
if (data == nullptr)
return;
class Socket {
public:
- Socket(std::string path);
- Socket(int fd);
+ explicit Socket(std::string path);
+ explicit Socket(int fd);
virtual ~Socket();
int Send(const void* buf, unsigned int len);
class AppInfo {
public:
- AppInfo(std::string appid);
+ explicit AppInfo(std::string appid);
const std::string& GetAppId() const;
const std::string& GetAfter() const;
class AppSvcDB : public Database {
public:
- AppSvcDB(uid_t uid);
+ explicit AppSvcDB(uid_t uid);
virtual ~AppSvcDB();
std::vector<std::shared_ptr<AppInfo>> Select(const std::string& package);
bool done_ = false;
};
- Database(std::string path);
+ explicit Database(std::string path);
virtual ~Database();
void Open();
class AppSvcDB : public Database {
public:
- AppSvcDB(uid_t uid);
+ explicit AppSvcDB(uid_t uid);
virtual ~AppSvcDB();
std::vector<std::shared_ptr<AliasInfo>> Select(const std::string& appid);
using namespace plugin;
extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Install, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Uninstall, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Upgrade, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Uninstall, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Uninstall, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Upgrade, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().Clean();
return 0;
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNDO(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().Undo();
return 0;
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
return 0;
}
class AppSvcDB : public Database {
public:
- AppSvcDB(uid_t uid);
+ explicit AppSvcDB(uid_t uid);
virtual ~AppSvcDB();
std::vector<std::shared_ptr<AllowedInfo>> Select(const std::string& appid);
using namespace plugin;
extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Install, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Uninstall, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Upgrade, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Uninstall, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Uninstall, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
EventType::Upgrade, list);
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().Clean();
return 0;
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNDO(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
PluginManager::GetInst().Undo();
return 0;
}
extern "C" API int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char* pkgid,
- const char* appid, GList* list)
-{
+ const char* appid, GList* list) {
_W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
return 0;
}
class Database {
public:
- Database(std::string path);
+ explicit Database(std::string path);
virtual ~Database();
void Open();
class MetadataPlugin {
public:
- MetadataPlugin(std::unique_ptr<Database> db) : db_(std::move(db)) { }
+ explicit MetadataPlugin(std::unique_ptr<Database> db) : db_(std::move(db)) { }
virtual ~MetadataPlugin() = default;
void AddAppEventArgs(const std::string& pkgid, const std::string& appid,
class BootSequence {
public:
- BootSequence(std::string appid);
+ explicit BootSequence(std::string appid);
const std::string& GetAppId() const;
const std::string& GetAfter() const;
class Database {
public:
- Database(std::string path, bool enable_foreign_keys = true);
+ explicit Database(std::string path, bool enable_foreign_keys = true);
virtual ~Database();
void Open(int flags = SQLITE_OPEN_READWRITE);
signal_name_(std::move(signal_name)),
cb_(cb),
user_data_(user_data) {
- }
+ }
- virtual ~Event() {
- Unsubscribe();
- }
+ virtual ~Event() {
+ Unsubscribe();
+ }
- const std::string& GetObjectPath() const { return object_path_; }
+ const std::string& GetObjectPath() const { return object_path_; }
- const std::string& GetInterfaceName() const { return interface_name_; }
+ const std::string& GetInterfaceName() const { return interface_name_; }
- const std::string& GetSignalName() const { return signal_name_; }
+ const std::string& GetSignalName() const { return signal_name_; }
- virtual void Invoke(GVariant* parameters) {}
+ virtual void Invoke(GVariant* parameters) {}
- T GetCallback() const { return cb_; }
+ T GetCallback() const { return cb_; }
- void* GetUserData() const { return user_data_; }
+ void* GetUserData() const { return user_data_; }
- bool Subscribe() {
- if (source_ != 0)
- return true;
+ bool Subscribe() {
+ if (source_ != 0)
+ return true;
- GError* err = nullptr;
- conn_ = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &err);
- if (conn_ == nullptr) {
- _E("g_bus_get_sync() is failed. error(%s)", err ? err->message : "");
- g_clear_error(&err);
- return false;
- }
+ GError* err = nullptr;
+ conn_ = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &err);
+ if (conn_ == nullptr) {
+ _E("g_bus_get_sync() is failed. error(%s)", err ? err->message : "");
+ g_clear_error(&err);
+ return false;
+ }
- source_ = g_dbus_connection_signal_subscribe(conn_, nullptr,
- interface_name_.c_str(), signal_name_.c_str(), object_path_.c_str(),
+ source_ = g_dbus_connection_signal_subscribe(conn_, nullptr,
+ interface_name_.c_str(), signal_name_.c_str(), object_path_.c_str(),
nullptr, G_DBUS_SIGNAL_FLAGS_NONE, DBusSignalCb, this, nullptr);
- if (source_ == 0) {
- _E("g_dbus_connection_signal_subscribe() is failed");
- g_object_unref(conn_);
- conn_ = nullptr;
- return false;
- }
+ if (source_ == 0) {
+ _E("g_dbus_connection_signal_subscribe() is failed");
+ g_object_unref(conn_);
+ conn_ = nullptr;
+ return false;
+ }
- return true;
- }
+ return true;
+ }
private:
void Unsubscribe() {
extern "C" API int aul_listen_booting_done_signal(
aul_booting_done_event_cb callback, void* user_data) {
- _W("DEPRECATION WARNING: %s() is deprecated and will be remove from next release.", __FUNCTION__);
+ _W("DEPRECATION WARNING: %s() is deprecated "
+ "and will be remove from next release.", __FUNCTION__);
if (!context.BootingDoneEventSubscribe(callback, user_data))
return AUL_R_ERROR;
extern "C" API int aul_listen_cooldown_signal(aul_cooldown_event_cb callback,
void *user_data) {
- _W("DEPRECATION WARNING: %s() is deprecated and will be remove from next release.", __FUNCTION__);
+ _W("DEPRECATION WARNING: %s() is deprecated "
+ "and will be remove from next release.", __FUNCTION__);
if (!context.CooldownEventSubscribe(callback, user_data))
return AUL_R_ERROR;
class AliasInfo {
public:
- AliasInfo(std::string alias_appid)
+ explicit AliasInfo(std::string alias_appid)
: alias_appid_(std::move(alias_appid)) {
}
int ret = AppRequest(APP_GET_MP_SOCKET_PAIR)
.SendCmdOnly(AUL_SOCK_ASYNC);
if (ret > 0) {
- int fds[2] = {0,};
+ int fds[2] = {0, };
ret = aul_sock_recv_reply_sock_fd(ret, &fds, 2);
if (ret == 0) {
fd[0] = fds[0];
}
TEST_F(AppControlTest, app_control_resolution_compose) {
- bool ret= Compare(APP_CONTROL_OPERATION_COMPOSE, "", "");
+ bool ret = Compare(APP_CONTROL_OPERATION_COMPOSE, "", "");
EXPECT_EQ(ret, true);
}
TEST_F(AppControlTest, app_control_resolution_compose_sms) {
- bool ret= Compare(APP_CONTROL_OPERATION_COMPOSE,
+ bool ret = Compare(APP_CONTROL_OPERATION_COMPOSE,
"sms:+19725551212?body=hello%20there", "");
EXPECT_EQ(ret, true);
}
TEST_F(AppControlTest, app_control_resolution_compose_mmsto) {
- bool ret= Compare(APP_CONTROL_OPERATION_COMPOSE,
+ bool ret = Compare(APP_CONTROL_OPERATION_COMPOSE,
"mmsto:addr1%2C%20addr2", "");
EXPECT_EQ(ret, true);
}
}
TEST_F(AppControlTest, app_control_resolution_setting_messages) {
- bool ret= Compare(APP_CONTROL_OPERATION_SETTING_MESSAGES,
+ bool ret = Compare(APP_CONTROL_OPERATION_SETTING_MESSAGES,
"", "");
EXPECT_EQ(ret, true);
}
}
TEST_F(AppControlTest, app_control_resolution_share_text) {
- bool ret= Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
+ bool ret = Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
"", "");
EXPECT_EQ(ret, true);
}
TEST_F(AppControlTest, app_control_resolution_share_text_sms) {
- bool ret= Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
+ bool ret = Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
"sms:+19725551212?body=hello%20there", "");
EXPECT_EQ(ret, true);
}
TEST_F(AppControlTest, app_control_resolution_share_text_mmsto) {
- bool ret= Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
+ bool ret = Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
"mmsto:addr1%2C%20addr2", "");
EXPECT_EQ(ret, true);
}