Add new content mount path for AoT TV 79/318779/2
authorJosh Merlin <josh.merlin@samsung.com>
Thu, 23 Jan 2025 12:04:00 +0000 (20:04 +0800)
committerJosh Aleczi Merlin <josh.merlin@samsung.com>
Fri, 24 Jan 2025 05:11:56 +0000 (05:11 +0000)
Change-Id: I9efda7737060f1a9d225c83466583db3a43eba58

lib/include/media-util-user.h
lib/media-util-user.c

index f6c17487eee624897f40d0b3bc54caeb5aa42aba..035a6eb65cd2c62595ccc0e979d85902896dd4dd 100644 (file)
@@ -29,6 +29,9 @@ extern "C" {
 #endif
 
 int ms_user_get_internal_root_path(uid_t uid, char **path);
+#ifdef _USE_TVPD_MODE
+int ms_user_get_aot_content_path(uid_t uid, char **path);
+#endif
 bool ms_user_is_valid_path(uid_t uid, const char *path);
 bool ms_user_thumb_support(uid_t uid, const char *path);
 int ms_user_get_root_thumb_store_path(uid_t uid, char **path);
index b1c34749b786582821a5e9cc262619816b89b2f4..917cf638a5d548e961fb936709b2e285bea73124 100644 (file)
@@ -34,7 +34,10 @@ typedef enum {
        INTERNAL_ROOT,
        THUMB_ROOT,
        WORDBOOK_DB,
-       MEDIA_SHARED
+       MEDIA_SHARED,
+#ifdef _USE_TVPD_MODE
+       AOT_CONTENT,
+#endif
 } ms_user_path_type_e;
 
 static int __ms_user_get_path(ms_user_path_type_e type, uid_t uid, char **path)
@@ -78,6 +81,11 @@ static int __ms_user_get_path(ms_user_path_type_e type, uid_t uid, char **path)
        case MEDIA_SHARED:
                result = tzplatform_context_getenv(context[idx], TZ_USER_MEDIASHARED);
                break;
+#endif
+#ifdef _USE_TVPD_MODE
+       case AOT_CONTENT:
+               result = tzplatform_context_mkpath(context[idx], TZ_USER_SHARE, "waydroid/data/aot_share/content");
+               break;
 #endif
        default:
                ret = MS_MEDIA_ERR_INTERNAL;
@@ -112,6 +120,26 @@ static bool __ms_user_is_internal(uid_t uid, const char *path)
        return g_str_has_prefix(path, internal_path);
 }
 
+#ifdef _USE_TVPD_MODE
+int ms_user_get_aot_content_path(uid_t uid, char **path)
+{
+       if (uid != getuid())
+               return __ms_user_get_path(AOT_CONTENT, uid, path);
+
+       *path = g_strdup(tzplatform_mkpath(TZ_USER_SHARE, "waydroid/data/aot_share/content"));
+
+       return MS_MEDIA_ERR_NONE;
+}
+
+static bool __ms_user_is_aot_content(uid_t uid, const char *path)
+{
+       g_autofree gchar *aot_content_path = NULL;
+       ms_user_get_aot_content_path(uid, &aot_content_path);
+
+       return g_str_has_prefix(path, aot_content_path);
+}
+#endif
+
 bool ms_user_is_valid_path(uid_t uid, const char *path)
 {
        if (__ms_user_is_internal(uid, path))
@@ -120,6 +148,11 @@ bool ms_user_is_valid_path(uid_t uid, const char *path)
        if (g_str_has_prefix(path, tzplatform_getenv(TZ_SYS_STORAGE)))
                return true;
 
+#ifdef _USE_TVPD_MODE
+       if (__ms_user_is_aot_content(uid, path))
+               return true;
+#endif
+
        MSAPI_DBG_ERR("Invalid path[%s]", path);
 
        return false;