#include "notification-ex/group_item.h"
#include "notification-ex/group_item_implementation.h"
#include "notification-ex/factory_manager.h"
+#include "notification-ex/ex_util.h"
#include "notification-ex/exception.h"
#ifdef LOG_TAG
GroupItem::Impl::Impl(GroupItem* parent)
: parent_(parent) {
LOGI("GroupItem created");
+ char* name;
+ int ret = app_get_name(&name);
+ if (ret != APP_ERROR_NONE) {
+ app_label_ = util::GetAppId();
+ } else {
+ app_label_ = string(name);
+ free(name);
+ }
}
GroupItem::~GroupItem() {
b = AbstractItem::Serialize();
b.Add(GROUP_DIRECTION_KEY, impl_->is_vertical_ ?
GROUP_DIRECTION_VERTICAL : GROUP_DIRECTION_HORIZONTAL);
- if (!impl_->app_label_.empty())
- b.Add(GROUP_APP_LABEL_KEY, impl_->app_label_);
+ b.Add(GROUP_APP_LABEL_KEY, impl_->app_label_);
if (impl_->children_list_.size() == 0)
return b;
}
string GroupItem::GetAppLabel() {
- if (impl_->app_label_.empty()) {
- char* name;
- int ret = app_get_name(&name);
- if (ret != APP_ERROR_NONE)
- THROW(ERROR_IO_ERROR);
- impl_->app_label_ = string(name);
- free(name);
- }
return impl_->app_label_;
}