From: kdk3776 <55476509+kdk3776@users.noreply.github.com> Date: Tue, 4 Mar 2025 23:46:55 +0000 (+0900) Subject: [PackageManager] add IsUpdated property to Package Class (#6711) X-Git-Tag: submit/tizen_9.0/20250305.150918~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b03bbe71c7d8f89127cb9422d0a61f0db5b2676;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [PackageManager] add IsUpdated property to Package Class (#6711) * [PackageManager] add Isupdated * Fix build error --------- Signed-off-by: Sangyoon Jang Co-authored-by: dongkwan Co-authored-by: Sangyoon Jang Co-authored-by: jeremy-jang <35089715+jeremy-jang@users.noreply.github.com> --- diff --git a/src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs b/src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs index 2e5ace5ba..7f845742b 100644 --- a/src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs +++ b/src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs @@ -109,6 +109,9 @@ internal static partial class Interop [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_preload_package")] internal static extern ErrorCode PackageInfoIsPreloadPackage(IntPtr handle, out bool preload); + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_update_package")] + internal static extern ErrorCode PackageInfoIsUpdatePackage(IntPtr handle, out bool update); + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_accessible")] internal static extern ErrorCode PackageInfoIsAccessible(IntPtr handle, out bool accessible); diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs index 5de2b1bca..21cba72b8 100644 --- a/src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs @@ -16,6 +16,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Runtime.InteropServices; using System.Threading.Tasks; @@ -41,6 +42,7 @@ namespace Tizen.Applications private bool _isSystemPackage; private bool _isRemovable; private bool _isPreloaded; + private bool _isUpdated; private bool _isAccessible; private Lazy> _certificates; private List _privileges; @@ -125,6 +127,13 @@ namespace Tizen.Applications /// 3 public bool IsPreloaded { get { return _isPreloaded; } } + /// + /// Checks whether the package is updated. + /// + /// 12 + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsUpdated { get { return _isUpdated; } } + /// /// Checks whether the current package is accessible. /// @@ -349,29 +358,34 @@ namespace Tizen.Applications { Log.Warn(LogTag, "Failed to get installed storage type of " + pkgId); } - Interop.Package.PackageInfoIsSystemPackage(handle, out package._isSystemPackage); + err = Interop.Package.PackageInfoIsSystemPackage(handle, out package._isSystemPackage); if (err != Interop.PackageManager.ErrorCode.None) { Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is system package or not"); } - Interop.Package.PackageInfoIsRemovablePackage(handle, out package._isRemovable); + err = Interop.Package.PackageInfoIsRemovablePackage(handle, out package._isRemovable); if (err != Interop.PackageManager.ErrorCode.None) { Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is removable or not"); } - Interop.Package.PackageInfoIsPreloadPackage(handle, out package._isPreloaded); + err = Interop.Package.PackageInfoIsPreloadPackage(handle, out package._isPreloaded); if (err != Interop.PackageManager.ErrorCode.None) { Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is preloaded or not"); } - Interop.Package.PackageInfoIsAccessible(handle, out package._isAccessible); + err = Interop.Package.PackageInfoIsUpdatePackage(handle, out package._isUpdated); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is updated or not"); + } + err = Interop.Package.PackageInfoIsAccessible(handle, out package._isAccessible); if (err != Interop.PackageManager.ErrorCode.None) { Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is accessible or not"); } try { - Interop.Package.PackageInfoGetInstalledTime(handle, out package._installedTime); + err = Interop.Package.PackageInfoGetInstalledTime(handle, out package._installedTime); if (err != Interop.PackageManager.ErrorCode.None) { Log.Warn(LogTag, "Failed to get installed time of " + pkgId);