[Content] Removed deprecated storageType API usage 66/284466/1 accepted/tizen/unified/20221121.163714
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Thu, 17 Nov 2022 11:30:47 +0000 (12:30 +0100)
committerPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Thu, 17 Nov 2022 11:30:54 +0000 (12:30 +0100)
This commit removes all platform code related to storageType and
provides only a hardcoded 'storageType_NOT_SUPPORTED' value for easier
analysis of possible issues after removal.

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-289

[Verification]

2 failing content TCTs which uses removed API, need to be
removedi/modified not to check storage type:
error:
invalid enum value value "storageType_NOT_SUPPORTED" not in array ["INTERNAL", "EXTERNAL"]
- ContentChangeCallback_oncontentdiradded
- ContentChangeCallback_oncontentdirupdated

1 deprecated TCT need to be removed:
- ContentDirectory_storageType_attribute

Change-Id: I0cf883097ce47c342949346a3fffca7f525faee8

src/content/content_manager.cc
src/content/js/datatypes.js

index f61279b..fafc240 100644 (file)
@@ -349,8 +349,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
 void ContentDirToJson(media_folder_h folder, picojson::object& o) {
   ScopeLogger();
   int ret;
-  char* tmpStr = NULL;
-  media_content_storage_e storage_type;
+  char *tmpStr = NULL;
 
   // id
   ret = media_folder_get_folder_id(folder, &tmpStr);
@@ -385,21 +384,6 @@ void ContentDirToJson(media_folder_h folder, picojson::object& o) {
     }
   }
 
-  // storageType
-  ret = media_folder_get_storage_type(folder, &storage_type);
-  // TODO: The function media_folder_get_storage_type is marked as deprecated since 5.0.
-  // As an alternative, it is recommended to use storage_get_type_dev function. However,
-  // this function does not work with internal storages. The media_folder_get_storage_type
-  // function should be kept or moved to internal header by Native API.
-  if (ret == MEDIA_CONTENT_ERROR_NONE) {
-    if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) {
-      o["storageType"] = picojson::value(std::string("INTERNAL"));
-    } else {
-      LoggerD("storageType = %d, assuming EXTERNAL as storage type", storage_type);
-      o["storageType"] = picojson::value(std::string("EXTERNAL"));
-    }
-  }
-
   // modifiedDate
   struct stat stat_res;
   if (stat(folder_path.c_str(), &stat_res) == 0) {
@@ -476,7 +460,6 @@ static void FolderToJson(media_folder_h folder, picojson::object* out) {
   char* id = NULL;
   char* path = NULL;
   time_t date;
-  media_content_storage_e storageType;
 
   int ret;
 
@@ -510,27 +493,10 @@ static void FolderToJson(media_folder_h folder, picojson::object* out) {
   }
   date = stat_res.st_mtime;
 
-  ret = media_folder_get_storage_type(folder, &storageType);
-  // TODO: The function media_folder_get_storage_type is marked as deprecated since 5.0.
-  // As an alternative, it is recommended to use storage_get_type_dev function. However,
-  // this function does not work with internal storages. The media_folder_get_storage_type
-  // function should be kept or moved to internal header by Native API.
-  if (ret != MEDIA_CONTENT_ERROR_NONE) {
-    LogAndReportError(ContentManager::convertError(ret), out,
-                      ("Failed: media_folder_get_storage_type"));
-    return;
-  }
-
   (*out)["id"] = picojson::value(std::string(id));
   (*out)["directoryURI"] = picojson::value(std::string(path));
   (*out)["title"] = picojson::value(std::string(name));
 
-  if (storageType == MEDIA_CONTENT_STORAGE_INTERNAL) {
-    (*out)["storageType"] = picojson::value(std::string("INTERNAL"));
-  } else if (storageType == MEDIA_CONTENT_STORAGE_EXTERNAL) {
-    (*out)["storageType"] = picojson::value(std::string("EXTERNAL"));
-  }
-
   (*out)["modifiedDate"] = picojson::value(static_cast<double>(date));
 }
 
index 2efea2b..7898250 100755 (executable)
  *    limitations under the License.
  */
 
-var ContentDirectoryStorageType = {
-    INTERNAL: 'INTERNAL',
-    EXTERNAL: 'EXTERNAL'
-};
-
 var ContentType = {
     IMAGE: 'IMAGE',
     VIDEO: 'VIDEO',
@@ -46,7 +41,6 @@ function ContentDirectory(data) {
     var id;
     var directoryURI;
     var title;
-    var storageType;
     var modifiedDate = null;
 
     Object.defineProperties(this, {
@@ -86,16 +80,9 @@ function ContentDirectory(data) {
         storageType: {
             get: function() {
                 utils_.printDeprecationWarningFor('ContentDirectoryStorageType');
-                return storageType;
+                return "storageType_NOT_SUPPORTED";
             },
-            set: function(v) {
-                if (edit_.isAllowed) {
-                    storageType = converter_.toEnum(
-                        v,
-                        Object.keys(ContentDirectoryStorageType),
-                        false
-                    );
-                }
+            set: function (v) {
             },
             enumerable: true
         },