Add Package.InstalledTime property
authors89.jang <s89.jang@samsung.com>
Thu, 30 Mar 2017 08:10:27 +0000 (17:10 +0900)
committers89.jang <s89.jang@samsung.com>
Thu, 30 Mar 2017 08:12:44 +0000 (17:12 +0900)
Change-Id: Ia810e32735bc29babbadb2751c5951ef632b04c2
Signed-off-by: s89.jang <s89.jang@samsung.com>
src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs
src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs

index 2d86f5d..67de930 100644 (file)
@@ -106,6 +106,9 @@ internal static partial class Interop
         [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_accessible")]
         internal static extern ErrorCode PackageInfoIsAccessible(IntPtr handle, out bool accessible);
 
+        [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_installed_time")]
+        internal static extern ErrorCode PackageInfoGetInstalledTime(IntPtr handle, out int installedTime);
+
         [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_compare_package_cert_info")]
         internal static extern ErrorCode PackageCompareCertInfo(string lhsPackageId, string rhsPackageId, out CertCompareResultType result);
     }
index 3326c5a..ae60eed 100644 (file)
@@ -42,6 +42,7 @@ namespace Tizen.Applications
         private bool _isAccessible;
         private IReadOnlyDictionary<CertificateType, PackageCertificate> _certificates;
         private List<string> _privileges;
+        private int _installedTime;
 
         private Package(string pkgId)
         {
@@ -119,6 +120,11 @@ namespace Tizen.Applications
         public IEnumerable<string> Privileges { get { return _privileges; } }
 
         /// <summary>
+        /// Installed time of the package.
+        /// </summary>
+        public int InstalledTime { get { return _installedTime; } }
+
+        /// <summary>
         /// Retrieves all application IDs of this package.
         /// </summary>
         /// <returns>Returns a dictionary containing all application info for given application type.</returns>
@@ -271,6 +277,11 @@ namespace Tizen.Applications
             {
                 Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is accessible or not");
             }
+            Interop.Package.PackageInfoGetInstalledTime(handle, out package._installedTime);
+            if (err != Interop.PackageManager.ErrorCode.None)
+            {
+                Log.Warn(LogTag, "Failed to get installed time of " + pkgId);
+            }
 
             package._certificates = PackageCertificate.GetPackageCertificates(handle);
             package._privileges = GetPackagePrivilegeInformation(handle);