#include "theme/utils/logging.h"
#include "theme/loader/theme_info.h"
#include "theme_plugin/theme_parser.h"
+#include "theme_provider/theme_info_proxy.h"
using ttm::loader::ThemeInfo;
using ttm::plugin::ThemeParser;
if (AutosetData::GetInst().autoset_id.empty())
return 0;
ttm::dbus::RequestBroker& broker = ttm::dbus::RequestBroker::GetInst();
- if (!broker.GetConnection())
- return 0;
+ if (!broker.GetConnection()) {
+ // in case of root, this installation processed during image creation or
+ // platform update.
+ // TODO(jeremy.jang): Fix to not invoke broker API directly
+ if (getuid() == 0) {
+ ttm::provider::ThemeInfoProxy proxy("/opt/dbspace/.tizen_theme.db");
+ if (!proxy.SetCurrentTheme(AutosetData::GetInst().autoset_id)) {
+ LOG(ERROR) << "Failed to force set current theme id";
+ return -1;
+ } else {
+ return 0;
+ }
+ } else {
+ LOG(ERROR) << "Cannot connect with theme-provider";
+ return 0;
+ }
+ }
tizen_base::Bundle b;
b.Add(ttm::dbus::kCmdDataKey, AutosetData::GetInst().autoset_id);
tizen_base::Bundle reply = broker.SendData(ttm::dbus::Command::SET_ID, b);