Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PackageManager] add IsUpdated property to Package Class #6669

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ internal enum CertificateType
[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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

Expand All @@ -41,6 +42,7 @@ public class Package
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;
Expand Down Expand Up @@ -125,6 +127,13 @@ private Package(string pkgId)
/// <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>
Expand Down Expand Up @@ -349,29 +358,34 @@ internal static Package CreatePackage(IntPtr handle, string pkgId)
{
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");
}
Copy link
Contributor

@hjhun hjhun Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value should be set to the err as below:

err = Interop.Package.PackageInfoIsUpdatePackage(handle, out package._isUpdated);

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);
Expand Down
Loading