[PackageManager] add IsUpdated property to Package Class (#6711)
authorkdk3776 <55476509+kdk3776@users.noreply.github.com>
Tue, 4 Mar 2025 23:46:55 +0000 (08:46 +0900)
committerGitHub <noreply@github.com>
Tue, 4 Mar 2025 23:46:55 +0000 (08:46 +0900)
* [PackageManager] add Isupdated

* Fix build error

---------

Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
Co-authored-by: dongkwan <dk3776.kim@samsung.com>
Co-authored-by: Sangyoon Jang <jeremy.jang@samsung.com>
Co-authored-by: jeremy-jang <35089715+jeremy-jang@users.noreply.github.com>
src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs
src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs

index 2e5ace5ba63229f8b6b8bcdb6c8be043ad2bacda..7f845742be859e9b4df419c2080ace1fe856a2f4 100644 (file)
@@ -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);
 
index 5de2b1bca5ba63a945167a294c239c6b34bd66ee..21cba72b8c5e8e9df2da7714e01e205bea5f997d 100644 (file)
@@ -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<IReadOnlyDictionary<CertificateType, PackageCertificate>> _certificates;
         private List<string> _privileges;
@@ -125,6 +127,13 @@ namespace Tizen.Applications
         /// <since_tizen> 3 </since_tizen>
         public bool IsPreloaded { get { return _isPreloaded; } }
 
+        /// <summary>
+        /// Checks whether the package is updated.
+        /// </summary>
+        /// <since_tizen> 12 </since_tizen>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool IsUpdated { get { return _isUpdated; } }
+
         /// <summary>
         /// Checks whether the current package is accessible.
         /// </summary>
@@ -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);