summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjongmyeongko <jongmyeong.ko@samsung.com>2017-07-11 15:50:22 +0900
committerjongmyeongko <jongmyeong.ko@samsung.com>2017-07-21 11:24:00 +0900
commit14d52edc08429eb1590e5487ca73ff6336af227d (patch)
tree944f21c2896654f47914a2ff621c23453e21e49f
parent4870e2656f44b44df728591365e2c388ddfa3988 (diff)
downloadapplication-14d52edc08429eb1590e5487ca73ff6336af227d.tar.gz
application-14d52edc08429eb1590e5487ca73ff6336af227d.tar.bz2
application-14d52edc08429eb1590e5487ca73ff6336af227d.zip
Modify the signature of insatll API for mount installation
usage : PackageManager.Install(packagePath, InstallType.Mount); Change-Id: I936f93780167ac68b441f6b73aa11eb03c5a26c2 Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
-rwxr-xr-x[-rw-r--r--]Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs6
-rwxr-xr-xTizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs33
-rwxr-xr-x[-rw-r--r--]Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs86
3 files changed, 96 insertions, 29 deletions
diff --git a/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs b/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs
index e8fac2d..92ad54e 100644..100755
--- a/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs
+++ b/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs
@@ -186,6 +186,9 @@ internal static partial class Interop
[DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_install")]
internal static extern ErrorCode PackageManagerRequestInstall(SafePackageManagerRequestHandle requestHandle, string path, out int id);
+ [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_mount_install")]
+ internal static extern ErrorCode PackageManagerRequestMountInstall(SafePackageManagerRequestHandle requestHandle, string path, out int id);
+
[DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_uninstall")]
internal static extern ErrorCode PackageManagerRequestUninstall(SafePackageManagerRequestHandle requestHandle, string name, out int id);
@@ -216,6 +219,9 @@ internal static partial class Interop
[DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_install_with_cb")]
internal static extern ErrorCode PackageManagerRequestInstallWithCB(SafePackageManagerRequestHandle requestHandle, string path, PackageManagerRequestEventCallback callback, IntPtr userData, out int id);
+ [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_mount_install_with_cb")]
+ internal static extern ErrorCode PackageManagerRequestMountInstallWithCB(SafePackageManagerRequestHandle requestHandle, string path, PackageManagerRequestEventCallback callback, IntPtr userData, out int id);
+
[DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_uninstall_with_cb")]
internal static extern ErrorCode PackageManagerRequestUninstallWithCB(SafePackageManagerRequestHandle requestHandle, string name, PackageManagerRequestEventCallback callback, IntPtr userData, out int id);
diff --git a/Tizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs b/Tizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs
new file mode 100755
index 0000000..da643db
--- /dev/null
+++ b/Tizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Applications
+{
+ /// <summary>
+ /// Enumeration for installation mode.
+ /// </summary>
+ public enum InstallationMode
+ {
+ /// <summary>
+ /// Normal Mode.
+ /// </summary>
+ Normal,
+ /// <summary>
+ /// Mount Mode.
+ /// </summary>
+ Mount
+ }
+}
diff --git a/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs b/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs
index 6b49900..1efd51f 100644..100755
--- a/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs
+++ b/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs
@@ -55,6 +55,9 @@ namespace Tizen.Applications
private static Dictionary<int, RequestEventCallback> RequestCallbacks = new Dictionary<int, RequestEventCallback>();
private static Dictionary<int, SafePackageManagerRequestHandle> RequestHandles = new Dictionary<int, SafePackageManagerRequestHandle>();
+ private delegate Interop.PackageManager.ErrorCode InstallMethodWithCallback(SafePackageManagerRequestHandle requestHandle, string pkgPath, Interop.PackageManager.PackageManagerRequestEventCallback requestCallback, IntPtr userData, out int requestID);
+ private delegate Interop.PackageManager.ErrorCode InstallMethod(SafePackageManagerRequestHandle requestHandle, string pkgPath, out int requestID);
+
/// <summary>
/// InstallProgressChanged event. This event is occurred when a package is getting installed and the progress of the request to the package manager changes.
/// </summary>
@@ -387,124 +390,131 @@ namespace Tizen.Applications
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath)
+ public static bool Install(string packagePath, InstallationMode installMode = InstallationMode.Normal)
{
- return Install(packagePath, null, PackageType.UNKNOWN, null);
+ return Install(packagePath, null, PackageType.UNKNOWN, null, installMode);
}
/// <summary>
/// Installs package located at the given path
/// </summary>
/// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
/// The 'true' means that just the request of installation is seccessful.
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath, RequestEventCallback eventCallback)
+ public static bool Install(string packagePath, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal)
{
- return Install(packagePath, null, PackageType.UNKNOWN, eventCallback);
+ return Install(packagePath, null, PackageType.UNKNOWN, eventCallback, installMode);
}
/// <summary>
/// Installs package located at the given path
/// </summary>
/// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="type">Optional - Package type for the package to be installed</param>
+ /// <param name="type">Package type for the package to be installed</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
/// The 'true' means that just the request of installation is seccessful.
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath, PackageType type)
+ public static bool Install(string packagePath, PackageType type, InstallationMode installMode = InstallationMode.Normal)
{
- return Install(packagePath, null, type, null);
+ return Install(packagePath, null, type, null, installMode);
}
/// <summary>
/// Installs package located at the given path
/// </summary>
/// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Optional - Absolute path for the expansion package to be installed</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
/// The 'true' means that just the request of installation is seccessful.
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath, string expansionPackagePath)
+ public static bool Install(string packagePath, string expansionPackagePath, InstallationMode installMode = InstallationMode.Normal)
{
- return Install(packagePath, expansionPackagePath, PackageType.UNKNOWN, null);
+ return Install(packagePath, expansionPackagePath, PackageType.UNKNOWN, null, installMode);
}
/// <summary>
/// Installs package located at the given path
/// </summary>
/// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="type">Optional - Package type for the package to be installed</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
+ /// <param name="type">Package type for the package to be installed</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
/// The 'true' means that just the request of installation is seccessful.
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath, PackageType type, RequestEventCallback eventCallback)
+ public static bool Install(string packagePath, PackageType type, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal)
{
- return Install(packagePath, null, type, eventCallback);
+ return Install(packagePath, null, type, eventCallback, installMode);
}
/// <summary>
/// Installs package located at the given path
/// </summary>
/// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Optional - Absolute path for the expansion package to be installed</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
/// The 'true' means that just the request of installation is seccessful.
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath, string expansionPackagePath, RequestEventCallback eventCallback)
+ public static bool Install(string packagePath, string expansionPackagePath, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal)
{
- return Install(packagePath, expansionPackagePath, PackageType.UNKNOWN, eventCallback);
+ return Install(packagePath, expansionPackagePath, PackageType.UNKNOWN, eventCallback, installMode);
}
/// <summary>
/// Installs package located at the given path
/// </summary>
/// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Optional - Absolute path for the expansion package to be installed</param>
- /// <param name="type">Optional - Package type for the package to be installed</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
+ /// <param name="type">Package type for the package to be installed</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
/// The 'true' means that just the request of installation is seccessful.
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath, string expansionPackagePath, PackageType type)
+ public static bool Install(string packagePath, string expansionPackagePath, PackageType type, InstallationMode installMode = InstallationMode.Normal)
{
- return Install(packagePath, expansionPackagePath, type, null);
+ return Install(packagePath, expansionPackagePath, type, null, installMode);
}
/// <summary>
/// Installs package located at the given path
/// </summary>
/// <param name="packagePath">Absolute path for the package to be installed</param>
- /// <param name="expansionPackagePath">Optional - Absolute path for the expansion package to be installed</param>
- /// <param name="type">Optional - Package type for the package to be installed</param>
- /// <param name="eventCallback">Optional - The event callback will be invoked only for the current request</param>
+ /// <param name="expansionPackagePath">Absolute path for the expansion package to be installed</param>
+ /// <param name="type">Package type for the package to be installed</param>
+ /// <param name="eventCallback">The event callback will be invoked only for the current request</param>
+ /// <param name="installMode">Optional parameter to indicate special installation mode</param>
/// <returns>Returns true if installtion request is successful, false otherwise.</returns>
/// <remarks>
/// The 'true' means that just the request of installation is seccessful.
/// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback.
/// </remarks>
/// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
- public static bool Install(string packagePath, string expansionPackagePath, PackageType type, RequestEventCallback eventCallback)
+ public static bool Install(string packagePath, string expansionPackagePath, PackageType type, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal)
{
SafePackageManagerRequestHandle RequestHandle;
var err = Interop.PackageManager.PackageManagerRequestCreate(out RequestHandle);
@@ -541,7 +551,16 @@ namespace Tizen.Applications
int requestId;
if (eventCallback != null)
{
- err = Interop.PackageManager.PackageManagerRequestInstallWithCB(RequestHandle, packagePath, internalRequestEventCallback, IntPtr.Zero, out requestId);
+ InstallMethodWithCallback install;
+ if (installMode == InstallationMode.Mount)
+ {
+ install = Interop.PackageManager.PackageManagerRequestMountInstallWithCB;
+ }
+ else
+ {
+ install = Interop.PackageManager.PackageManagerRequestInstallWithCB;
+ }
+ err = install(RequestHandle, packagePath, internalRequestEventCallback, IntPtr.Zero, out requestId);
if (err == Interop.PackageManager.ErrorCode.None)
{
RequestCallbacks.Add(requestId, eventCallback);
@@ -556,7 +575,16 @@ namespace Tizen.Applications
}
else
{
- err = Interop.PackageManager.PackageManagerRequestInstall(RequestHandle, packagePath, out requestId);
+ InstallMethod install;
+ if (installMode == InstallationMode.Mount)
+ {
+ install = Interop.PackageManager.PackageManagerRequestMountInstall;
+ }
+ else
+ {
+ install = Interop.PackageManager.PackageManagerRequestInstall;
+ }
+ err = install(RequestHandle, packagePath, out requestId);
if (err != Interop.PackageManager.ErrorCode.None)
{
Log.Warn(LogTag, string.Format("Failed to install package {0}. err = {1}", packagePath, err));