[Applications.Common] Add an internal API (#5183)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Tue, 18 Apr 2023 02:12:52 +0000 (11:12 +0900)
committerGitHub <noreply@github.com>
Tue, 18 Apr 2023 02:12:52 +0000 (11:12 +0900)
Adds:
 - AppControl.UnsetAutoRestart()

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Applications.Common/Interop/Interop.AppControl.cs
src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs

index c0dbfaa..eb6986e 100755 (executable)
@@ -169,5 +169,8 @@ internal static partial class Interop
 
         [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_window_position")]
         internal static extern ErrorCode GetWindowPosition(SafeAppControlHandle handle, out int x, out int y, out int w, out int h);
+
+        [DllImport(Libraries.AppControl, EntryPoint = "app_control_unset_auto_restart")]
+        internal static extern ErrorCode UnsetAutoRestart();
     }
 }
index da9bbc2..193e427 100755 (executable)
@@ -943,6 +943,34 @@ namespace Tizen.Applications
         }
 
         /// <summary>
+        /// Unsets the auto restart.
+        /// </summary>
+        /// <remarks>
+        /// The functionality of this method only applies to the caller application.
+        /// This method is only available for platform level signed applications.
+        /// </remarks>
+        /// <exception cref="Exceptions.PermissionDeniedException">Thrown when the permission is denied.</exception>
+        /// <exception cref="Exceptions.OutOfMemoryException">Thrown when the memory is insufficient.</exception>
+        /// <exception cref="InvalidOperationException">Thrown when the memory is insufficient.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static void UnsetAutoRestart()
+        {
+            Interop.AppControl.ErrorCode err = Interop.AppControl.UnsetAutoRestart();
+            if (err != Interop.AppControl.ErrorCode.None)
+            {
+                switch (err)
+                {
+                    case Interop.AppControl.ErrorCode.PermissionDenied:
+                        throw new Exceptions.PermissionDeniedException("Permission denied");
+                    case Interop.AppControl.ErrorCode.OutOfMemory:
+                        throw new Exceptions.OutOfMemoryException("Out of memory");
+                    default:
+                        throw new InvalidOperationException("err = " + err);
+                }
+            }
+        }
+
+        /// <summary>
         /// Gets all default applications.
         /// </summary>
         /// <returns>ApplicationIds.</returns>