Refactor Tizen.Applications
authorsung-su.kim <sung-su.kim@samsung.com>
Mon, 11 Apr 2016 06:37:11 +0000 (15:37 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Tue, 19 Apr 2016 07:55:13 +0000 (16:55 +0900)
- Move classes of Tizen.Applications.Manager to Tizen.Applications
- Remove RunningApplication class
- Cleanup code and comments

Change-Id: Ia6018fd9ec4f26be129e1aabfee344f9722071c0

43 files changed:
Tizen.Applications/Interop/Interop.AppCommon.cs
Tizen.Applications/Interop/Interop.AppControl.cs
Tizen.Applications/Interop/Interop.AppEvent.cs
Tizen.Applications/Interop/Interop.Application.cs
Tizen.Applications/Interop/Interop.ApplicationManager.cs
Tizen.Applications/Interop/Interop.Bundle.cs
Tizen.Applications/Interop/Interop.Glib.cs
Tizen.Applications/Interop/Interop.Libc.cs [changed mode: 0644->0755]
Tizen.Applications/Interop/Interop.Libraries.cs
Tizen.Applications/Interop/Interop.MessagePort.cs [changed mode: 0644->0755]
Tizen.Applications/Interop/Interop.Service.cs
Tizen.Applications/Tizen.Applications.Managers/ApplicationChangedEventArgs.cs [deleted file]
Tizen.Applications/Tizen.Applications.Managers/ApplicationManager.cs [deleted file]
Tizen.Applications/Tizen.Applications.Managers/ApplicationManagerErrorFactory.cs [deleted file]
Tizen.Applications/Tizen.Applications.Managers/ApplicationManagerImpl.cs [deleted file]
Tizen.Applications/Tizen.Applications.Managers/ApplicationState.cs [deleted file]
Tizen.Applications/Tizen.Applications.Managers/InstalledApplication.cs [deleted file]
Tizen.Applications/Tizen.Applications.Managers/InstalledApplicationMetadataFilter.cs [deleted file]
Tizen.Applications/Tizen.Applications.Managers/RunningApplication.cs [deleted file]
Tizen.Applications/Tizen.Applications.Messages/MessagePort.cs
Tizen.Applications/Tizen.Applications.csproj
Tizen.Applications/Tizen.Applications/AppControl.cs
Tizen.Applications/Tizen.Applications/AppControlLaunchMode.cs
Tizen.Applications/Tizen.Applications/AppControlOperations.cs
Tizen.Applications/Tizen.Applications/AppControlReceivedEventArgs.cs
Tizen.Applications/Tizen.Applications/AppControlReplyCallback.cs
Tizen.Applications/Tizen.Applications/AppControlReplyResult.cs
Tizen.Applications/Tizen.Applications/Application.cs
Tizen.Applications/Tizen.Applications/ApplicationInfo.cs
Tizen.Applications/Tizen.Applications/ApplicationInfoFilter.cs [moved from Tizen.Applications/Tizen.Applications.Managers/InstalledApplicationFilter.cs with 61% similarity]
Tizen.Applications/Tizen.Applications/ApplicationInfoMetadataFilter.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/ApplicationLaunchedEventArgs.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/ApplicationManager.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/ApplicationTerminatedEventArgs.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/Bundle.cs
Tizen.Applications/Tizen.Applications/DirectoryInfo.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs
Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs
Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs
Tizen.Applications/Tizen.Applications/ReceivedAppControl.cs
Tizen.Applications/Tizen.Applications/ServiceApplication.cs
Tizen.Applications/Tizen.Applications/TizenSynchronizationContext.cs
Tizen.Applications/Tizen.Applications/UIApplication.cs

index a93f22d..74494f6 100755 (executable)
@@ -1,13 +1,11 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
-
-using System;
 using System.Runtime.InteropServices;
 
 using Tizen.Internals.Errors;
index fb032a5..67d529c 100755 (executable)
@@ -1,10 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
index 53c6c7b..4fc04e0 100755 (executable)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
index d155754..9e524f4 100755 (executable)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
index 9f46f12..31c4ee6 100755 (executable)
@@ -1,10 +1,10 @@
 // Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
@@ -13,8 +13,28 @@ internal static partial class Interop
 {
     internal static partial class ApplicationManager
     {
+        internal enum ErrorCode
+        {
+            None = Tizen.Internals.Errors.ErrorCode.None,
+            InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
+            OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
+            IoError = Tizen.Internals.Errors.ErrorCode.IoError,
+            NoSuchApp = -0x01110000 | 0x01,
+            DbFailed = -0x01110000 | 0x03,
+            InvalidPackage = -0x01110000 | 0x04,
+            AppNoRunning = -0x01110000 | 0x05,
+            RequestFailed = -0x01110000 | 0x06,
+            PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied
+        }
+
+        internal enum AppContextEvent
+        {
+            Launched = 0,
+            Terminated = 1
+        }
+
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void AppManagerAppContextEventCallback(IntPtr handle, int state, IntPtr userData);
+        internal delegate void AppManagerAppContextEventCallback(IntPtr handle, AppContextEvent state, IntPtr userData);
         //void(* app_manager_app_context_event_cb)(app_context_h app_context, app_context_event_e event, void *user_data)
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@@ -34,7 +54,7 @@ internal static partial class Interop
         //bool(* app_info_metadata_cb )(const char *metadata_key, const char *metadata_value, void *user_data)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_set_app_context_event_cb")]
-        internal static extern int AppManagerSetAppContextEvent(AppManagerAppContextEventCallback callback, IntPtr userData);
+        internal static extern ErrorCode AppManagerSetAppContextEvent(AppManagerAppContextEventCallback callback, IntPtr userData);
         //int app_manager_set_app_context_event_cb( app_manager_app_context_event_cb callback, void * user_data)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_unset_app_context_event_cb")]
@@ -42,183 +62,183 @@ internal static partial class Interop
         //void app_manager_unset_app_context_event_cb (void);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_foreach_app_context")]
-        internal static extern int AppManagerForeachAppContext(AppManagerAppContextCallback callback, IntPtr userData);
+        internal static extern ErrorCode AppManagerForeachAppContext(AppManagerAppContextCallback callback, IntPtr userData);
         //int app_manager_foreach_app_context(app_manager_app_context_cb callback, void *user_data)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_context")]
-        internal static extern int AppManagerGetAppContext(string applicationId, out IntPtr handle);
+        internal static extern ErrorCode AppManagerGetAppContext(string applicationId, out IntPtr handle);
         //int app_manager_get_app_context(const char* app_id, app_context_h *app_context);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_id")]
-        internal static extern int AppManagerGetAppId(int processId, out string applicationId);
+        internal static extern ErrorCode AppManagerGetAppId(int processId, out string applicationId);
         //int app_manager_get_app_id (pid_t pid, char **appid);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_is_running")]
-        internal static extern int AppManagerIsRunning(string applicationId, out bool running);
+        internal static extern ErrorCode AppManagerIsRunning(string applicationId, out bool running);
         //int app_manager_is_running (const char *appid, bool *running);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_resume_app")]
-        internal static extern int AppManagerResumeApp(IntPtr handle);
+        internal static extern ErrorCode AppManagerResumeApp(IntPtr handle);
         //int app_manager_resume_app (app_context_h handle);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_request_terminate_bg_app")]
-        internal static extern int AppManagerRequestTerminateBgApp(IntPtr handle);
+        internal static extern ErrorCode AppManagerRequestTerminateBgApp(IntPtr handle);
         //int app_manager_request_terminate_bg_app (app_context_h handle);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_foreach_app_info")]
-        internal static extern int AppManagerForeachAppInfo(AppManagerAppInfoCallback callback, IntPtr userData);
+        internal static extern ErrorCode AppManagerForeachAppInfo(AppManagerAppInfoCallback callback, IntPtr userData);
         //int app_manager_foreach_app_info(app_manager_app_info_cb callback, void *user_data)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_info")]
-        internal static extern int AppManagerGetAppInfo(string applicationId, out IntPtr handle);
+        internal static extern ErrorCode AppManagerGetAppInfo(string applicationId, out IntPtr handle);
         //int app_manager_get_app_info(const char * app_id, app_info_h * app_info)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_data_path")]
-        internal static extern int AppManagerGetSharedDataPath(string applicationId, out string path);
+        internal static extern ErrorCode AppManagerGetSharedDataPath(string applicationId, out string path);
         //int app_manager_get_shared_data_path (const char *appid, char **path);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_resource_path")]
-        internal static extern int AppManagerGetSharedResourcePath(string applicationId, out string path);
+        internal static extern ErrorCode AppManagerGetSharedResourcePath(string applicationId, out string path);
         //int app_manager_get_shared_resource_path (const char *appid, char **path);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_trusted_path")]
-        internal static extern int AppManagerGetSharedTrustedPath(string applicationId, out string path);
+        internal static extern ErrorCode AppManagerGetSharedTrustedPath(string applicationId, out string path);
         //int app_manager_get_shared_trusted_path (const char *appid, char **path);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_external_shared_data_path")]
-        internal static extern int AppManagerGetExternalSharedDataPath(string applicationId, out string path);
+        internal static extern ErrorCode AppManagerGetExternalSharedDataPath(string applicationId, out string path);
         //int app_manager_get_external_shared_data_path (const char *appid, char **path);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_context_destroy")]
-        internal static extern int AppContextDestroy(IntPtr handle);
+        internal static extern ErrorCode AppContextDestroy(IntPtr handle);
         //int app_context_destroy(app_context_h app_context)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_package")]
-        internal static extern int AppContextGetPackage(IntPtr handle, out IntPtr package);
+        internal static extern ErrorCode AppContextGetPackage(IntPtr handle, out IntPtr package);
         //int app_context_get_package (app_context_h app_context, char **package);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_app_id")]
-        internal static extern int AppContextGetAppId(IntPtr handle, out IntPtr applicationId);
+        internal static extern ErrorCode AppContextGetAppId(IntPtr handle, out string applicationId);
         //int app_context_get_app_id(app_context_h app_context, char **app_id)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_pid")]
-        internal static extern int AppContextGetPid(IntPtr handle, out int processId);
+        internal static extern ErrorCode AppContextGetPid(IntPtr handle, out int processId);
         //int app_context_get_pid (app_context_h app_context, pid_t *pid)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_context_is_terminated")]
-        internal static extern int AppContextIsTerminated(IntPtr handle, out bool terminated);
+        internal static extern ErrorCode AppContextIsTerminated(IntPtr handle, out bool terminated);
         //int app_context_is_terminated (app_context_h app_context, bool *terminated);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_context_is_equal")]
-        internal static extern int AppContextIsEqual(IntPtr first, IntPtr second, out bool equal);
+        internal static extern ErrorCode AppContextIsEqual(IntPtr first, IntPtr second, out bool equal);
         //int app_context_is_equal (app_context_h lhs, app_context_h rhs, bool *equal);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_context_clone")]
-        internal static extern int AppContextClone(out IntPtr destination, IntPtr source);
+        internal static extern ErrorCode AppContextClone(out IntPtr destination, IntPtr source);
         //int app_context_clone (app_context_h *clone, app_context_h app_context);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_create")]
-        internal static extern int AppInfoCreate(string applicationId, out IntPtr handle);
+        internal static extern ErrorCode AppInfoCreate(string applicationId, out IntPtr handle);
         //int app_info_create (const char *app_id, app_info_h *app_info);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_destroy")]
-        internal static extern int AppInfoDestroy(IntPtr handle);
+        internal static extern ErrorCode AppInfoDestroy(IntPtr handle);
         //int app_info_destroy (app_info_h app_info);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_app_id")]
-        internal static extern int AppInfoGetAppId(IntPtr handle, out IntPtr applicationId);
+        internal static extern ErrorCode AppInfoGetAppId(IntPtr handle, out IntPtr applicationId);
         //int app_info_get_app_id (app_info_h app_info, char **app_id);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_exec")]
-        internal static extern int AppInfoGetExec(IntPtr handle, out IntPtr exec);
+        internal static extern ErrorCode AppInfoGetExec(IntPtr handle, out IntPtr exec);
         //int app_info_get_exec (app_info_h app_info, char **exec);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_label")]
-        internal static extern int AppInfoGetLabel(IntPtr handle, out IntPtr label);
+        internal static extern ErrorCode AppInfoGetLabel(IntPtr handle, out IntPtr label);
         //int app_info_get_label (app_info_h app_info, char **label);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_localed_label")]
-        internal static extern int AppInfoGetLocaledLabel(string applicationId, string locale, out IntPtr label);
+        internal static extern ErrorCode AppInfoGetLocaledLabel(string applicationId, string locale, out IntPtr label);
         //int app_info_get_localed_label (const char *app_id, const char *locale, char **label);
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_icon")]
-        internal static extern int AppInfoGetIcon(IntPtr handle, out IntPtr path);
+        internal static extern ErrorCode AppInfoGetIcon(IntPtr handle, out IntPtr path);
         //int app_info_get_icon (app_info_h app_info, char **path)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_package")]
-        internal static extern int AppInfoGetPackage(IntPtr handle, out IntPtr package);
+        internal static extern ErrorCode AppInfoGetPackage(IntPtr handle, out IntPtr package);
         //int app_info_get_package (app_info_h app_info, char **package)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_type")]
-        internal static extern int AppInfoGetType(IntPtr handle, out IntPtr type);
+        internal static extern ErrorCode AppInfoGetType(IntPtr handle, out IntPtr type);
         //int app_info_get_type (app_info_h app_info, char **type)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_foreach_metadata")]
-        internal static extern int AppInfoForeachMetadata(IntPtr handle, AppInfoMetadataCallback callback, IntPtr userData);
+        internal static extern ErrorCode AppInfoForeachMetadata(IntPtr handle, AppInfoMetadataCallback callback, IntPtr userData);
         //int app_info_foreach_metadata(app_info_h app_info, app_info_metadata_cb callback, void *user_data)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_nodisplay")]
-        internal static extern int AppInfoIsNodisplay(IntPtr handle, out bool noDisplay);
+        internal static extern ErrorCode AppInfoIsNodisplay(IntPtr handle, out bool noDisplay);
         //int app_info_is_nodisplay (app_info_h app_info, bool *nodisplay)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_equal")]
-        internal static extern int AppInfoIsEqual(IntPtr first, IntPtr second, out bool equal);
+        internal static extern ErrorCode AppInfoIsEqual(IntPtr first, IntPtr second, out bool equal);
         //int app_info_is_equal (app_info_h lhs, app_info_h rhs, bool *equal)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_enabled")]
-        internal static extern int AppInfoIsEnabled(IntPtr handle, out bool enabled);
+        internal static extern ErrorCode AppInfoIsEnabled(IntPtr handle, out bool enabled);
         //int app_info_is_enabled (app_info_h app_info, bool *enabled)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_onboot")]
-        internal static extern int AppInfoIsOnBoot(IntPtr handle, out bool onBoot);
+        internal static extern ErrorCode AppInfoIsOnBoot(IntPtr handle, out bool onBoot);
         //int app_info_is_onboot (app_info_h app_info, bool *onboot)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_preload")]
-        internal static extern int AppInfoIsPreLoad(IntPtr handle, out bool preLoaded);
+        internal static extern ErrorCode AppInfoIsPreLoad(IntPtr handle, out bool preLoaded);
         //int app_info_is_preload (app_info_h app_info, bool *preload)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_clone")]
-        internal static extern int AppInfoClone(out IntPtr destination, IntPtr source);
+        internal static extern ErrorCode AppInfoClone(out IntPtr destination, IntPtr source);
         //int app_info_clone(app_info_h * clone, app_info_h app_info)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_create")]
-        internal static extern int AppInfoFilterCreate(out IntPtr handle);
+        internal static extern ErrorCode AppInfoFilterCreate(out IntPtr handle);
         //int app_info_filter_create(app_info_filter_h * handle)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_destroy")]
-        internal static extern int AppInfoFilterDestroy(IntPtr handle);
+        internal static extern ErrorCode AppInfoFilterDestroy(IntPtr handle);
         //int app_info_filter_destroy(app_info_filter_h handle)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_add_bool")]
-        internal static extern int AppInfoFilterAddBool(IntPtr handle, string property, bool value);
+        internal static extern ErrorCode AppInfoFilterAddBool(IntPtr handle, string property, bool value);
         //int app_info_filter_add_bool(app_info_filter_h handle, const char *property, const bool value)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_add_string")]
-        internal static extern int AppInfoFilterAddString(IntPtr handle, string property, string value);
+        internal static extern ErrorCode AppInfoFilterAddString(IntPtr handle, string property, string value);
         //int app_info_filter_add_string(app_info_filter_h handle, const char *property, const char *value)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_count_appinfo")]
-        internal static extern int AppInfoFilterCountAppinfo(IntPtr handle, out int count);
+        internal static extern ErrorCode AppInfoFilterCountAppinfo(IntPtr handle, out int count);
         //int app_info_filter_count_appinfo(app_info_filter_h handle, int *count)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_foreach_appinfo")]
-        internal static extern int AppInfoFilterForeachAppinfo(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData);
+        internal static extern ErrorCode AppInfoFilterForeachAppinfo(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData);
         //int app_info_filter_foreach_appinfo(app_info_filter_h handle, app_info_filter_cb callback, void * user_data)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_create")]
-        internal static extern int AppInfoMetadataFilterCreate(out IntPtr handle);
+        internal static extern ErrorCode AppInfoMetadataFilterCreate(out IntPtr handle);
         //int app_info_metadata_filter_create (app_info_metadata_filter_h *handle)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_destroy")]
-        internal static extern int AppInfoMetadataFilterDestroy(IntPtr handle);
+        internal static extern ErrorCode AppInfoMetadataFilterDestroy(IntPtr handle);
         //int app_info_metadata_filter_destroy (app_info_metadata_filter_h handle)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_add")]
-        internal static extern int AppInfoMetadataFilterAdd(IntPtr handle, string key, string value);
+        internal static extern ErrorCode AppInfoMetadataFilterAdd(IntPtr handle, string key, string value);
         //int app_info_metadata_filter_add (app_info_metadata_filter_h handle, const char *key, const char *value)
 
         [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_foreach")]
-        internal static extern int AppInfoMetadataFilterForeach(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData);
+        internal static extern ErrorCode AppInfoMetadataFilterForeach(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData);
         //int app_info_metadata_filter_foreach (app_info_metadata_filter_h handle, app_info_filter_cb callback, void *user_data)
     }
 }
index 995442e..9668b00 100755 (executable)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
index b2e3f5c..1a36b11 100755 (executable)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
old mode 100644 (file)
new mode 100755 (executable)
index c968cb2..674ca1d
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
index af1cf14..aa8a0f4 100755 (executable)
@@ -1,10 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 internal static partial class Interop
 {
old mode 100644 (file)
new mode 100755 (executable)
index 63659ee..0d35250
@@ -1,3 +1,11 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
 using System;
 using System.Runtime.InteropServices;
 
@@ -26,4 +34,4 @@ internal static partial class Interop
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void message_port_message_cb(int local_port_id, string remote_app_id, string remote_port, bool trusted_remote_port, IntPtr message, IntPtr userData);
     }
-}
\ No newline at end of file
+}
index 2fdacea..26cb4f6 100755 (executable)
@@ -1,17 +1,14 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Runtime.InteropServices;
 
-using Tizen.Internals.Errors;
-
 internal static partial class Interop
 {
     internal static partial class Service
diff --git a/Tizen.Applications/Tizen.Applications.Managers/ApplicationChangedEventArgs.cs b/Tizen.Applications/Tizen.Applications.Managers/ApplicationChangedEventArgs.cs
deleted file mode 100755 (executable)
index 705e1f0..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-using System;
-
-namespace Tizen.Applications.Managers
-{
-    /// <summary>
-    /// ApplicationChangedEventArgs class. This class is an event arguments of the ApplicationLaunched and ApplicationTerminated events.
-    /// </summary>
-    public class ApplicationChangedEventArgs : EventArgs
-    {
-        private string _appid = "";
-        private int _pid = 0;
-        private ApplicationState _state = ApplicationState.None;
-
-        internal ApplicationChangedEventArgs(string applicationId, int processId, int state)
-        {
-            _appid = applicationId;
-            _pid = processId;
-            _state = (ApplicationState)state;
-        }
-
-        /// <summary>
-        /// ApplicationId property.
-        /// </summary>
-        /// <returns>string application id.</returns>
-        public string ApplicationId
-        {
-            get
-            {
-                return _appid;
-            }
-        }
-
-        /// <summary>
-        /// ProcessId property.
-        /// </summary>
-        /// <returns>int process id.</returns>
-        public int ProcessId
-        {
-            get
-            {
-                return _pid;
-            }
-        }
-
-        /// <summary>
-        /// State property.
-        /// </summary>
-        /// <returns>ApplicationState enum value.</returns>
-        public ApplicationState State
-        {
-            get
-            {
-                return _state;
-            }
-        }
-
-    }
-}
-
diff --git a/Tizen.Applications/Tizen.Applications.Managers/ApplicationManager.cs b/Tizen.Applications/Tizen.Applications.Managers/ApplicationManager.cs
deleted file mode 100755 (executable)
index 789ab9d..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Tizen.Applications.Managers
-{
-    /// <summary>
-    /// ApplicationManager class. This class has the methods and events of the ApplicationManager.
-    /// </summary>
-    public static class ApplicationManager
-    {
-        /// <summary>
-        /// ApplicationLaunched event. This event is occurred when the application is launched.
-        /// </summary>
-        static public event EventHandler<ApplicationChangedEventArgs> ApplicationLaunched
-        {
-            add
-            {
-                ApplicationManagerImpl.Instance.ApplicationLaunched += value;
-            }
-            remove
-            {
-                ApplicationManagerImpl.Instance.ApplicationLaunched -= value;
-            }
-        }
-
-        /// <summary>
-        /// ApplicationTerminated event. This event is occurred when the application is terminated.
-        /// </summary>
-        static public event EventHandler<ApplicationChangedEventArgs> ApplicationTerminated
-        {
-            add
-            {
-                ApplicationManagerImpl.Instance.ApplicationTerminated += value;
-            }
-            remove
-            {
-                ApplicationManagerImpl.Instance.ApplicationTerminated -= value;
-            }
-        }
-
-        /// <summary>
-        /// GetInstalledAppsAsync asynchronous method.
-        /// </summary>
-        /// <returns>It returns the InstalledApplication informations asynchronously.</returns>
-        static public Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync()
-        {
-            return ApplicationManagerImpl.Instance.GetInstalledAppsAsync();
-        }
-
-        /// <summary>
-        /// GetInstalledAppsAsync asynchronous method.
-        /// </summary>
-        /// <param name="filter">Filter is a InstalledApplicationFilter type. It consisting of a key and value pairs.</param>
-        /// <returns>It returns the filtered InstalledApplication informations asynchronously.</returns>
-        static public Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync(InstalledApplicationFilter filter)
-        {
-            return ApplicationManagerImpl.Instance.GetInstalledAppsAsync(filter);
-        }
-
-        /// <summary>
-        /// GetInstalledAppsAsync asynchronous method.
-        /// </summary>
-        /// <param name="filter">Filter is a InstalledApplicationMetadataFilter type. It consisting of a key and value pairs.</param>
-        /// <returns>It returns the filtered InstalledApplication informations asynchronously.</returns>
-        static public Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync(InstalledApplicationMetadataFilter filter)
-        {
-            return ApplicationManagerImpl.Instance.GetInstalledAppsAsync(filter);
-        }
-
-        /// <summary>
-        /// GetRunningAppsAsync asynchronous method.
-        /// </summary>
-        /// <returns>It returns the RunningApplication informations asynchronously.</returns>
-        static public Task<IEnumerable<RunningApplication>> GetRunningAppsAsync()
-        {
-            return ApplicationManagerImpl.Instance.GetRunningAppsAsync();
-        }
-
-        /// <summary>
-        /// GetInstalledApp synchronous method.
-        /// </summary>
-        /// <param name="applicationId"> string application id.</param>
-        /// <returns>It returns the InstalledApplication information synchronously.</returns>
-        static public InstalledApplication GetInstalledApp(string applicationId)
-        {
-            return ApplicationManagerImpl.Instance.GetInstalledApp(applicationId);
-        }
-
-        /// <summary>
-        /// GetRunningApp synchronous method.
-        /// </summary>
-        /// <param name="applicationId">string application id.</param>
-        /// <returns>It returns the RunningApplication information synchronously.</returns>
-        static public RunningApplication GetRunningApp(string applicationId)
-        {
-            return ApplicationManagerImpl.Instance.GetRunningApp(applicationId);
-        }
-
-        /// <summary>
-        /// GetRunningApp synchronous method.
-        /// </summary>
-        /// <param name="processId">int process id.</param>
-        /// <returns>It returns the RunningApplication information synchronously.</returns>
-        static public RunningApplication GetRunningApp(int processId)
-        {
-            return ApplicationManagerImpl.Instance.GetRunningApp(processId);
-        }
-
-        /// <summary>
-        /// IsRunningApp synchronous method.
-        /// </summary>
-        /// <param name="applicationId">string application id.</param>
-        /// <returns>bool. If the application is running, true; otherwise, false.</returns>
-        static public bool IsRunningApp(string applicationId)
-        {
-            return ApplicationManagerImpl.Instance.IsRunningApp(applicationId);
-        }
-
-        /// <summary>
-        /// IsRunningApp synchronous method.
-        /// </summary>
-        /// <param name="processId">int process id.</param>
-        /// <returns>bool. If the application is running, true; otherwise, false.</returns>
-        static public bool IsRunningApp(int processId)
-        {
-            return ApplicationManagerImpl.Instance.IsRunningApp(processId);
-        }
-    }
-}
diff --git a/Tizen.Applications/Tizen.Applications.Managers/ApplicationManagerErrorFactory.cs b/Tizen.Applications/Tizen.Applications.Managers/ApplicationManagerErrorFactory.cs
deleted file mode 100755 (executable)
index 611a8c7..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-using System;
-
-namespace Tizen.Applications.Managers
-{
-    internal enum ApplicationManagerError
-    {
-        None = Tizen.Internals.Errors.ErrorCode.None,
-        InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
-        OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
-        IoError = Tizen.Internals.Errors.ErrorCode.IoError,
-        NoSuchApp = -0x01110000 | 0x01,
-        DbFailed = -0x01110000 | 0x03,
-        InvalidPackage = -0x01110000 | 0x04,
-        AppNoRunning = -0x01110000 | 0x05,
-        RequestFailed = -0x01110000 | 0x06,
-        PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied
-    }
-
-    internal static class ApplicationManagerErrorFactory
-    {
-        private const string LogTag = "Tizen.Applications.Managers";
-
-        internal static void ExceptionChecker(int ret, string msg)
-        {
-            Log.Debug(LogTag, "ExceptionChecker");
-            ApplicationManagerError err = (ApplicationManagerError)ret;
-            switch(err)
-            {
-                case ApplicationManagerError.InvalidParameter:
-                    Log.Error(LogTag, msg);
-                    throw new ArgumentException(err + " error occurred.");
-                case ApplicationManagerError.OutOfMemory:
-                case ApplicationManagerError.IoError:
-                case ApplicationManagerError.NoSuchApp:
-                case ApplicationManagerError.DbFailed:
-                case ApplicationManagerError.InvalidPackage:
-                case ApplicationManagerError.AppNoRunning:
-                case ApplicationManagerError.RequestFailed:
-                case ApplicationManagerError.PermissionDenied:
-                    Log.Error(LogTag, msg);
-                    throw new InvalidOperationException(err + " error occurred.");
-                default:
-                    break;
-            }
-        }
-
-    }
-}
diff --git a/Tizen.Applications/Tizen.Applications.Managers/ApplicationManagerImpl.cs b/Tizen.Applications/Tizen.Applications.Managers/ApplicationManagerImpl.cs
deleted file mode 100755 (executable)
index 482565a..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using System.Runtime.InteropServices;
-
-namespace Tizen.Applications.Managers
-{
-    internal class ApplicationManagerImpl : IDisposable
-    {
-        private static ApplicationManagerImpl s_instance = new ApplicationManagerImpl();
-
-        private bool _disposed = false;
-        private Interop.ApplicationManager.AppManagerAppContextEventCallback _applicationChangedEventCallback;
-
-        private const string LogTag = "Tizen.Applications.Managers";
-
-        private ApplicationManagerImpl()
-        {
-            Log.Debug(LogTag, "ApplicationManagerImpl()");
-            RegisterApplicationChangedEvent();
-        }
-
-
-        ~ApplicationManagerImpl()
-        {
-            Dispose(false);
-        }
-
-        internal event EventHandler<ApplicationChangedEventArgs> ApplicationLaunched;
-        internal event EventHandler<ApplicationChangedEventArgs> ApplicationTerminated;
-
-        internal static ApplicationManagerImpl Instance
-        {
-            get
-            {
-                return s_instance;
-            }
-        }
-
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        private void Dispose(bool disposing)
-        {
-            if (_disposed)
-                return;
-
-            if (disposing)
-            {
-                // Free managed objects.
-            }
-            //Free unmanaged objects
-            UnRegisterApplicationChangedEvent();
-            _disposed = true;
-        }
-
-        internal async Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync()
-        {
-            Log.Debug(LogTag, "GetInstalledAppsAsync()");
-            return await Task.Run(() =>
-            {
-                List<InstalledApplication> Result = new List<InstalledApplication>();
-
-                Interop.ApplicationManager.AppManagerAppInfoCallback cb = (IntPtr handle, IntPtr userData) =>
-                {
-                    if (handle != IntPtr.Zero)
-                    {
-                        IntPtr clonedHandle = IntPtr.Zero;
-                        int result = Interop.ApplicationManager.AppInfoClone(out clonedHandle, handle);
-                        if (result != 0)
-                        {
-                            return false;
-                        }
-                        InstalledApplication app = new InstalledApplication(clonedHandle);
-                        Result.Add(app);
-                        return true;
-                    }
-                    return false;
-                };
-                int ret = Interop.ApplicationManager.AppManagerForeachAppInfo(cb, IntPtr.Zero);
-                if (ret != 0)
-                {
-                    ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetInstalledAppsAsync() failed.");
-                }
-                return Result;
-            });
-        }
-
-        internal async Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync(InstalledApplicationFilter filter)
-        {
-            Log.Debug(LogTag, "GetInstalledAppsAsync(InstalledApplicationFilter filter)");
-            return await Task.Run(() =>
-            {
-                List<InstalledApplication> Result = new List<InstalledApplication>();
-
-                Interop.ApplicationManager.AppInfoFilterCallback cb = (IntPtr handle, IntPtr userData) =>
-                {
-                    Log.Debug(LogTag, "AppInfoFilterCallback");
-                    if (handle != IntPtr.Zero)
-                    {
-                        IntPtr clonedHandle = IntPtr.Zero;
-                        int ret = Interop.ApplicationManager.AppInfoClone(out clonedHandle, handle);
-                        if (ret != 0)
-                        {
-                            return false;
-                        }
-                        InstalledApplication app = new InstalledApplication(clonedHandle);
-                        Result.Add(app);
-                        return true;
-                    }
-                    return false;
-                };
-                filter.Fetch(cb);
-                return Result;
-            });
-        }
-        internal async Task<IEnumerable<RunningApplication>> GetRunningAppsAsync()
-        {
-            Log.Debug(LogTag, "GetRunningAppsAsync()");
-
-            return await Task.Run(() =>
-            {
-                List<RunningApplication> Result = new List<RunningApplication>();
-
-                Interop.ApplicationManager.AppManagerAppContextCallback cb = (IntPtr handle, IntPtr userData) =>
-                {
-                    Log.Debug(LogTag, "AppManagerAppContextCallback");
-                    if (handle != IntPtr.Zero)
-                    {
-                        IntPtr ptr = IntPtr.Zero;
-                        int result = Interop.ApplicationManager.AppContextGetAppId(handle, out ptr);
-                        if (result != 0)
-                        {
-                            return false;
-                        }
-                        string appid = Marshal.PtrToStringAuto(ptr);
-                        int pid = 0;
-                        result = Interop.ApplicationManager.AppContextGetPid(handle, out pid);
-                        if (result != 0)
-                        {
-                            return false;
-                        }
-                        RunningApplication app = new RunningApplication(appid, pid);
-                        Result.Add(app);
-                        return true;
-                    }
-                    return false;
-                };
-
-                int ret = Interop.ApplicationManager.AppManagerForeachAppContext(cb, IntPtr.Zero);
-                if (ret != 0)
-                {
-                    ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetRunningAppsAsync() failed.");
-                }
-                return Result;
-            });
-        }
-
-        internal InstalledApplication GetInstalledApp(string applicationId)
-        {
-            Log.Debug(LogTag, "GetInstalledApp(applicationId)");
-            IntPtr handle = IntPtr.Zero;
-            int ret = Interop.ApplicationManager.AppManagerGetAppInfo(applicationId, out handle);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetInstalledApp(applicationId) failed.");
-            }
-            if (handle != IntPtr.Zero)
-            {
-                InstalledApplication app = new InstalledApplication(handle);
-                return app;
-            }
-            return null;
-        }
-
-        internal RunningApplication GetRunningApp(string applicationId)
-        {
-            Log.Debug(LogTag, "GetRunningApp(applicationId)");
-            IntPtr handle = IntPtr.Zero;
-            int ret = Interop.ApplicationManager.AppManagerGetAppContext(applicationId, out handle);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetRunningApp(applicationId) failed.");
-            }
-            if (handle != IntPtr.Zero)
-            {
-                int pid = 0;
-                ret = Interop.ApplicationManager.AppContextGetPid(handle, out pid);
-                if (ret != 0)
-                {
-                    ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetRunningApp(applicationId) failed.");
-                }
-                RunningApplication app = new RunningApplication(applicationId, pid);
-                return app;
-            }
-            return null;
-        }
-
-        internal RunningApplication GetRunningApp(int processId)
-        {
-            Log.Debug(LogTag, "GetRunningApp(processId)");
-            string appid = "";
-            int ret = Interop.ApplicationManager.AppManagerGetAppId(processId, out appid);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetRunningApp(processId) failed.");
-            }
-            RunningApplication app = new RunningApplication(appid, processId);
-            return app;
-        }
-
-        internal bool IsRunningApp(string applicationId)
-        {
-            Log.Debug(LogTag, "IsRunningApp(applicationId)");
-            bool running = false;
-            int ret = Interop.ApplicationManager.AppManagerIsRunning(applicationId, out running);
-            if (ret != 0)
-            {
-                Log.Warn(LogTag, "IsRunningApp(applicationId) failed.");
-            }
-            return running;
-        }
-
-        internal bool IsRunningApp(int processId)
-        {
-            Log.Debug(LogTag, "IsRunningApp(processId)");
-            string appid = "";
-            int ret = Interop.ApplicationManager.AppManagerGetAppId(processId, out appid);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "IsRunningApp(processId) failed.");
-            }
-            bool running = false;
-            ret = Interop.ApplicationManager.AppManagerIsRunning(appid, out running);
-            if (ret != 0)
-            {
-                Log.Warn(LogTag, "IsRunningApp(processId) failed.");
-            }
-            return running;
-        }
-
-        private void RegisterApplicationChangedEvent()
-        {
-            Log.Debug(LogTag, "RegisterApplicationChangedEvent()");
-            _applicationChangedEventCallback = (IntPtr handle, int state, IntPtr userData) =>
-            {
-                Log.Debug(LogTag, "ApplicationChangedEventCallback");
-                if (handle == IntPtr.Zero) return;
-
-                IntPtr ptr = IntPtr.Zero;
-                int result = Interop.ApplicationManager.AppContextGetAppId(handle, out ptr);
-                if (result != 0)
-                {
-                    ApplicationManagerErrorFactory.ExceptionChecker(result, "RegisterApplicationChangedEvent() failed.");
-                }
-                string appid = Marshal.PtrToStringAuto(ptr);
-                int pid = 0;
-                result = Interop.ApplicationManager.AppContextGetPid(handle, out pid);
-                if (result != 0)
-                {
-                    ApplicationManagerErrorFactory.ExceptionChecker(result, "RegisterApplicationChangedEvent() failed.");
-                }
-                if (state == 0)
-                {
-                    var launchedEventCache = ApplicationLaunched;
-                    if (launchedEventCache != null)
-                    {
-                        Log.Debug(LogTag, "Raise up ApplicationLaunched");
-                        ApplicationChangedEventArgs e = new ApplicationChangedEventArgs(appid, pid, state);
-                        launchedEventCache(null, e);
-                    }
-                }
-                else if (state == 1)
-                {
-                    var terminatedEventCache = ApplicationTerminated;
-                    if (terminatedEventCache != null)
-                    {
-                        Log.Debug(LogTag, "Raise up ApplicationTerminated");
-                        ApplicationChangedEventArgs e = new ApplicationChangedEventArgs(appid, pid, state);
-                        terminatedEventCache(null, e);
-                    }
-                }
-            };
-            int ret = Interop.ApplicationManager.AppManagerSetAppContextEvent(_applicationChangedEventCallback, IntPtr.Zero);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "RegisterApplicationChangedEvent() register failed.");
-            }
-        }
-
-        private void UnRegisterApplicationChangedEvent()
-        {
-            Log.Debug(LogTag, "UnRegisterApplicationChangedEvent()");
-            Interop.ApplicationManager.AppManagerUnSetAppContextEvent();
-        }
-    }
-    internal static class FilterExtension
-    {
-        private const string LogTag = "Tizen.Applications.Managers";
-        internal static void Fetch(this InstalledApplicationFilter filter, Interop.ApplicationManager.AppInfoFilterCallback callback)
-        {
-            if (filter is InstalledApplicationMetadataFilter)
-            {
-                InstalledApplicationMetadataFilter metaFilter = (InstalledApplicationMetadataFilter)filter;
-                metaFilter.Fetch(callback);
-                return;
-            }
-
-            IntPtr nativeHandle = MakeNativeAppInfoFilter(filter.Filter);
-            int ret = Interop.ApplicationManager.AppInfoFilterForeachAppinfo(nativeHandle, callback, IntPtr.Zero);
-            if (nativeHandle != IntPtr.Zero)
-                Interop.ApplicationManager.AppInfoFilterDestroy(nativeHandle);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetInstalledAppsAsync(InstalledApplicationFilter) failed.");
-            }
-        }
-
-        internal static void Fetch(this InstalledApplicationMetadataFilter filter, Interop.ApplicationManager.AppInfoFilterCallback callback)
-        {
-            IntPtr nativeHandle = MakeNativeAppMetadataFilter(filter.Filter);
-            int ret = Interop.ApplicationManager.AppInfoMetadataFilterForeach(nativeHandle, callback, IntPtr.Zero);
-            if (nativeHandle != IntPtr.Zero)
-                Interop.ApplicationManager.AppInfoMetadataFilterDestroy(nativeHandle);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "GetInstalledAppsAsync(InstalledApplicationMetadataFilter) failed.");
-            }
-        }
-
-
-        private static IntPtr MakeNativeAppInfoFilter(IDictionary<string, string> filter)
-        {
-            if (filter == null)
-                throw new ArgumentException("Filter dose not added");
-            IntPtr handle;
-            int ret = Interop.ApplicationManager.AppInfoFilterCreate(out handle);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "AppInfoFilter creation failed.");
-            }
-
-            foreach (var item in filter)
-            {
-                if ((item.Key == InstalledApplicationFilter.Keys.Id) ||
-                    (item.Key == InstalledApplicationFilter.Keys.Type) ||
-                    (item.Key == InstalledApplicationFilter.Keys.Category))
-                {
-                    ret = Interop.ApplicationManager.AppInfoFilterAddString(handle, item.Key, item.Value);
-                }
-                else if ((item.Key == InstalledApplicationFilter.Keys.NoDisplay) ||
-                         (item.Key == InstalledApplicationFilter.Keys.TaskManage))
-                {
-                    ret = Interop.ApplicationManager.AppInfoFilterAddBool(handle, item.Key, Convert.ToBoolean(item.Value));
-                }
-                else
-                {
-                    Log.Warn(LogTag, "InstalledApplicationFilter is NOT supported " + item.Key + " key.");
-                }
-                if (ret != 0)
-                {
-                    Interop.ApplicationManager.AppInfoFilterDestroy(handle);
-                    ApplicationManagerErrorFactory.ExceptionChecker(ret, "InstalledApplicationFilter item add failed.");
-                }
-            }
-            return handle;
-        }
-
-        private static IntPtr MakeNativeAppMetadataFilter(IDictionary<string, string> filter)
-        {
-            if (filter == null)
-                throw new ArgumentException("Filter dose not added");
-            IntPtr handle;
-            int ret = Interop.ApplicationManager.AppInfoMetadataFilterCreate(out handle);
-            if (ret != 0)
-            {
-                ApplicationManagerErrorFactory.ExceptionChecker(ret, "InstalledApplicationMetadataFilter creation failed.");
-            }
-            foreach (var item in filter)
-            {
-                ret = Interop.ApplicationManager.AppInfoMetadataFilterAdd(handle, item.Key, item.Value);
-                if (ret != 0)
-                {
-                    Interop.ApplicationManager.AppInfoMetadataFilterDestroy(handle);
-                    ApplicationManagerErrorFactory.ExceptionChecker(ret, "InstalledApplicationMetadataFilter item add failed.");
-                }
-            }
-            return handle;
-        }
-    }
-}
diff --git a/Tizen.Applications/Tizen.Applications.Managers/ApplicationState.cs b/Tizen.Applications/Tizen.Applications.Managers/ApplicationState.cs
deleted file mode 100755 (executable)
index 6d4cd40..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-namespace Tizen.Applications.Managers
-{
-    /// <summary>
-    /// Enumeration for application state.
-    /// </summary>
-    public enum ApplicationState
-    {
-        /// <summary>
-        /// Initial state.
-        /// </summary>
-        None = -1,
-        /// <summary>
-        /// Launched state.
-        /// </summary>
-        Launched,
-        /// <summary>
-        /// Terminated state.
-        /// </summary>
-        Terminated,
-    }
-}
diff --git a/Tizen.Applications/Tizen.Applications.Managers/InstalledApplication.cs b/Tizen.Applications/Tizen.Applications.Managers/InstalledApplication.cs
deleted file mode 100755 (executable)
index a4f92a0..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-
-namespace Tizen.Applications.Managers
-{
-    /// <summary>
-    /// InstalledApplication class. This class has the methods and properties of InstalledApplication.
-    /// </summary>
-    public class InstalledApplication : IDisposable
-    {
-        private IntPtr _handle;
-        private bool disposed = false;
-
-        private const string LogTag = "Tizen.Applications.Managers";
-
-        internal InstalledApplication(IntPtr handle)
-        {
-            _handle = handle;
-        }
-
-        /// <summary>
-        /// ApplicationId property.
-        /// </summary>
-        /// <returns>string application id.</returns>
-        public string ApplicationId
-        {
-            get
-            {
-                IntPtr ptr = IntPtr.Zero;
-                Interop.ApplicationManager.AppInfoGetAppId(_handle, out ptr);
-                string appid = "";
-                if (ptr != IntPtr.Zero)
-                {
-                    appid = Marshal.PtrToStringAuto(ptr);
-                }
-                else
-                {
-                    Log.Warn(LogTag, "InstalledApplication get ApplicationId failed.");
-                }
-                return appid;
-            }
-        }
-        /// <summary>
-        /// PackageId property.
-        /// </summary>
-        /// <returns>string package id.</returns>
-        public string PackageId
-        {
-            get
-            {
-                IntPtr ptr = IntPtr.Zero;
-                Interop.ApplicationManager.AppInfoGetPackage(_handle, out ptr);
-                string packageid = "";
-                if (ptr != IntPtr.Zero)
-                {
-                    packageid = Marshal.PtrToStringAuto(ptr);
-                }
-                else
-                {
-                    Log.Warn(LogTag, "InstalledApplication get PackageId failed.");
-                }
-                return packageid;
-            }
-        }
-        /// <summary>
-        /// Label property.
-        /// </summary>
-        /// <returns>string label.</returns>
-        public string Label
-        {
-            get
-            {
-                IntPtr ptr = IntPtr.Zero;
-                Interop.ApplicationManager.AppInfoGetLabel(_handle, out ptr);
-                string label = "";
-                if (ptr != IntPtr.Zero)
-                {
-                    label = Marshal.PtrToStringAuto(ptr);
-                }
-                else
-                {
-                    Log.Warn(LogTag, "InstalledApplication get Label failed.");
-                }
-                return label;
-            }
-        }
-        /// <summary>
-        /// ExcutablePath property.
-        /// </summary>
-        /// <returns>string executable path.</returns>
-        public string ExcutablePath
-        {
-            get
-            {
-                IntPtr ptr = IntPtr.Zero;
-                Interop.ApplicationManager.AppInfoGetExec(_handle, out ptr);
-                string exec = "";
-                if (ptr != IntPtr.Zero)
-                {
-                    exec = Marshal.PtrToStringAuto(ptr);
-                }
-                else
-                {
-                    Log.Warn(LogTag, "InstalledApplication get ExcutablePath failed.");
-                }
-                return exec;
-            }
-        }
-        /// <summary>
-        /// IconPath property.
-        /// </summary>
-        /// <returns>string icon path.</returns>
-        public string IconPath
-        {
-            get
-            {
-                IntPtr ptr = IntPtr.Zero;
-                Interop.ApplicationManager.AppInfoGetIcon(_handle, out ptr);
-                string path = "";
-                if (ptr != IntPtr.Zero)
-                {
-                    path = Marshal.PtrToStringAuto(ptr);
-                }
-                else
-                {
-                    Log.Warn(LogTag, "InstalledApplication get IconPath failed.");
-                }
-                return path;
-            }
-        }
-        /// <summary>
-        /// Type property.
-        /// </summary>
-        /// <returns>string application type.</returns>
-        public string Type
-        {
-            get
-            {
-                IntPtr ptr = IntPtr.Zero;
-                Interop.ApplicationManager.AppInfoGetType(_handle, out ptr);
-                string type = "";
-                if (ptr != IntPtr.Zero)
-                {
-                    type = Marshal.PtrToStringAuto(ptr);
-                }
-                else
-                {
-                    Log.Warn(LogTag, "InstalledApplication get Type failed.");
-                }
-                return type;
-            }
-        }
-
-        /// <summary>
-        /// Metadata property.
-        /// </summary>
-        /// <returns>It returns IDictionary object with string key value pairs.</returns>
-        public IDictionary<String, String> Metadata
-        {
-            get
-            {
-                IDictionary<string, string> metadata = new Dictionary<String, String>();
-
-                Interop.ApplicationManager.AppInfoMetadataCallback cb = (string key, string value, IntPtr userData) =>
-                {
-                    Log.Debug(LogTag, "AppInfoMetadataCallback");
-                    if (key.Length != 0)
-                    {
-                        metadata.Add(key, value);
-                    }
-                    return true;
-                };
-
-                int ret = Interop.ApplicationManager.AppInfoForeachMetadata(_handle, cb, IntPtr.Zero);
-                if (ret != 0)
-                {
-                    Log.Warn(LogTag, "InstalledApplication get Metadata failed.");
-                }
-                return metadata;
-            }
-        }
-        /// <summary>
-        /// NoDisplay property.
-        /// </summary>
-        /// <returns>bool. If the application icon is not displayed on the menu screen, true; otherwise, false.</returns>
-        public bool NoDisplay
-        {
-            get
-            {
-                bool nodisplay = false;
-                Interop.ApplicationManager.AppInfoIsNodisplay(_handle, out nodisplay);
-                return nodisplay;
-            }
-        }
-        /// <summary>
-        /// OnBoot property.
-        /// </summary>
-        /// <returns>bool. If the application will be automatically start on boot, true; otherwise, false.</returns>
-        public bool OnBoot
-        {
-            get
-            {
-                bool onboot = false;
-                Interop.ApplicationManager.AppInfoIsOnBoot(_handle, out onboot);
-                return onboot;
-            }
-        }
-        /// <summary>
-        /// PreLoaded property.
-        /// </summary>
-        /// <returns>bool. If the application is preloaded, true; otherwise, false.</returns>
-        public bool PreLoaded
-        {
-            get
-            {
-                bool preloaded = false;
-                Interop.ApplicationManager.AppInfoIsPreLoad(_handle, out preloaded);
-                return preloaded;
-            }
-        }
-        /// <summary>
-        /// GetLocalizedLabel method.
-        /// </summary>
-        /// <param name="locale">string locale.</param>
-        /// <returns>string Localized Label. It returns the label for the input locale.</returns>
-        public string GetLocalizedLabel(string locale)
-        {
-            IntPtr ptr = IntPtr.Zero;
-            Interop.ApplicationManager.AppInfoGetLocaledLabel(ApplicationId, locale, out ptr);
-            string label = Label;
-            if (ptr != IntPtr.Zero)
-            {
-                label = Marshal.PtrToStringAuto(ptr);
-            }
-            else
-            {
-                Log.Warn(LogTag, "InstalledApplication GetLocalizedLabel(" + locale + ") failed.");
-            }
-            return label;
-        }
-
-        ~InstalledApplication()
-        {
-            Dispose(false);
-        }
-
-        /// <summary>
-        ///
-        /// </summary>
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        private void Dispose(bool disposing)
-        {
-            if(disposed)
-                return;
-            if(disposing)
-            {
-                // to be used if there are any other disposable objects
-            }
-            if (_handle != IntPtr.Zero)
-            {
-                Interop.ApplicationManager.AppInfoDestroy(_handle);
-                _handle = IntPtr.Zero;
-            }
-            disposed = true;
-        }
-    }
-}
diff --git a/Tizen.Applications/Tizen.Applications.Managers/InstalledApplicationMetadataFilter.cs b/Tizen.Applications/Tizen.Applications.Managers/InstalledApplicationMetadataFilter.cs
deleted file mode 100755 (executable)
index 1d460b5..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.Applications.Managers
-{
-    /// <summary>
-    /// InstalledApplicationMetadataFilter class. This class is a parameter of InstallerApplicationAppsAsync method.
-    /// </summary>
-    public class InstalledApplicationMetadataFilter : InstalledApplicationFilter
-    {
-    }
-}
diff --git a/Tizen.Applications/Tizen.Applications.Managers/RunningApplication.cs b/Tizen.Applications/Tizen.Applications.Managers/RunningApplication.cs
deleted file mode 100755 (executable)
index c8bb425..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-namespace Tizen.Applications.Managers
-{
-    /// <summary>
-    /// RunningApplication class. This class has the properties of RunningApplication.
-    /// </summary>
-    public class RunningApplication
-    {
-        internal RunningApplication(string applicationId, int processId)
-        {
-            ApplicationId = applicationId;
-            ProcessId = processId;
-        }
-
-        /// <summary>
-        /// ApplicationId property.
-        /// </summary>
-        /// <returns>string application id.</returns>
-        public string ApplicationId
-        {
-            get;
-            set;
-        }
-
-        /// <summary>
-        /// ProcessId property.
-        /// </summary>
-        /// <returns>string process id.</returns>
-        public int ProcessId
-        {
-            get;
-            set;
-        }
-    }
-}
index 97c61e3..7c77e6a 100755 (executable)
@@ -19,11 +19,11 @@ namespace Tizen.Applications.Messages
     /// </remarks>
     public class MessagePort : IDisposable
     {
-        private static object s_lock = new object();
-        private static HashSet<string> s_portMap = new HashSet<string>();
+        private static readonly object s_lock = new object();
+        private static readonly HashSet<string> s_portMap = new HashSet<string>();
 
         /// <summary>
-        /// Constructor
+        /// Initializes the instance of the MessagePort class.
         /// </summary>
         /// <param name="portName">The name of the local message port</param>
         /// <param name="trusted">If true is the trusted message port of application, otherwise false</param>
@@ -37,6 +37,9 @@ namespace Tizen.Applications.Messages
             _trusted = trusted;
         }
 
+        /// <summary>
+        /// Destructor of the MessagePort class.
+        /// </summary>
         ~MessagePort()
         {
             Dispose(false);
@@ -87,12 +90,12 @@ namespace Tizen.Applications.Messages
         /// <summary>
         /// The name of the local message port
         /// </summary>
-        private string _portName = null;
+        private readonly string _portName = null;
 
         /// <summary>
         /// If true the message port is a trusted port, otherwise false it is not
         /// </summary>
-        private bool _trusted = false;
+        private readonly bool _trusted = false;
 
         /// <summary>
         /// If true the message port is listening, otherwise false it is not
@@ -114,7 +117,8 @@ namespace Tizen.Applications.Messages
                 }
                 _messageCallBack = (int localPortId, string remoteAppId, string remotePortName, bool trusted, IntPtr message, IntPtr userData) =>
                 {
-                    MessageReceivedEventArgs args = new MessageReceivedEventArgs() {
+                    MessageReceivedEventArgs args = new MessageReceivedEventArgs()
+                    {
                         Message = Bundle.MakeRetainedBundle(message)
                     };
 
@@ -204,6 +208,10 @@ namespace Tizen.Applications.Messages
             }
         }
 
+        /// <summary>
+        /// Releases the unmanaged resourced used by the MessagePort class specifying whether to perform a normal dispose operation.
+        /// </summary>
+        /// <param name="disposing">true for a normal dispose operation; false to finalize the handle.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_listening)
@@ -211,17 +219,21 @@ namespace Tizen.Applications.Messages
                 try
                 {
                     StopListening();
-                } catch (Exception e)
+                }
+                catch (Exception e)
                 {
                     Tizen.Log.Warn(GetType().Namespace, "Exception in Dispose :" + e.Message);
                 }
             }
         }
 
+        /// <summary>
+        /// Releases all resources used by the MessagePort class.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }
     }
-}
\ No newline at end of file
+}
index b8e4c39..0c24cb4 100755 (executable)
@@ -22,6 +22,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <DocumentationFile>bin\Debug\Tizen.Applications.XML</DocumentationFile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <Compile Include="Interop\Interop.MessagePort.cs" />
     <Compile Include="Interop\Interop.Service.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Tizen.Applications.Managers\ApplicationManagerErrorFactory.cs" />
-    <Compile Include="Tizen.Applications.Managers\ApplicationState.cs" />
-    <Compile Include="Tizen.Applications.Managers\InstalledApplicationMetadataFilter.cs" />
+    <Compile Include="Tizen.Applications\ApplicationInfoMetadataFilter.cs" />
     <Compile Include="Tizen.Applications.Messages\MessagePort.cs" />
     <Compile Include="Tizen.Applications.Messages\MessagePortErrorFactory.cs" />
     <Compile Include="Tizen.Applications.Messages\MessageReceivedEventArgs.cs" />
     <Compile Include="Tizen.Applications.Messages\RemoteValues.cs" />
     <Compile Include="Tizen.Applications\AppControlReceivedEventArgs.cs" />
     <Compile Include="Tizen.Applications\AppControlReplyCallback.cs" />
-    <Compile Include="Tizen.Applications\ApplicationInfo.cs" />
+    <Compile Include="Tizen.Applications\ApplicationTerminatedEventArgs.cs" />
+    <Compile Include="Tizen.Applications\DirectoryInfo.cs" />
     <Compile Include="Tizen.Applications\LocaleChangedEventArgs.cs" />
     <Compile Include="Tizen.Applications\LowMemoryEventArgs.cs" />
     <Compile Include="Tizen.Applications\LowMemoryStatus.cs" />
     <Compile Include="Tizen.Applications\ReceivedAppControl.cs" />
     <Compile Include="Tizen.Applications\ServiceApplication.cs" />
     <Compile Include="Tizen.Applications\UIApplication.cs" />
-    <Compile Include="Tizen.Applications.Managers\ApplicationChangedEventArgs.cs" />
-    <Compile Include="Tizen.Applications.Managers\ApplicationManager.cs" />
-    <Compile Include="Tizen.Applications.Managers\InstalledApplicationFilter.cs" />
-    <Compile Include="Tizen.Applications.Managers\ApplicationManagerImpl.cs" />
-    <Compile Include="Tizen.Applications.Managers\InstalledApplication.cs" />
-    <Compile Include="Tizen.Applications.Managers\RunningApplication.cs" />
+    <Compile Include="Tizen.Applications\ApplicationLaunchedEventArgs.cs" />
+    <Compile Include="Tizen.Applications\ApplicationManager.cs" />
+    <Compile Include="Tizen.Applications\ApplicationInfoFilter.cs" />
+    <Compile Include="Tizen.Applications\ApplicationInfo.cs" />
     <Compile Include="Tizen.Applications\AppControl.cs" />
     <Compile Include="Tizen.Applications\AppControlLaunchMode.cs" />
     <Compile Include="Tizen.Applications\AppControlReplyResult.cs" />
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
+</Project>
\ No newline at end of file
index 12e9c6a..44b3268 100755 (executable)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Collections.Generic;
@@ -15,7 +14,7 @@ using System.Runtime.InteropServices;
 namespace Tizen.Applications
 {
     /// <summary>
-    /// The AppControl to launch other application or an actor or a service.
+    /// Represents the control message to exchange between applications.
     /// </summary>
     public class AppControl
     {
@@ -31,11 +30,11 @@ namespace Tizen.Applications
 
         private ExtraDataCollection _extraData = null;
 
-        static private Dictionary<int, Interop.AppControl.ReplyCallback>  _replyNativeCallbackMaps = new Dictionary<int, Interop.AppControl.ReplyCallback>();
-        static private int _replyNativeCallbackId = 0;
+        static private Dictionary<int, Interop.AppControl.ReplyCallback> s_replyNativeCallbackMaps = new Dictionary<int, Interop.AppControl.ReplyCallback>();
+        static private int s_replyNativeCallbackId = 0;
 
         /// <summary>
-        ///
+        /// Initializes the instance of the AppControl class.
         /// </summary>
         public AppControl()
         {
@@ -50,13 +49,13 @@ namespace Tizen.Applications
         {
             Interop.AppControl.ErrorCode err = Interop.AppControl.DangerousClone(out _handle, handle);
             if (err != Interop.AppControl.ErrorCode.None)
-                throw new InvalidOperationException("Failed to create the appcontrol handle. Err = " + err);
+                throw new InvalidOperationException("Failed to clone the appcontrol handle. Err = " + err);
         }
 
         #region Public Properties
 
         /// <summary>
-        /// The operation to be performed.
+        /// Gets and sets the operation to be performed.
         /// </summary>
         public string Operation
         {
@@ -87,7 +86,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// The explicit MIME type of the data.
+        /// Gets and sets the explicit MIME type of the data.
         /// </summary>
         public string Mime
         {
@@ -118,7 +117,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// The URI of the data.
+        /// Gets and sets the URI of the data.
         /// </summary>
         public string Uri
         {
@@ -149,7 +148,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        ///
+        /// Gets and sets the explicit category.
         /// </summary>
         public string Category
         {
@@ -180,7 +179,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        ///
+        /// Gets and sets the application id to explicitly launch.
         /// </summary>
         public string ApplicationId
         {
@@ -211,7 +210,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        ///
+        /// Gets and sets the launch mode of the application.
         /// </summary>
         public AppControlLaunchMode LaunchMode
         {
@@ -235,6 +234,9 @@ namespace Tizen.Applications
             }
         }
 
+        /// <summary>
+        /// Gets the collection of the extra data.
+        /// </summary>
         public ExtraDataCollection ExtraData
         {
             get
@@ -248,7 +250,7 @@ namespace Tizen.Applications
         #endregion // Public Properties
 
         /// <summary>
-        ///
+        /// Retrieves all applications that can be launched to handle the given app_control request.
         /// </summary>
         /// <returns></returns>
         public static IEnumerable<string> GetMatchedApplicationIds(AppControl control)
@@ -284,7 +286,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Sends the launch request.
         /// </summary>
         /// <param name="launchRequest"></param>
         /// <param name="replyAfterLaunching"></param>
@@ -299,10 +301,10 @@ namespace Tizen.Applications
             if (replyAfterLaunching != null)
             {
                 int id = 0;
-                lock (_replyNativeCallbackMaps)
+                lock (s_replyNativeCallbackMaps)
                 {
-                    id = _replyNativeCallbackId++;
-                    _replyNativeCallbackMaps[id] = (launchRequestHandle, replyRequestHandle, result, userData) =>
+                    id = s_replyNativeCallbackId++;
+                    s_replyNativeCallbackMaps[id] = (launchRequestHandle, replyRequestHandle, result, userData) =>
                     {
                         if (result == Interop.AppControl.AppStartedStatus)
                         {
@@ -314,14 +316,14 @@ namespace Tizen.Applications
                         {
                             Log.Debug(LogTag, "Reply Callback is launched");
                             replyAfterLaunching(new AppControl(launchRequestHandle), new AppControl(replyRequestHandle), (AppControlReplyResult)result);
-                            lock (_replyNativeCallbackMaps)
+                            lock (s_replyNativeCallbackMaps)
                             {
-                                _replyNativeCallbackMaps.Remove(id);
+                                s_replyNativeCallbackMaps.Remove(id);
                             }
                         }
                     };
                 }
-                err = Interop.AppControl.SendLaunchRequest(launchRequest._handle, _replyNativeCallbackMaps[id], IntPtr.Zero);
+                err = Interop.AppControl.SendLaunchRequest(launchRequest._handle, s_replyNativeCallbackMaps[id], IntPtr.Zero);
             }
             else
             {
@@ -331,17 +333,17 @@ namespace Tizen.Applications
             switch (err)
             {
                 case Interop.AppControl.ErrorCode.InvalidParameter:
-                throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
+                    throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
                 case Interop.AppControl.ErrorCode.AppNotFound:
-                throw new InvalidOperationException("App not found");
+                    throw new InvalidOperationException("App not found");
                 case Interop.AppControl.ErrorCode.LaunchRejected:
-                throw new InvalidOperationException("Launch rejected");
+                    throw new InvalidOperationException("Launch rejected");
                 case Interop.AppControl.ErrorCode.LaunchFailed:
-                throw new InvalidOperationException("Launch failed");
+                    throw new InvalidOperationException("Launch failed");
                 case Interop.AppControl.ErrorCode.TimedOut:
-                throw new TimeoutException("Timed out");
+                    throw new TimeoutException("Timed out");
                 case Interop.AppControl.ErrorCode.PermissionDenied:
-                throw new InvalidOperationException("Permission denied");
+                    throw new InvalidOperationException("Permission denied");
             }
         }
 
@@ -368,9 +370,9 @@ namespace Tizen.Applications
                 switch (err)
                 {
                     case Interop.AppControl.ErrorCode.InvalidParameter:
-                    throw new ArgumentNullException("Invalid parameter: key or value is a zero-length string");
+                        throw new ArgumentNullException("Invalid parameter: key or value is a zero-length string");
                     case Interop.AppControl.ErrorCode.KeyRejected:
-                    throw new ArgumentException("Key is rejected: the key is system-defined key.");
+                        throw new ArgumentException("Key is rejected: the key is system-defined key.");
                 }
             }
 
@@ -386,9 +388,9 @@ namespace Tizen.Applications
                 switch (err)
                 {
                     case Interop.AppControl.ErrorCode.InvalidParameter:
-                    throw new ArgumentNullException("Invalid parameter: key or value is a zero-length string");
+                        throw new ArgumentNullException("Invalid parameter: key or value is a zero-length string");
                     case Interop.AppControl.ErrorCode.KeyRejected:
-                    throw new ArgumentException("Key is rejected: the key is system-defined key.");
+                        throw new ArgumentException("Key is rejected: the key is system-defined key.");
                 }
             }
 
@@ -518,11 +520,11 @@ namespace Tizen.Applications
                 switch (err)
                 {
                     case Interop.AppControl.ErrorCode.InvalidParameter:
-                    throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
+                        throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
                     case Interop.AppControl.ErrorCode.KeyNotFound:
-                    throw new KeyNotFoundException("Key is not found"); ;
+                        throw new KeyNotFoundException("Key is not found"); ;
                     case Interop.AppControl.ErrorCode.KeyRejected:
-                    throw new ArgumentException("Key is rejected: the key is system-defined key.");
+                        throw new ArgumentException("Key is rejected: the key is system-defined key.");
                 }
             }
 
@@ -547,7 +549,7 @@ namespace Tizen.Applications
                 switch (err)
                 {
                     case Interop.AppControl.ErrorCode.InvalidParameter:
-                    throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
+                        throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
                 }
                 return isArray;
             }
@@ -559,13 +561,13 @@ namespace Tizen.Applications
                 switch (err)
                 {
                     case Interop.AppControl.ErrorCode.InvalidParameter:
-                    throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
+                        throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
                     case Interop.AppControl.ErrorCode.KeyNotFound:
-                    throw new KeyNotFoundException("Key is not found"); ;
+                        throw new KeyNotFoundException("Key is not found"); ;
                     case Interop.AppControl.ErrorCode.InvalidDataType:
-                    throw new ArgumentException("Invalid data type: value is data collection type");
+                        throw new ArgumentException("Invalid data type: value is data collection type");
                     case Interop.AppControl.ErrorCode.KeyRejected:
-                    throw new ArgumentException("Key is rejected: the key is system-defined key.");
+                        throw new ArgumentException("Key is rejected: the key is system-defined key.");
                 }
                 return value;
             }
@@ -579,13 +581,13 @@ namespace Tizen.Applications
                 switch (err)
                 {
                     case Interop.AppControl.ErrorCode.InvalidParameter:
-                    throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
+                        throw new ArgumentNullException("Invalid parameter: key is a zero-length string");
                     case Interop.AppControl.ErrorCode.KeyNotFound:
-                    throw new KeyNotFoundException("Key is not found"); ;
+                        throw new KeyNotFoundException("Key is not found"); ;
                     case Interop.AppControl.ErrorCode.InvalidDataType:
-                    throw new ArgumentException("Invalid data type: value is data collection type");
+                        throw new ArgumentException("Invalid data type: value is data collection type");
                     case Interop.AppControl.ErrorCode.KeyRejected:
-                    throw new ArgumentException("Key is rejected: the key is system-defined key.");
+                        throw new ArgumentException("Key is rejected: the key is system-defined key.");
                 }
 
                 string[] valueArray = null;
index ddbeb80..7f4f5d0 100755 (executable)
@@ -1,8 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 namespace Tizen.Applications
 {
index b9137f2..aea968d 100755 (executable)
@@ -1,13 +1,15 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 namespace Tizen.Applications
 {
     /// <summary>
-    ///
+    /// Operations of the AppControl.
     /// </summary>
     public static class AppControlOperations
     {
index a84264c..864477e 100755 (executable)
@@ -1,18 +1,23 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace Tizen.Applications
 {
-    public class AppControlReceivedEventArgs
+    /// <summary>
+    /// Arguments for the event that raised when the application receives the AppControl.
+    /// </summary>
+    public class AppControlReceivedEventArgs : EventArgs
     {
-        public AppControlReceivedEventArgs(ReceivedAppControl control)
-        {
-            ReceivedAppControl = control;
-        }
-
-        public ReceivedAppControl ReceivedAppControl { get; private set; }
+        /// <summary>
+        /// The received AppControl.
+        /// </summary>
+        public ReceivedAppControl ReceivedAppControl { get; internal set; }
     }
 }
index 7eb88e3..40e104a 100755 (executable)
@@ -1,19 +1,18 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 namespace Tizen.Applications
 {
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="launchRequest"></param>
+    /// <param name="replyRequest"></param>
+    /// <param name="result"></param>
     public delegate void AppControlReplyCallback(AppControl launchRequest, AppControl replyRequest, AppControlReplyResult result);
 }
index a72027c..19b844e 100755 (executable)
@@ -1,8 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 namespace Tizen.Applications
 {
index 5bfdcf0..bc27cb3 100755 (executable)
@@ -1,14 +1,15 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 
+using Tizen.Internals.Errors;
+
 namespace Tizen.Applications
 {
     /// <summary>
@@ -16,50 +17,97 @@ namespace Tizen.Applications
     /// </summary>
     public abstract class Application
     {
+        private const string LogTag = "Tizen.Applications";
+
         private static Application s_CurrentApplication = null;
 
         private Interop.AppEvent.SafeAppEventHandle _lowMemoryNativeHandle;
         private Interop.AppEvent.SafeAppEventHandle _localeChangedNativeHandle;
 
+        private object _lock = new object();
+
+        private DirectoryInfo _directoryInfo;
+        private ApplicationInfo _applicationInfo;
+
         /// <summary>
-        /// 
+        /// Occurs when the application is launched.
         /// </summary>
         public event EventHandler Created;
 
         /// <summary>
-        /// 
+        /// Occurs when the application is about to shutdown.
         /// </summary>
         public event EventHandler Terminated;
 
         /// <summary>
-        /// 
+        /// Occurs whenever the application receives the appcontrol message.
         /// </summary>
         public event EventHandler<AppControlReceivedEventArgs> AppControlReceived;
 
         /// <summary>
-        /// The low memory event.
+        /// Occurs when the system memory is low.
         /// </summary>
         public event EventHandler<LowMemoryEventArgs> LowMemory;
 
         /// <summary>
-        /// The system language changed event.
+        /// Occurs when the system language is chagned.
         /// </summary>
         public event EventHandler<LocaleChangedEventArgs> LocaleChanged;
 
         /// <summary>
-        /// 
+        /// Gets the instance of current application.
         /// </summary>
         public static Application Current { get { return s_CurrentApplication; } }
 
         /// <summary>
-        /// 
+        /// Gets the class representing directory information of current application.
         /// </summary>
-        public ApplicationInfo ApplicationInfo { get; internal set; }
+        public DirectoryInfo DirectoryInfo
+        {
+            get
+            {
+                lock (_lock)
+                {
+                    if (_directoryInfo == null)
+                    {
+                        _directoryInfo = new DirectoryInfo();
+                    }
+                }
+                return _directoryInfo;
+            }
+        }
+
+        /// <summary>
+        /// Gets the class representing information of current application.
+        /// </summary>
+        public ApplicationInfo ApplicationInfo
+        {
+            get
+            {
+                lock (_lock)
+                {
+                    string appId;
+                    ErrorCode err = Interop.AppCommon.AppGetId(out appId);
+                    if (err == ErrorCode.None)
+                    {
+                        try
+                        {
+                            _applicationInfo = ApplicationManager.GetInstalledApplication(appId);
+                        }
+                        catch (Exception e)
+                        {
+                            Log.Warn(LogTag, "Failed to get application info. " + e.Message);
+                        }
+                    }
+                }
+                return _applicationInfo;
+            }
+        }
 
         /// <summary>
         /// Runs the application's main loop.
         /// </summary>
-        /// <param name="args"></param>
+        /// <param name="args">Arguments from commandline.</param>
         public virtual void Run(string[] args)
         {
             s_CurrentApplication = this;
@@ -74,9 +122,9 @@ namespace Tizen.Applications
         public abstract void Exit();
 
         /// <summary>
-        /// 
+        /// Overrides this method if want to handle behavior when the application is launched.
+        /// If base.OnCreated() is not called, the event 'Created' will not be emitted.
         /// </summary>
-        /// <param name="e"></param>
         protected virtual void OnCreate()
         {
             EventHandler eh = Created;
@@ -87,9 +135,9 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Overrides this method if want to handle behavior when the application is terminated.
+        /// If base.OnTerminate() is not called, the event 'Terminated' will not be emitted.
         /// </summary>
-        /// <param name="e"></param>
         protected virtual void OnTerminate()
         {
             EventHandler eh = Terminated;
@@ -98,9 +146,10 @@ namespace Tizen.Applications
                 eh(this, EventArgs.Empty);
             }
         }
-        
+
         /// <summary>
-        /// 
+        /// Overrides this method if want to handle behavior when the application receives the appcontrol message.
+        /// If base.OnAppControlReceived() is not called, the event 'AppControlReceived' will not be emitted.
         /// </summary>
         /// <param name="e"></param>
         protected virtual void OnAppControlReceived(AppControlReceivedEventArgs e)
@@ -113,9 +162,9 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Overrides this method if want to handle behavior when the system memory is low.
+        /// If base.OnLowMemory() is not called, the event 'LowMemory' will not be emitted.
         /// </summary>
-        /// <param name="e"></param>
         protected virtual void OnLowMemory(LowMemoryEventArgs e)
         {
             EventHandler<LowMemoryEventArgs> eh = LowMemory;
@@ -126,9 +175,9 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Overrides this method if want to handle behavior when the system language is changed.
+        /// If base.OnLocaleChanged() is not called, the event 'LocaleChanged' will not be emitted.
         /// </summary>
-        /// <param name="e"></param>
         protected virtual void OnLocaleChanged(LocaleChangedEventArgs e)
         {
             EventHandler<LocaleChangedEventArgs> eh = LocaleChanged;
@@ -140,7 +189,6 @@ namespace Tizen.Applications
 
         internal void SendCreate()
         {
-            ApplicationInfo = new ApplicationInfo();
             OnCreate();
         }
 
index 0be9e8a..de37259 100755 (executable)
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
 
 namespace Tizen.Applications
 {
     /// <summary>
-    ///
+    /// This class provides methods and properties to get information of the application.
     /// </summary>
-    public class ApplicationInfo
+    public class ApplicationInfo : IDisposable
     {
-        private SharedPaths _shared = null;
-        private ExternalPaths _external = null;
+        private const string LogTag = "Tizen.Applications";
+        private bool _disposed = false;
+        private IntPtr _infoHandle;
 
-        private string _id;
-        private string _name;
-        private string _version;
-        private string _dataPath;
-        private string _cachePath;
-        private string _resourcePath;
-
-        internal ApplicationInfo()
+        internal ApplicationInfo(IntPtr infoHandle)
         {
+            _infoHandle = infoHandle;
+        }
 
+        /// <summary>
+        /// Destructor of the class
+        /// </summary>
+        ~ApplicationInfo()
+        {
+            Dispose(false);
         }
 
         /// <summary>
-        /// The ID of the application.
+        /// Gets the application id.
         /// </summary>
-        public string Id
+        public string ApplicationId
         {
             get
             {
-                if (_id == null)
+                IntPtr ptr = IntPtr.Zero;
+                Interop.ApplicationManager.AppInfoGetAppId(_infoHandle, out ptr);
+                string appid = "";
+                if (ptr != IntPtr.Zero)
                 {
-                    Interop.AppCommon.AppGetId(out _id);
+                    appid = Marshal.PtrToStringAuto(ptr);
                 }
-                return _id;
+                else
+                {
+                    Log.Warn(LogTag, "InstalledApplication get ApplicationId failed.");
+                }
+                return appid;
             }
         }
 
         /// <summary>
-        /// The localized name of the application.
+        /// Gets the package id of the application.
         /// </summary>
-        public string Name
+        public string PackageId
         {
             get
             {
-                if (_name == null)
+                IntPtr ptr = IntPtr.Zero;
+                Interop.ApplicationManager.AppInfoGetPackage(_infoHandle, out ptr);
+                string packageid = "";
+                if (ptr != IntPtr.Zero)
                 {
-                    Interop.AppCommon.AppGetName(out _name);
-
+                    packageid = Marshal.PtrToStringAuto(ptr);
                 }
-                return _name;
+                else
+                {
+                    Log.Warn(LogTag, "InstalledApplication get PackageId failed.");
+                }
+                return packageid;
             }
         }
 
         /// <summary>
-        /// The version of the application package.
+        /// Gets the label of the application.
         /// </summary>
-        public string Version
+        public string Label
         {
             get
             {
-                if (_version == null)
+                IntPtr ptr = IntPtr.Zero;
+                Interop.ApplicationManager.AppInfoGetLabel(_infoHandle, out ptr);
+                string label = "";
+                if (ptr != IntPtr.Zero)
+                {
+                    label = Marshal.PtrToStringAuto(ptr);
+                }
+                else
                 {
-                    Interop.AppCommon.AppGetVersion(out _version);
+                    Log.Warn(LogTag, "InstalledApplication get Label failed.");
                 }
-                return _version;
+                return label;
             }
         }
 
         /// <summary>
-        /// The absolute path to the application's data directory which is used to store private data of the application.
+        /// Gets the excutable path of the application.
         /// </summary>
-        public string DataPath
+        public string ExcutablePath
         {
             get
             {
-                if (_dataPath == null)
-                    _dataPath = Interop.AppCommon.AppGetDataPath();
-                return _dataPath;
+                IntPtr ptr = IntPtr.Zero;
+                Interop.ApplicationManager.AppInfoGetExec(_infoHandle, out ptr);
+                string exec = "";
+                if (ptr != IntPtr.Zero)
+                {
+                    exec = Marshal.PtrToStringAuto(ptr);
+                }
+                else
+                {
+                    Log.Warn(LogTag, "InstalledApplication get ExcutablePath failed.");
+                }
+                return exec;
             }
         }
 
         /// <summary>
-        /// The absolute path to the application's cache directory which is used to store temporary data of the application.
+        /// Gets the absolute path to the icon image. 
         /// </summary>
-        public string CachePath
+        public string IconPath
         {
             get
             {
-                if (_cachePath == null)
-                    _cachePath = Interop.AppCommon.AppGetCachePath();
-                return _cachePath;
+                IntPtr ptr = IntPtr.Zero;
+                Interop.ApplicationManager.AppInfoGetIcon(_infoHandle, out ptr);
+                string path = "";
+                if (ptr != IntPtr.Zero)
+                {
+                    path = Marshal.PtrToStringAuto(ptr);
+                }
+                else
+                {
+                    Log.Warn(LogTag, "InstalledApplication get IconPath failed.");
+                }
+                return path;
             }
         }
 
         /// <summary>
-        /// The absolute path to the application resource directory. The resource files are delivered with the application package.
+        /// Gets the package type name.
         /// </summary>
-        public string ResourcePath
+        public string Type
         {
             get
             {
-                if (_resourcePath == null)
-                    _resourcePath = Interop.AppCommon.AppGetResourcePath();
-                return _resourcePath;
+                IntPtr ptr = IntPtr.Zero;
+                Interop.ApplicationManager.AppInfoGetType(_infoHandle, out ptr);
+                string type = "";
+                if (ptr != IntPtr.Zero)
+                {
+                    type = Marshal.PtrToStringAuto(ptr);
+                }
+                else
+                {
+                    Log.Warn(LogTag, "InstalledApplication get Type failed.");
+                }
+                return type;
             }
         }
 
         /// <summary>
-        /// The shared paths
+        /// Gets the application's metadata.
         /// </summary>
-        public SharedPaths Shared
+        public IDictionary<String, String> Metadata
         {
             get
             {
-                if (_shared == null)
-                    _shared = new SharedPaths();
-                return _shared;
+                IDictionary<string, string> metadata = new Dictionary<String, String>();
+
+                Interop.ApplicationManager.AppInfoMetadataCallback cb = (string key, string value, IntPtr userData) =>
+                {
+                    if (key.Length != 0)
+                    {
+                        metadata.Add(key, value);
+                    }
+                    return true;
+                };
+
+                Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoForeachMetadata(_infoHandle, cb, IntPtr.Zero);
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    Log.Warn(LogTag, "Failed to get metadata of the application. err = " + err);
+                }
+                return metadata;
             }
         }
 
         /// <summary>
-        /// The external paths
+        /// Checks whether application information is nodisplay. If the application icon is not displayed on the menu screen, true; otherwise, false.
         /// </summary>
-        public ExternalPaths External
+        public bool IsNoDisplay
         {
             get
             {
-                if (_external == null)
-                    _external = new ExternalPaths();
-                return _external;
+                bool nodisplay = false;
+                Interop.ApplicationManager.AppInfoIsNodisplay(_infoHandle, out nodisplay);
+                return nodisplay;
             }
         }
 
         /// <summary>
-        /// The absolute path to the application's TEP(Tizen Expansion Package) directory. The resource files are delivered with the expansion package.
+        /// Checks whether application is launched on booting time. If the application will be automatically start on boot, true; otherwise, false.
         /// </summary>
-        public string ExpansionPackageResourcePath
+        public bool IsOnBoot
         {
             get
             {
-                return Interop.AppCommon.AppGetTepResourcePath();
+                bool onboot = false;
+                Interop.ApplicationManager.AppInfoIsOnBoot(_infoHandle, out onboot);
+                return onboot;
             }
         }
 
-
         /// <summary>
-        /// 
+        /// Checks whether application is preloaded. If the application is preloaded, true; otherwise, false.
         /// </summary>
-        public class SharedPaths
+        public bool IsPreload
         {
-            private string _dataPath;
-            private string _resourcePath;
-            private string _trustedPath;
-
-            internal SharedPaths() { }
-            /// <summary>
-            /// The absolute path to the application's shared data directory which is used to share data with other applications.
-            /// </summary>
-            public string DataPath
+            get
             {
-                get
-                {
-                    if (_dataPath == null)
-                        _dataPath = Interop.AppCommon.AppGetSharedDataPath();
-                    return _dataPath;
-                }
+                bool preloaded = false;
+                Interop.ApplicationManager.AppInfoIsPreLoad(_infoHandle, out preloaded);
+                return preloaded;
             }
+        }
 
-            /// <summary>
-            /// The absolute path to the application's shared resource directory which is used to share resources with other applications.
-            /// </summary>
-            public string ResourcePath
+        /// <summary>
+        /// Gets the application's process id. If the application is not running, the value will be zero (0).
+        /// </summary>
+        public int ProcessId
+        {
+            get
             {
-                get
+                int pid = 0;
+                IntPtr contextHandle = IntPtr.Zero;
+                try
                 {
-                    if (_resourcePath == null)
-                        _resourcePath = Interop.AppCommon.AppGetSharedResourcePath();
-                    return _resourcePath;
+                    Interop.ApplicationManager.AppManagerGetAppContext(ApplicationId, out contextHandle);
+                    Interop.ApplicationManager.AppContextGetPid(contextHandle, out pid);
                 }
-            }
-
-            /// <summary>
-            /// The absolute path to the application's shared trusted directory which is used to share data with a family of trusted applications.
-            /// </summary>
-            public string TrustedPath
-            {
-                get
+                finally
                 {
-                    if (_trustedPath == null)
-                        _trustedPath = Interop.AppCommon.AppGetSharedTrustedPath();
-                    return _trustedPath;
+                    if (contextHandle != IntPtr.Zero)
+                    {
+                        Interop.ApplicationManager.AppContextDestroy(contextHandle);
+                    }
                 }
+                return pid;
             }
         }
 
         /// <summary>
-        /// 
+        /// Checks whether the application is running. It returns the installed application running state.
         /// </summary>
-        public class ExternalPaths
+        public bool IsRunning
         {
-            private string _dataPath;
-            private string _cachePath;
-            private string _sharedDataPath;
-
-            internal ExternalPaths() { }
-
-            /// <summary>
-            /// The absolute path to the application's external data directory which is used to store data of the application.
-            /// </summary>
-            public string DataPath
+            get
             {
-                get
-                {
-                    if (_dataPath == null)
-                        _dataPath = Interop.AppCommon.AppGetExternalDataPath();
-                    return _dataPath;
-                }
+                bool running = false;
+                Interop.ApplicationManager.AppManagerIsRunning(ApplicationId, out running);
+                return running;
             }
+        }
 
-            /// <summary>
-            /// The absolute path to the application's external cache directory which is used to store temporary data of the application.
-            /// </summary>
-            public string CachePath
+        /// <summary>
+        /// Gets the localized label of application for the given locale.
+        /// </summary>
+        /// <param name="locale">locale.</param>
+        public string GetLocalizedLabel(string locale)
+        {
+            IntPtr ptr = IntPtr.Zero;
+            Interop.ApplicationManager.AppInfoGetLocaledLabel(ApplicationId, locale, out ptr);
+            string label = Label;
+            if (ptr != IntPtr.Zero)
             {
-                get
-                {
-                    if (_cachePath == null)
-                        _cachePath = Interop.AppCommon.AppGetExternalCachePath();
-                    return _cachePath;
-                }
+                label = Marshal.PtrToStringAuto(ptr);
+            }
+            else
+            {
+                Log.Warn(LogTag, "InstalledApplication GetLocalizedLabel(" + locale + ") failed.");
             }
+            return label;
+        }
+
+        /// <summary>
+        /// Releases all resources used by the ApplicationInfo class.
+        /// </summary>
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
 
-            /// <summary>
-            /// The absolute path to the application's external shared data directory which is used to share data with other applications.
-            /// </summary>
-            public string SharedDataPath
+        private void Dispose(bool disposing)
+        {
+            if (_disposed)
+                return;
+            if (disposing)
             {
-                get
-                {
-                    if (_sharedDataPath == null)
-                        _sharedDataPath = Interop.AppCommon.AppGetExternalSharedDataPath();
-                    return _sharedDataPath;
-                }
             }
+            if (_infoHandle != IntPtr.Zero)
+            {
+                Interop.ApplicationManager.AppInfoDestroy(_infoHandle);
+                _infoHandle = IntPtr.Zero;
+            }
+            _disposed = true;
         }
     }
 }
@@ -1,24 +1,23 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Collections.Generic;
 
-namespace Tizen.Applications.Managers
+namespace Tizen.Applications
 {
     /// <summary>
-    /// InstalledApplicationFilter class. This class is a parameter of InstallerApplicationAppsAsync method.
+    /// This class is a parameter of InstallerApplicationApplicationsAsync method.
     /// </summary>
-    public class InstalledApplicationFilter
+    public class ApplicationInfoFilter
     {
         /// <summary>
-        /// Keys class. This class is a possible key to use in the InstalledApplicationFilter.
+        /// This class is a possible key to use in the InstalledApplicationFilter.
         /// </summary>
         public static class Keys
         {
@@ -44,6 +43,9 @@ namespace Tizen.Applications.Managers
             public const string TaskManage = "PACKAGE_INFO_PROP_APP_TASKMANAGE";
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
         public IDictionary<string, string> Filter
         {
             get;
diff --git a/Tizen.Applications/Tizen.Applications/ApplicationInfoMetadataFilter.cs b/Tizen.Applications/Tizen.Applications/ApplicationInfoMetadataFilter.cs
new file mode 100755 (executable)
index 0000000..76abe60
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// This class is a parameter of InstallerApplicationApplicationsAsync method.
+    /// </summary>
+    public class ApplicationInfoMetadataFilter : ApplicationInfoFilter
+    {
+    }
+}
diff --git a/Tizen.Applications/Tizen.Applications/ApplicationLaunchedEventArgs.cs b/Tizen.Applications/Tizen.Applications/ApplicationLaunchedEventArgs.cs
new file mode 100755 (executable)
index 0000000..3aa6877
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// Arguments for the event that is raised when the application is launched.
+    /// </summary>
+    public class ApplicationLaunchedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// The information of the application.
+        /// </summary>
+        public ApplicationInfo ApplicationInfo { get; internal set; }        
+    }
+}
+
diff --git a/Tizen.Applications/Tizen.Applications/ApplicationManager.cs b/Tizen.Applications/Tizen.Applications/ApplicationManager.cs
new file mode 100755 (executable)
index 0000000..fab0a9b
--- /dev/null
@@ -0,0 +1,438 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// This class has the methods and events of the ApplicationManager.
+    /// </summary>
+    public static class ApplicationManager
+    {
+        /// <summary>
+        /// Occurs whenever the installed applications get launched.
+        /// </summary>
+        public static event EventHandler<ApplicationLaunchedEventArgs> ApplicationLaunched
+        {
+            add
+            {
+                ApplicationManagerImpl.Instance.ApplicationLaunched += value;
+            }
+            remove
+            {
+                ApplicationManagerImpl.Instance.ApplicationLaunched -= value;
+            }
+        }
+
+        /// <summary>
+        /// Occurs whenever the installed applications get terminated.
+        /// </summary>
+        public static event EventHandler<ApplicationTerminatedEventArgs> ApplicationTerminated
+        {
+            add
+            {
+                ApplicationManagerImpl.Instance.ApplicationTerminated += value;
+            }
+            remove
+            {
+                ApplicationManagerImpl.Instance.ApplicationTerminated -= value;
+            }
+        }
+
+        /// <summary>
+        /// Gets the information of the installed applications asynchronously.
+        /// </summary>
+        public static Task<IEnumerable<ApplicationInfo>> GetInstalledApplicationsAsync()
+        {
+            return ApplicationManagerImpl.Instance.GetInstalledApplicationsAsync();
+        }
+
+        /// <summary>
+        /// Gets the information of the installed applications with the ApplicationInfoFilter asynchronously.
+        /// </summary>
+        /// <param name="filter">Key-value pairs for filtering.</param>
+        public static Task<IEnumerable<ApplicationInfo>> GetInstalledApplicationsAsync(ApplicationInfoFilter filter)
+        {
+            return ApplicationManagerImpl.Instance.GetInstalledApplicationsAsync(filter);
+        }
+
+        /// <summary>
+        /// Gets the information of the installed applications with the ApplicationInfoMetadataFilter asynchronously.
+        /// </summary>
+        /// <param name="filter">Key-value pairs for filtering.</param>
+        public static Task<IEnumerable<ApplicationInfo>> GetInstalledApplicationsAsync(ApplicationInfoMetadataFilter filter)
+        {
+            return ApplicationManagerImpl.Instance.GetInstalledApplicationsAsync(filter);
+        }
+
+        /// <summary>
+        /// Gets the information of the running applications asynchronously.
+        /// </summary>
+        public static Task<IEnumerable<ApplicationInfo>> GetRunningApplicationsAsync()
+        {
+            return ApplicationManagerImpl.Instance.GetRunningApplicationsAsync();
+        }
+
+        /// <summary>
+        /// Gets the information of the specified application with the application id.
+        /// </summary>
+        /// <param name="applicationId">Application id.</param>
+        public static ApplicationInfo GetInstalledApplication(string applicationId)
+        {
+            return ApplicationManagerImpl.Instance.GetInstalledApplication(applicationId);
+        }
+    }
+
+    internal class ApplicationManagerImpl : IDisposable
+    {
+        private const string LogTag = "Tizen.Applications";
+        private static ApplicationManagerImpl s_instance = new ApplicationManagerImpl();
+        private bool _disposed = false;
+        private Interop.ApplicationManager.AppManagerAppContextEventCallback _applicationChangedEventCallback;
+
+        internal event EventHandler<ApplicationLaunchedEventArgs> ApplicationLaunched;
+        internal event EventHandler<ApplicationTerminatedEventArgs> ApplicationTerminated;
+
+        internal static ApplicationManagerImpl Instance
+        {
+            get
+            {
+                return s_instance;
+            }
+        }
+
+        private ApplicationManagerImpl()
+        {
+            Log.Debug(LogTag, "ApplicationManagerImpl()");
+            RegisterApplicationChangedEvent();
+        }
+
+        ~ApplicationManagerImpl()
+        {
+            Dispose(false);
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        private void Dispose(bool disposing)
+        {
+            if (_disposed)
+                return;
+            if (disposing)
+            {
+            }
+            UnRegisterApplicationChangedEvent();
+            _disposed = true;
+        }
+
+        internal async Task<IEnumerable<ApplicationInfo>> GetInstalledApplicationsAsync()
+        {
+            Log.Debug(LogTag, "GetInstalledApplicationsAsync()");
+            return await Task.Run(() =>
+            {
+                Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None;
+                List<ApplicationInfo> result = new List<ApplicationInfo>();
+
+                Interop.ApplicationManager.AppManagerAppInfoCallback cb = (IntPtr infoHandle, IntPtr userData) =>
+                {
+                    if (infoHandle != IntPtr.Zero)
+                    {
+                        IntPtr clonedHandle = IntPtr.Zero;
+                        err = Interop.ApplicationManager.AppInfoClone(out clonedHandle, infoHandle);
+                        if (err != Interop.ApplicationManager.ErrorCode.None)
+                        {
+                            Log.Warn(LogTag, "Failed to clone the appinfo. err = " + err);
+                            return false;
+                        }
+                        ApplicationInfo app = new ApplicationInfo(clonedHandle);
+                        result.Add(app);
+                        return true;
+                    }
+                    return false;
+                };
+                err = Interop.ApplicationManager.AppManagerForeachAppInfo(cb, IntPtr.Zero);
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    throw ApplicationManagerErrorFactory.GetException(err, "Failed to foreach the appinfo.");
+                }
+                return result;
+            });
+        }
+
+        internal async Task<IEnumerable<ApplicationInfo>> GetInstalledApplicationsAsync(ApplicationInfoFilter filter)
+        {
+            return await Task.Run(() =>
+            {
+                List<ApplicationInfo> result = new List<ApplicationInfo>();
+
+                Interop.ApplicationManager.AppInfoFilterCallback cb = (IntPtr infoHandle, IntPtr userData) =>
+                {
+                    if (infoHandle != IntPtr.Zero)
+                    {
+                        IntPtr clonedHandle = IntPtr.Zero;
+                        Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoClone(out clonedHandle, infoHandle);
+                        if (err != Interop.ApplicationManager.ErrorCode.None)
+                        {
+                            Log.Warn(LogTag, "Failed to clone the appinfo. err = " + err);
+                            return false;
+                        }
+                        ApplicationInfo app = new ApplicationInfo(clonedHandle);
+                        result.Add(app);
+                        return true;
+                    }
+                    return false;
+                };
+                filter.Fetch(cb);
+                return result;
+            });
+        }
+
+        internal async Task<IEnumerable<ApplicationInfo>> GetRunningApplicationsAsync()
+        {
+            return await Task.Run(() =>
+            {
+                Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None;
+                List<ApplicationInfo> result = new List<ApplicationInfo>();
+
+                Interop.ApplicationManager.AppManagerAppContextCallback cb = (IntPtr contextHandle, IntPtr userData) =>
+                {
+                    if (contextHandle != IntPtr.Zero)
+                    {
+                        string appid = string.Empty;
+                        err = Interop.ApplicationManager.AppContextGetAppId(contextHandle, out appid);
+                        if (err != Interop.ApplicationManager.ErrorCode.None)
+                        {
+                            Log.Warn(LogTag, "Failed to get appid. err = " + err);
+                            return false;
+                        }
+                        ApplicationInfo app = GetInstalledApplication(appid);
+                        if (app != null)
+                        {
+                            result.Add(app);
+                            return true;
+                        }
+                    }
+                    return false;
+                };
+
+                err = Interop.ApplicationManager.AppManagerForeachAppContext(cb, IntPtr.Zero);
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    throw ApplicationManagerErrorFactory.GetException(err, "Failed to foreach appcontext.");
+                }
+                return result;
+            });
+        }
+
+        internal ApplicationInfo GetInstalledApplication(string applicationId)
+        {
+            IntPtr infoHandle = IntPtr.Zero;
+            Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppManagerGetAppInfo(applicationId, out infoHandle);
+            if (err != Interop.ApplicationManager.ErrorCode.None)
+            {
+                throw ApplicationManagerErrorFactory.GetException(err, "Failed to get the installed appinfo.");
+            }
+            ApplicationInfo app = new ApplicationInfo(infoHandle);
+            return app;
+        }
+
+        private void RegisterApplicationChangedEvent()
+        {
+            Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None;
+            _applicationChangedEventCallback = (IntPtr contextHandle, Interop.ApplicationManager.AppContextEvent state, IntPtr userData) =>
+            {
+                if (contextHandle == IntPtr.Zero) return;
+                try
+                {
+                    string appid = string.Empty;
+                    err = Interop.ApplicationManager.AppContextGetAppId(contextHandle, out appid);
+                    if (err != Interop.ApplicationManager.ErrorCode.None)
+                    {
+                        throw ApplicationManagerErrorFactory.GetException(err, "Failed to get appid.");
+                    }
+
+                    ApplicationInfo appInfo = GetInstalledApplication(appid);
+                    if (state == Interop.ApplicationManager.AppContextEvent.Launched)
+                    {
+                        ApplicationLaunched?.Invoke(null, new ApplicationLaunchedEventArgs { ApplicationInfo = appInfo });
+                    }
+                    else if (state == Interop.ApplicationManager.AppContextEvent.Terminated)
+                    {
+                        ApplicationTerminated?.Invoke(null, new ApplicationTerminatedEventArgs { ApplicationInfo = appInfo });
+                    }
+                }
+                catch (Exception e)
+                {
+                    Log.Warn(LogTag, e.Message);
+                }
+            };
+            err = Interop.ApplicationManager.AppManagerSetAppContextEvent(_applicationChangedEventCallback, IntPtr.Zero);
+            if (err != Interop.ApplicationManager.ErrorCode.None)
+            {
+                throw ApplicationManagerErrorFactory.GetException(err, "Failed to register the appcontext event.");
+            }
+        }
+
+        private void UnRegisterApplicationChangedEvent()
+        {
+            Interop.ApplicationManager.AppManagerUnSetAppContextEvent();
+        }
+    }
+
+    internal static class FilterExtension
+    {
+        private const string LogTag = "Tizen.Applications.Managers";
+        internal static void Fetch(this ApplicationInfoFilter filter, Interop.ApplicationManager.AppInfoFilterCallback callback)
+        {
+            if (filter is ApplicationInfoMetadataFilter)
+            {
+                ApplicationInfoMetadataFilter metaFilter = (ApplicationInfoMetadataFilter)filter;
+                metaFilter.Fetch(callback);
+                return;
+            }
+
+            IntPtr nativeHandle = MakeNativeAppInfoFilter(filter.Filter);
+            if (nativeHandle == IntPtr.Zero)
+            {
+                throw ApplicationManagerErrorFactory.NativeFilterHandleIsInvalid();
+            }
+            try
+            {
+                Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoFilterForeachAppinfo(nativeHandle, callback, IntPtr.Zero);
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    throw ApplicationManagerErrorFactory.GetException(err, "Failed to foreach appinfo with filter.");
+                }
+            }
+            finally
+            {
+                Interop.ApplicationManager.AppInfoFilterDestroy(nativeHandle);
+            }
+        }
+
+        internal static void Fetch(this ApplicationInfoMetadataFilter filter, Interop.ApplicationManager.AppInfoFilterCallback callback)
+        {
+            IntPtr nativeHandle = MakeNativeAppMetadataFilter(filter.Filter);
+            if (nativeHandle == IntPtr.Zero)
+            {
+                throw ApplicationManagerErrorFactory.NativeFilterHandleIsInvalid();
+            }
+            try
+            {
+                Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoMetadataFilterForeach(nativeHandle, callback, IntPtr.Zero);
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    throw ApplicationManagerErrorFactory.GetException(err, "Failed to foreach metadata with filter.");
+                }
+            }
+            finally
+            {
+                Interop.ApplicationManager.AppInfoMetadataFilterDestroy(nativeHandle);
+            }
+        }
+
+        private static IntPtr MakeNativeAppInfoFilter(IDictionary<string, string> filter)
+        {
+            if (filter == null || filter.Count == 0)
+            {
+                throw ApplicationManagerErrorFactory.FilterIsInvalid();
+            }
+
+            IntPtr infoHandle = IntPtr.Zero;
+            Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoFilterCreate(out infoHandle);
+            if (err != Interop.ApplicationManager.ErrorCode.None)
+            {
+                throw ApplicationManagerErrorFactory.GetException(err, "Failed to create the filter handle.");
+            }
+
+            foreach (var item in filter)
+            {
+                if ((item.Key == ApplicationInfoFilter.Keys.Id) ||
+                    (item.Key == ApplicationInfoFilter.Keys.Type) ||
+                    (item.Key == ApplicationInfoFilter.Keys.Category))
+                {
+                    err = Interop.ApplicationManager.AppInfoFilterAddString(infoHandle, item.Key, item.Value);
+                }
+                else if ((item.Key == ApplicationInfoFilter.Keys.NoDisplay) ||
+                         (item.Key == ApplicationInfoFilter.Keys.TaskManage))
+                {
+                    err = Interop.ApplicationManager.AppInfoFilterAddBool(infoHandle, item.Key, Convert.ToBoolean(item.Value));
+                }
+                else
+                {
+                    Log.Warn(LogTag, string.Format("'{0}' is not supported key for the filter.", item.Key));
+                }
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    Interop.ApplicationManager.AppInfoFilterDestroy(infoHandle);
+                    throw ApplicationManagerErrorFactory.GetException(err, "Failed to add item to the filter.");
+                }
+            }
+            return infoHandle;
+        }
+
+        private static IntPtr MakeNativeAppMetadataFilter(IDictionary<string, string> filter)
+        {
+            if (filter == null || filter.Count == 0)
+            {
+                throw ApplicationManagerErrorFactory.FilterIsInvalid();
+            }
+
+            IntPtr infoHandle = IntPtr.Zero;
+            Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoMetadataFilterCreate(out infoHandle);
+            if (err != Interop.ApplicationManager.ErrorCode.None)
+            {
+                throw ApplicationManagerErrorFactory.GetException(err, "Failed to create the filter for searching with metadata.");
+            }
+            foreach (var item in filter)
+            {
+                err = Interop.ApplicationManager.AppInfoMetadataFilterAdd(infoHandle, item.Key, item.Value);
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    Interop.ApplicationManager.AppInfoMetadataFilterDestroy(infoHandle);
+                    throw ApplicationManagerErrorFactory.GetException(err, "Failed to add the item to the filter.");
+                }
+            }
+            return infoHandle;
+        }
+    }
+
+    internal static class ApplicationManagerErrorFactory
+    {
+        internal static Exception NativeFilterHandleIsInvalid()
+        {
+            return new InvalidOperationException("The native handle for filtering is invalid.");
+        }
+
+        internal static Exception FilterIsInvalid()
+        {
+            return new ArgumentException("The filter is invalid.");
+        }
+
+        internal static Exception GetException(Interop.ApplicationManager.ErrorCode err, string message)
+        {
+            string errMessage = String.Format("{0} err = {1}", message, err);
+            switch (err)
+            {
+                case Interop.ApplicationManager.ErrorCode.InvalidParameter:
+                    return new ArgumentException(errMessage);
+                case Interop.ApplicationManager.ErrorCode.OutOfMemory:
+                    return new OutOfMemoryException(errMessage);
+                default:
+                    return new InvalidOperationException(errMessage);
+            }
+        }
+    }
+}
diff --git a/Tizen.Applications/Tizen.Applications/ApplicationTerminatedEventArgs.cs b/Tizen.Applications/Tizen.Applications/ApplicationTerminatedEventArgs.cs
new file mode 100755 (executable)
index 0000000..ae7aa40
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// Arguments for the event that is raised when the application is terminated.
+    /// </summary>
+    public class ApplicationTerminatedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// The information of the application.
+        /// </summary>
+        public ApplicationInfo ApplicationInfo { get; internal set; }
+    }
+}
+
index b6a5adc..5d6725b 100755 (executable)
@@ -1,10 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Collections.Generic;
@@ -432,6 +432,9 @@ namespace Tizen.Applications
             }
         }
 
+        /// <summary>
+        /// Destructor of the Bundle class.
+        /// </summary>
         ~Bundle()
         {
             Dispose(false);
diff --git a/Tizen.Applications/Tizen.Applications/DirectoryInfo.cs b/Tizen.Applications/Tizen.Applications/DirectoryInfo.cs
new file mode 100755 (executable)
index 0000000..eacff16
--- /dev/null
@@ -0,0 +1,165 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// Represents directory information of the application.
+    /// </summary>
+    public class DirectoryInfo
+    {
+        private string _dataPath;
+        private string _cachePath;
+        private string _resourcePath;
+
+        private string _sharedDataPath;
+        private string _sharedResourcePath;
+        private string _sharedTrustedPath;
+
+        private string _externalDataPath;
+        private string _externalCachePath;
+        private string _externalSharedDataPath;
+
+        private string _expansionPackageResourcePath;
+
+        internal DirectoryInfo()
+        {
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's data directory which is used to store private data of the application.
+        /// </summary>
+        public string Data
+        {
+            get
+            {
+                if (_dataPath == null)
+                    _dataPath = Interop.AppCommon.AppGetDataPath();
+                return _dataPath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's cache directory which is used to store temporary data of the application.
+        /// </summary>
+        public string Cache
+        {
+            get
+            {
+                if (_cachePath == null)
+                    _cachePath = Interop.AppCommon.AppGetCachePath();
+                return _cachePath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application resource directory. The resource files are delivered with the application package.
+        /// </summary>
+        public string Resource
+        {
+            get
+            {
+                if (_resourcePath == null)
+                    _resourcePath = Interop.AppCommon.AppGetResourcePath();
+                return _resourcePath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's shared data directory which is used to share data with other applications.
+        /// </summary>
+        public string SharedData
+        {
+            get
+            {
+                if (_sharedDataPath == null)
+                    _sharedDataPath = Interop.AppCommon.AppGetSharedDataPath();
+                return _sharedDataPath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's shared resource directory which is used to share resources with other applications.
+        /// </summary>
+        public string SharedResource
+        {
+            get
+            {
+                if (_sharedResourcePath == null)
+                    _sharedResourcePath = Interop.AppCommon.AppGetSharedResourcePath();
+                return _sharedResourcePath;
+            }
+        }
+
+
+        /// <summary>
+        /// Gets the absolute path to the application's shared trusted directory which is used to share data with a family of trusted applications.
+        /// </summary>
+        public string SharedTrusted
+        {
+            get
+            {
+                if (_sharedTrustedPath == null)
+                    _sharedTrustedPath = Interop.AppCommon.AppGetSharedTrustedPath();
+                return _sharedTrustedPath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's external data directory which is used to store data of the application.
+        /// </summary>
+        public string ExternalData
+        {
+            get
+            {
+                if (_externalDataPath == null)
+                    _externalDataPath = Interop.AppCommon.AppGetExternalDataPath();
+                return _externalDataPath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's external cache directory which is used to store temporary data of the application.
+        /// </summary>
+        public string ExternalCache
+        {
+            get
+            {
+                if (_externalCachePath == null)
+                    _externalCachePath = Interop.AppCommon.AppGetExternalCachePath();
+                return _externalCachePath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's external shared data directory which is used to share data with other applications.
+        /// </summary>
+        public string ExternalSharedData
+        {
+            get
+            {
+                if (_externalSharedDataPath == null)
+                    _externalSharedDataPath = Interop.AppCommon.AppGetExternalSharedDataPath();
+                return _externalSharedDataPath;
+            }
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's TEP(Tizen Expansion Package) directory. The resource files are delivered with the expansion package.
+        /// </summary>
+        public string ExpansionPackageResource
+        {
+            get
+            {
+                if (_expansionPackageResourcePath == null)
+                    _expansionPackageResourcePath = Interop.AppCommon.AppGetTepResourcePath();
+                return _expansionPackageResourcePath;
+            }
+        }
+    }
+}
index 7454507..3836cea 100755 (executable)
@@ -1,17 +1,19 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
 
 namespace Tizen.Applications
 {
     /// <summary>
     /// 
     /// </summary>
-    public class LocaleChangedEventArgs
+    public class LocaleChangedEventArgs : EventArgs
     {
         /// <summary>
         /// 
index 349c00c..0a9c897 100755 (executable)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 
index 1a6b66b..b89cde8 100755 (executable)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 namespace Tizen.Applications
 {
index a394fa2..e1b18ac 100755 (executable)
@@ -1,15 +1,18 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 
 namespace Tizen.Applications
 {
+    /// <summary>
+    /// Represents the received AppControl.
+    /// </summary>
     public class ReceivedAppControl : AppControl
     {
         private const string LogTag = "Tizen.Applications";
@@ -56,7 +59,6 @@ namespace Tizen.Applications
         /// 
         /// </summary>
         /// <param name="replyRequest"></param>
-        /// <param name="launchRequest"></param>
         /// <param name="result"></param>
         public void ReplyToLaunchRequest(AppControl replyRequest, AppControlReplyResult result)
         {
index f5ef489..bbc7327 100755 (executable)
@@ -1,25 +1,24 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 
 namespace Tizen.Applications
 {
     /// <summary>
-    /// 
+    /// Represents a service application.
     /// </summary>
     public class ServiceApplication : Application
     {
         /// <summary>
-        /// 
+        /// Runs the service application's main loop.
         /// </summary>
-        /// <param name="args"></param>
+        /// <param name="args">Arguments from commandline.</param>
         public override void Run(string[] args)
         {
             base.Run(args);
@@ -36,7 +35,7 @@ namespace Tizen.Applications
             };
             ops.OnAppControl = (appControlHandle, data) =>
             {
-                OnAppControlReceived(new AppControlReceivedEventArgs(new ReceivedAppControl(appControlHandle)));
+                OnAppControlReceived(new AppControlReceivedEventArgs { ReceivedAppControl = new ReceivedAppControl(appControlHandle) });
             };
 
             TizenSynchronizationContext.Initialize();
@@ -44,7 +43,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Exits the main loop of the service application. 
         /// </summary>
         public override void Exit()
         {
index ca70228..1ff5b5d 100644 (file)
@@ -1,11 +1,10 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 using System.Collections.Generic;
index aaffbc3..0fa25c5 100755 (executable)
@@ -1,35 +1,34 @@
-/// Copyright 2016 by Samsung Electronics, Inc.,
-///
-/// This software is the confidential and proprietary information
-/// of Samsung Electronics, Inc. ("Confidential Information"). You
-/// shall not disclose such Confidential Information and shall use
-/// it only in accordance with the terms of the license agreement
-/// you entered into with Samsung.
-
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
 
 using System;
 
 namespace Tizen.Applications
 {
     /// <summary>
-    /// 
+    /// Represents an application that have UI screen. It has additional events for handling 'Resumed' and 'Paused' states.
     /// </summary>
     public class UIApplication : Application
     {
         /// <summary>
-        /// 
+        /// Occurs whenever the application is resumed.
         /// </summary>
         public event EventHandler Resumed;
 
         /// <summary>
-        /// 
+        /// Occurs whenever the application is paused.
         /// </summary>
         public event EventHandler Paused;
 
         /// <summary>
-        /// 
+        /// Runs the UI application's main loop.
         /// </summary>
-        /// <param name="args"></param>
+        /// <param name="args">Arguments from commandline.</param>
         public override void Run(string[] args)
         {
             base.Run(args);
@@ -46,7 +45,7 @@ namespace Tizen.Applications
             };
             ops.OnAppControl = (appControlHandle, data) =>
             {
-                OnAppControlReceived(new AppControlReceivedEventArgs(new ReceivedAppControl(appControlHandle)));
+                OnAppControlReceived(new AppControlReceivedEventArgs { ReceivedAppControl = new ReceivedAppControl(appControlHandle) });
             };
             ops.OnResume = (data) =>
             {
@@ -62,7 +61,7 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Exits the main loop of the UI application. 
         /// </summary>
         public override void Exit()
         {
@@ -70,7 +69,8 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Overrides this method if want to handle behavior when the application is resumed.
+        /// If base.OnResume() is not called, the event 'Resumed' will not be emitted.
         /// </summary>
         protected virtual void OnResume()
         {
@@ -82,7 +82,8 @@ namespace Tizen.Applications
         }
 
         /// <summary>
-        /// 
+        /// Overrides this method if want to handle behavior when the application is paused.
+        /// If base.OnPause() is not called, the event 'Paused' will not be emitted.
         /// </summary>
         protected virtual void OnPause()
         {