provider_id TEXT NOT NULL,
support_type INTEGER DEFAULT 0,
default_data TEXT NOT NULL,
+ UNIQUE (provider_id, support_type),
FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS provider_localized_info (
'org.tizen.gmock_comp_provider5/test',
2,
'test'
-);
\ No newline at end of file
+);
+
+INSERT INTO complication_provider (
+ pkgid, appid, provider_id, trusted, period) VALUES (
+ 'org.tizen.gmock_comp_provider6',
+ 'org.tizen.gmock_comp_provider6',
+ 'org.tizen.gmock_comp_provider6/test',
+ 1,
+ 1
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider6/test',
+ 2,
+ 'test'
+);
+
+INSERT INTO provider_support_events (
+ provider_id, support_events) VALUES (
+ 'org.tizen.gmock_comp_provider6/test',
+ 6
+);
ret = watchface_complication_provider_foreach_info(
nullptr, __all_provider_foreach_cb, &count);
- EXPECT_EQ(5, count);
+ EXPECT_EQ(6, count);
EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
ret = watchface_complication_provider_foreach_info(
EXPECT_EQ(cur_type, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT);
}
+TEST_F(CWC, watchface_complication_get_current_provider_events)
+{
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider6/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP|WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP,
+ &complication_);
+
+ int cur_types;
+ ret = watchface_complication_get_current_provider_events(complication_,
+ &cur_types);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(cur_types,
+ WATCHFACE_COMPLICATION_EVENT_TAP|WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP);
+}
+
void _complication_updated_cb(
int complication_id,
const char* provider_id,
return static_cast<int>(impl_->cur_type_);
}
+int Complication::GetCurProviderEvents() const {
+ return DBManager::GetRequiredSupportEvents(impl_->cur_provider_id_);
+}
+
const std::string& Complication::GetLabel() const {
return impl_->name_;
}
std::string GetProviderId(const tizen_base::Bundle& candidate_data) const;
int GetProviderType(const tizen_base::Bundle& candidate_data) const;
int GetCurType() const;
+ int GetCurProviderEvents() const;
int TouchLaunch(watchface_complication_event_type_e event_type);
int ApplyAllowedList(
std::list<std::unique_ptr<ProviderInfo>> allowed_list);
int watchface_complication_priority_list_apply(complication_h handle,
complication_priority_list_h list_handle);
int watchface_complication_priority_list_clear(complication_h handle);
+int watchface_complication_get_current_provider_events(
+ complication_h handle, int *current_provider_events);
#ifdef __cplusplus
}
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
+extern "C" EXPORT_API int watchface_complication_get_current_provider_events(
+ complication_h handle, int *current_provider_events) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (handle == nullptr || current_provider_events == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+
+ auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
+ auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
+ if (ptr.get()->GetCurProviderId().empty())
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+
+ int ret = ptr.get()->GetCurProviderEvents();
+ if (ret < 0)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ *current_provider_events = ret;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
extern "C" EXPORT_API int watchface_complication_data_get_type(
const bundle* data, watchface_complication_type_e* type) {
char* type_str = nullptr;