From: Rafal Walczyna Date: Wed, 2 Sep 2020 11:36:33 +0000 (+0200) Subject: [HAM] Deprecate gesture and activity methods X-Git-Tag: submit/tizen/20200909.074050~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=afa1e133870342d1e30238ad137d88ce66863bce;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [HAM] Deprecate gesture and activity methods Native function are deprecated. [ACR] TWDAPI-268 Change-Id: I4146362481542c47879413abc59aa2850eb17095 Signed-off-by: Rafal Walczyna --- diff --git a/src/humanactivitymonitor/gesture_manager.cc b/src/humanactivitymonitor/gesture_manager.cc index 1168f4bc..a68076c7 100644 --- a/src/humanactivitymonitor/gesture_manager.cc +++ b/src/humanactivitymonitor/gesture_manager.cc @@ -186,11 +186,13 @@ GestureManager::~GestureManager() { int ret = GESTURE_ERROR_NONE; for (auto& it : m_recognition_default_map) { + // gesture_stop_recognition is deprecated since 6.0 ret = gesture_stop_recognition(it.second); if (GESTURE_ERROR_NONE != ret) { LoggerE("gesture_stop_recognition() failed"); } + // gesture_release is deprecated since 6.0 ret = gesture_release(it.second); if (GESTURE_ERROR_NONE != ret) { LoggerE("gesture_release() failed"); @@ -198,11 +200,13 @@ GestureManager::~GestureManager() { } for (auto& it : m_recognition_always_on_map) { + // gesture_stop_recognition is deprecated since 6.0 ret = gesture_stop_recognition(it.second); if (GESTURE_ERROR_NONE != ret) { LoggerE("gesture_stop_recognition() failed"); } + // gesture_release is deprecated since 6.0 ret = gesture_release(it.second); if (GESTURE_ERROR_NONE != ret) { LoggerE("gesture_release() failed"); @@ -222,6 +226,7 @@ PlatformResult GestureManager::IsSupported(const std::string& type, bool* is_sup return result; } + // gesture_is_supported is deprecated since 6.0 int ret = gesture_is_supported(type_e, is_supported); if (GESTURE_ERROR_NONE != ret) { return LogAndCreateResult( @@ -236,6 +241,7 @@ gesture_event_e GestureManager::GetGestureEvent(const gesture_data_h data) { ScopeLogger(); gesture_event_e event = GESTURE_EVENT_NONE; + // gesture_get_event is deprecated since 6.0 int ret = gesture_get_event(data, &event); if (GESTURE_ERROR_NONE != ret) { LoggerE("gesture_get_event() failed, error %d (%s)", ret, get_error_message(ret)); @@ -250,6 +256,7 @@ void GestureManager::FillTiltData(const gesture_data_h data, picojson::object* o int x = 0; int y = 0; + // gesture_get_tilt is deprecated since 6.0 int ret = gesture_get_tilt(data, &x, &y); if (GESTURE_ERROR_NONE != ret) { LoggerE("gesture_get_tilt() failed, error %d (%s)", ret, get_error_message(ret)); @@ -319,6 +326,7 @@ PlatformResult GestureManager::AddListener(gesture_type_e type, gesture_option_e gesture_h handle = nullptr; + // gesture_create is deprecated since 6.0 int ret = gesture_create(&handle); if (GESTURE_ERROR_NONE != ret) { return LogAndCreateResult( @@ -326,6 +334,7 @@ PlatformResult GestureManager::AddListener(gesture_type_e type, gesture_option_e ("Creating handle failed, error: %d (%s)", ret, get_error_message(ret))); } + // gesture_start_recognition is deprecated since 6.0 ret = gesture_start_recognition(handle, type, option, callback, this); if (GESTURE_ERROR_NONE != ret) { gesture_release(handle); @@ -386,6 +395,7 @@ PlatformResult GestureManager::RemoveGestureRecognitionListener(const std::strin } if (handle) { + // gesture_stop_recognition is deprecated since 6.0 int ret = gesture_stop_recognition(handle); if (GESTURE_ERROR_NONE != ret) { return LogAndCreateResult( diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js index b849792d..7915248d 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -380,8 +380,7 @@ HumanActivityMonitorManager.prototype.start = function(type, changedCallback) { if (HumanActivityType.WRIST_UP === args.type) { utils_.warn( 'DEPRECATION WARNING: HumanActivityType.WRIST_UP is deprecated since ' + - 'Tizen 4.0. Use GestureType and addGestureRecognitionListener to ' + - 'monitor WRIST_UP gesture' + 'Tizen 4.0.' ); } @@ -546,6 +545,9 @@ HumanActivityMonitorManager.prototype.unsetAccumulativePedometerListener = funct }; HumanActivityMonitorManager.prototype.addActivityRecognitionListener = function() { + utils_.printDeprecationWarningFor( + 'HumanActivityMonitorManager.addActivityRecognitionListener()' + ); var args = validator_.validateArgs(arguments, [ { name: 'type', type: types_.ENUM, values: Object.keys(ActivityRecognitionType) }, { name: 'listener', type: types_.FUNCTION }, @@ -567,6 +569,9 @@ HumanActivityMonitorManager.prototype.addActivityRecognitionListener = function( }; HumanActivityMonitorManager.prototype.removeActivityRecognitionListener = function() { + utils_.printDeprecationWarningFor( + 'HumanActivityMonitorManager.removeActivityRecognitionListener()' + ); var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG }, { name: 'errorCallback', type: types_.FUNCTION, optional: true, nullable: true } @@ -698,6 +703,7 @@ HumanActivityMonitorManager.prototype.readRecorderData = function() { }; HumanActivityMonitorManager.prototype.isGestureSupported = function() { + utils_.printDeprecationWarningFor('HumanActivityMonitorManager.isGestureSupported()'); var args = validator_.validateArgs(arguments, [ { name: 'type', @@ -831,6 +837,9 @@ var gestureRecognitionListener = new GestureListenerManager( ); HumanActivityMonitorManager.prototype.addGestureRecognitionListener = function() { + utils_.printDeprecationWarningFor( + 'HumanActivityMonitorManager.addGestureRecognitionListener()' + ); var args = validator_.validateArgs(arguments, [ { name: 'type', @@ -864,6 +873,9 @@ HumanActivityMonitorManager.prototype.addGestureRecognitionListener = function() }; HumanActivityMonitorManager.prototype.removeGestureRecognitionListener = function() { + utils_.printDeprecationWarningFor( + 'HumanActivityMonitorManager.removeGestureRecognitionListener()' + ); var args = validator_.validateArgs(arguments, [ { name: 'watchId', diff --git a/src/humanactivitymonitor/humanactivitymonitor_instance.cc b/src/humanactivitymonitor/humanactivitymonitor_instance.cc index c1c6cc84..5baa8c73 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_instance.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_instance.cc @@ -42,6 +42,7 @@ const int DEFAULT_RETENTION_PERIOD = 1; // 1 hour default value for retention p using common::PlatformResult; using common::ErrorCode; using common::TaskQueue; +using common::tools::PrintDeprecationWarningFor; HumanActivityMonitorInstance::HumanActivityMonitorInstance() : gesture_manager_() { ScopeLogger(); @@ -220,6 +221,8 @@ void HumanActivityMonitorInstance::HumanActivityMonitorManagerStop(const picojso void HumanActivityMonitorInstance::HumanActivityMonitorManagerAddActivityRecognitionListener( const picojson::value& args, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("HumanActivityMonitorManager.addActivityRecognitionListener()"); + CHECK_PRIVILEGE_ACCESS(kPrivilegeHealthInfo, &out); CHECK_EXIST(args, "type", out) @@ -260,6 +263,8 @@ void HumanActivityMonitorInstance::HumanActivityMonitorManagerAddActivityRecogni void HumanActivityMonitorInstance::HumanActivityMonitorManagerRemoveActivityRecognitionListener( const picojson::value& args, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("HumanActivityMonitorManager.removeActivityRecognitionListener()"); + CHECK_PRIVILEGE_ACCESS(kPrivilegeHealthInfo, &out); CHECK_EXIST(args, "watchId", out) @@ -395,6 +400,7 @@ void HumanActivityMonitorInstance::HumanActivityMonitorManagerReadRecorderData( void HumanActivityMonitorInstance::GestureManagerIsGestureSupported(const picojson::value& args, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("HumanActivityMonitorManager.isGestureSupported()"); CHECK_EXIST(args, "type", out) const auto& type = args.get("type").get(); @@ -411,6 +417,7 @@ void HumanActivityMonitorInstance::GestureManagerIsGestureSupported(const picojs void HumanActivityMonitorInstance::GestureManagerAddGestureRecognitionListener( const picojson::value& args, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("HumanActivityMonitorManager.addGestureRecognitionListener()"); CHECK_EXIST(args, "type", out) CHECK_EXIST(args, "alwaysOn", out) @@ -437,6 +444,7 @@ void HumanActivityMonitorInstance::GestureManagerAddGestureRecognitionListener( void HumanActivityMonitorInstance::GestureManagerRemoveGestureRecognitionListener( const picojson::value& args, picojson::object& out) { ScopeLogger(); + PrintDeprecationWarningFor("HumanActivityMonitorManager.removeGestureRecognitionListener()"); CHECK_EXIST(args, "type", out) CHECK_EXIST(args, "alwaysOn", out) diff --git a/src/humanactivitymonitor/humanactivitymonitor_manager.cc b/src/humanactivitymonitor/humanactivitymonitor_manager.cc index 00628e99..a9957edb 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_manager.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_manager.cc @@ -445,6 +445,7 @@ class HumanActivityMonitorManager::Monitor::GestureMonitor bool supported = false; + // gesture_is_supported is deprecated since 6.0 int ret = gesture_is_supported(GESTURE_WRIST_UP, &supported); if (GESTURE_ERROR_NONE != ret) { if (ret == GESTURE_ERROR_NOT_SUPPORTED) { @@ -466,6 +467,7 @@ class HumanActivityMonitorManager::Monitor::GestureMonitor ScopeLogger("type %s", type().c_str()); if (!handle_) { + // gesture_create is not supported since 6.0 int ret = gesture_create(&handle_); if (GESTURE_ERROR_NONE != ret) { return LogAndCreateResult( @@ -473,6 +475,7 @@ class HumanActivityMonitorManager::Monitor::GestureMonitor ("Failed to create WRIST_UP handle, error: %d (%s)", ret, get_error_message(ret))); } + // gesture_start_recognition is not supported since 6.0 ret = gesture_start_recognition(handle_, GESTURE_WRIST_UP, GESTURE_OPTION_DEFAULT, OnWristUpEvent, this); if (GESTURE_ERROR_NONE != ret) { @@ -489,11 +492,13 @@ class HumanActivityMonitorManager::Monitor::GestureMonitor ScopeLogger("type %s", type().c_str()); if (handle_) { + // gesture_stop_recognition is deprecated since 6.0 int ret = gesture_stop_recognition(handle_); if (GESTURE_ERROR_NONE != ret) { LoggerE("Failed to stop WRIST_UP detection, error: %d", ret); } + // gesture_release is deprecated since 6.0 ret = gesture_release(handle_); if (GESTURE_ERROR_NONE != ret) { LoggerE("Failed to release WRIST_UP handle, error: %d", ret); @@ -1234,6 +1239,7 @@ class HumanActivityMonitorManager::ActivityRecognition { } activity_h handle = nullptr; + // activity_create is deprecated since 6.0 int ret = activity_create(&handle); if (ACTIVITY_ERROR_NONE != ret) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Failed to create activity", @@ -1276,7 +1282,9 @@ class HumanActivityMonitorManager::ActivityRecognition { ~ActivityData() { if (handle) { + // activity_stop_recognition is deprecated since 6.0 activity_stop_recognition(handle); + // activity_release is deprecated since 6.0 activity_release(handle); } } @@ -1314,6 +1322,7 @@ class HumanActivityMonitorManager::ActivityRecognition { activity_accuracy_e accuracy = ACTIVITY_ACCURACY_MID; + // activity_get_accuracy is deprecated since 6.0 int ret = activity_get_accuracy(data, &accuracy); if (ret != ACTIVITY_ERROR_NONE) { LogAndReportError(PlatformResult(ErrorCode::ABORT_ERR, "System operation has failed"), &obj, @@ -1342,6 +1351,7 @@ class HumanActivityMonitorManager::ActivityRecognition { ScopeLogger(); bool supported = false; + // activity_is_supported is deprecated since 6.0 int ret = activity_is_supported(type, &supported); if (ret == ACTIVITY_ERROR_NOT_SUPPORTED || !supported) {