move AppControl stop behavior
authorYoung Ik Cho <youngik.cho@samsung.com>
Fri, 18 Oct 2013 10:05:59 +0000 (19:05 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Fri, 18 Oct 2013 10:05:59 +0000 (19:05 +0900)
Change-Id: I1d87888c1ead37a738accac5a5968b23ad805841
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/app/FApp_AppControlImpl.cpp
src/app/inc/FApp_AppControlImpl.h
src/app/inc/FApp_INotificationManagerImpl.h [new file with mode: 0644]

index 172c876..b51f12c 100644 (file)
@@ -405,58 +405,10 @@ _AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, in
 }
 
 
-static bool
-IsValidAppControl(const String& appcontrolID)
-{
-       return ((appcontrolID == L"osp.appcontrol.provider.audio")
-               || (appcontrolID == L"osp.appcontrol.provider.bluetooth")
-               || (appcontrolID == L"osp.appcontrol.provider.calendar")
-               || (appcontrolID == L"osp.appcontrol.provider.camera")
-               || (appcontrolID == L"osp.appcontrol.provider.contact")
-               || (appcontrolID == L"osp.appcontrol.provider.certificatemanager")
-               || (appcontrolID == L"osp.appcontrol.provider.email")
-               || (appcontrolID == L"osp.appcontrol.provider.image")
-               || (appcontrolID == L"osp.appcontrol.provider.media")
-               || (appcontrolID == L"osp.appcontrol.provider.message")
-               || (appcontrolID == L"osp.appcontrol.provider.video")
-               || (appcontrolID == L"osp.appcontrol.provider.imageeditor")
-               || (appcontrolID == L"osp.appcontrol.provider.allshare")
-               || (appcontrolID == L"tizen.filemanager")
-               || (appcontrolID == L"tizen.camera")
-               || (appcontrolID == L"tizen.gallery")
-               || (appcontrolID == L"tizen.imageviewer")
-               || (appcontrolID == L"tizen.videoplayer")
-               || (appcontrolID == L"tizen.memo")
-               || (appcontrolID == L"tizen.contacts")
-               || (appcontrolID == L"tizen.calendar")
-               || (appcontrolID == L"tizen.todo")
-               || (appcontrolID == L"tizen.email")
-               || (appcontrolID == L"tizen.settings")
-               || (appcontrolID == L"tizen.messages")
-               || (appcontrolID == L"tizen.musicplayer")
-               || (appcontrolID == L"tizen.bluetooth")
-               || (appcontrolID == L"samsung.snote")
-               || (appcontrolID == L"0pnxz8hbsr.MyFiles")
-               || (appcontrolID == L"hdufar9ycj.Camera")
-               || (appcontrolID == L"ijudt7w61q.Gallery")
-               || (appcontrolID == L"jysyv9o1dc.ImageViewer")
-               || (appcontrolID == L"npwf0scb88.VideoPlayer")
-               || (appcontrolID == L"zunqjlsnce.Memo")
-               || (appcontrolID == L"f9uev8hsyo.Contacts")
-               || (appcontrolID == L"ph1vq2phrp.Calendar")
-               || (appcontrolID == L"vxqbrefica.Email")
-               || (appcontrolID == L"kto5jikgul.Settings")
-               || (appcontrolID == L"8r4r5ddzzn.Messages")
-               || (appcontrolID == L"dhrul6qzj3.MusicPlayer")
-               || (appcontrolID == L"smemo-efl"));
-}
-
 result
 _AppControlImpl::Stop(void)
 {
-       const String appcontrolID(GetAppControlProviderId());
-       SysTryReturnResult(NID_APP, IsValidAppControl(appcontrolID), E_INVALID_OPERATION, "Invalid appcontrolID(%ls)", appcontrolID.GetPointer());
-
+       result r = E_SUCCESS;
        result (*pStop)(int req) = null;
 
        if (_reqId != APPCONTROL_REQUEST_ID_INVALID)
@@ -466,7 +418,7 @@ _AppControlImpl::Stop(void)
 
                if (pInfo->pProvider)
                {
-                       pInfo->pProvider->StopAppControlPlugin(_reqId);
+                       r = pInfo->pProvider->StopAppControlPlugin(_reqId);
                }
 
                _AppControlManager::GetInstance()->__inAppManager.RemoveItem(_reqId);
@@ -478,14 +430,15 @@ _AppControlImpl::Stop(void)
                _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
                if (pProvider)
                {
-                       pProvider->StopAppControlPlugin(-1);
-                       SysLog(NID_APP, "Request is stopped.");
+                       r = pProvider->StopAppControlPlugin(-1);
 
                        pProvider->Release();
                }
        }
 
-       return E_SUCCESS;
+       SysLog(NID_APP, "[%s] Request is stopped.", GetErrorMessage(r));
+
+       return r;
 }
 
 String
@@ -545,7 +498,7 @@ _AppControlImpl::GetCategoryListN(void) const
        AppId appId = GetAppId();
        SysTryReturn(NID_APP, !appId.IsEmpty(), null, E_SYSTEM, "[E_SYSTEM] Empty appId.");
 
-       AppId aliasAppId = _AppControlRegistry::GetInstance()->GetAliasAppId(appId);
+       const AppId& aliasAppId = _AppControlRegistry::GetInstance()->GetAliasAppId(appId);
        if (!aliasAppId.IsEmpty())
        {
                appId = aliasAppId;
index 8d9e59e..4996ccf 100644 (file)
@@ -159,7 +159,7 @@ public:
         *
         * @return              The application control provider ID
         */
-       const Tizen::Base::String& GetAppControlProviderId(void) const
+       Tizen::Base::String GetAppControlProviderId(void) const
        {
                return _appId;
        }
@@ -169,7 +169,7 @@ public:
         *
         * @return              The operation ID
         */
-       const Tizen::Base::String& GetOperationId(void) const
+       Tizen::Base::String GetOperationId(void) const
        {
                return _opId;
        }
diff --git a/src/app/inc/FApp_INotificationManagerImpl.h b/src/app/inc/FApp_INotificationManagerImpl.h
new file mode 100644 (file)
index 0000000..c481132
--- /dev/null
@@ -0,0 +1,200 @@
+//
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file       FApp_INotificationManagerImpl.h
+ * @brief      This is the header file for the _INotificationManagerImpl class.
+ *
+ * This file contains the declarations of _INotificationManagerImpl.
+ */
+
+#ifndef _FAPP_INTERNAL_INOTIFICATION_MANAGER_IMPL_H_
+#define _FAPP_INTERNAL_INOTIFICATION_MANAGER_IMPL_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FAppTypes.h>
+
+
+namespace Tizen { namespace App
+{
+
+class _INotificationManagerImpl
+{
+public:
+       virtual ~_INotificationManagerImpl(void) {}
+
+       /** 
+        * Gets the badge number of the application icon.
+        *
+        * @return      The current badge number
+        * @exception   E_SUCCESS           The method is successful.
+        * @exception   E_SYSTEM            A system error has occurred.
+        * @exception   E_OBJ_NOT_FOUND     The application is not installed.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state. @n
+        *                                  The Construct() method is not called.
+        */
+       virtual int GetBadgeNumber(void) const = 0;
+
+       /**
+        * Notifies the user using a message and badge number. @n
+        * If the user checks the message, @c launchArguments is delivered to the application. @n
+        * @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
+        * invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
+        *
+        * @return      An error code
+        * @param[in]   messageText         The notification message
+        * @param[in]   badgeNumber         The badge number
+        * @param[in]   launchArguments     The message for application
+        * @exception   E_SUCCESS           The method is successful.
+        * @exception   E_INVALID_ARG       Either of the following conditions has occurred: @n
+        *                                  - A specified input parameter is invalid. @n
+        *                                  - The specified @c badgeNumber is less than @c 0. @n
+        *                                  - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
+        *                                  - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUUNCH_ARGUMENTS_LENGTH.
+        * @exception   E_SYSTEM            A system error has occurred.
+        * @exception   E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state. @n
+        *                                      The Construct() method is not called.
+        */
+       virtual result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) = 0;
+
+       /**
+        * Removes the notification message.
+        *
+        * @return      An error code
+        * @exception   E_SUCCESS           The method was successful.
+        * @exception   E_SYSTEM            A system error occurred.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state: @n
+        *                                  - The Construct() method is not called. @n
+        */
+       virtual result RemoveNotification(void) = 0;
+
+       /**
+        * Notifies the user about the ongoing activity using a message. @n
+        * @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
+        * invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
+        *
+        * @return      An error code
+        * @param[in]   messageText         The notification message
+        * @param[in]  launchArguments  The launch arguments for the application
+        * @exception   E_SUCCESS           The method is successful.
+        * @exception   E_INVALID_ARG       Either of the following conditions has occurred: @n
+        *                                  - A specified input parameter is invalid. @n
+        * @exception   E_SYSTEM            A system error has occurred.
+        * @exception   E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state. @n
+        *                                  The Construct() method is not called.
+        */
+       virtual result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) = 0;
+
+       /**
+        * Removes the notification message for the ongoing activity.
+        *
+        * @return      An error code
+        * @exception   E_SUCCESS           The method is successful.
+        * @exception   E_SYSTEM            A system error has occurred.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state. @n
+        *                                  The Construct() method is not called.
+        */
+       virtual result RemoveOngoingActivityNotification(void) = 0;
+
+       /**
+        * Gets the badge number of the application icon.
+        *
+        * @return      The current badge number
+        * @param[in]   appId               The application ID
+        * @exception   E_SUCCESS           The method is successful.
+        * @exception   E_SYSTEM            A system error has occurred.
+        * @exception   E_OBJ_NOT_FOUND     The application is not installed.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state. @n
+        *                                  The Construct() method is not called.
+        */
+       virtual int GetBadgeNumber(const Tizen::App::AppId& appId) const = 0;
+
+       /**
+        * Notifies the user using a message and badge number on behalf of the specified application. @n
+        * If the user checks the message, the @c launchArguments is delivered to the application.
+        *
+        * @return             An error code
+        * @param[in]  appId             The application ID
+        * @param[in]  messageText       The notification message
+        * @param[in]    badgeNumber         The badge number
+        * @param[in]  launchArguments   The launch arguments for the application
+        * @exception  E_SUCCESS         The method is successful.
+        * @exception  E_INVALID_ARG     Either of the following conditions has occurred: @n
+        *                               - A specified input parameter is invalid. @n
+        *                               - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
+        *                               - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
+        * @exception  E_APP_NOT_INSTALLED   The application is not installed.
+        * @exception  E_INVALID_OPERATION   The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy.
+        * @exception  E_SYSTEM              A system error has occurred.
+        * @exception  E_INVALID_STATE       This instance is in an invalid state. @n
+        *                                  The Construct() method is not called.
+        */
+       virtual result NotifyByAppId(const Tizen::App::AppId& appId, const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) = 0;
+
+       /**
+        * Notifies the user about the ongoing activity using a message on behalf of the specified application.
+        *
+        * @return      An error code
+        * @param[in]   appId               The application ID
+        * @param[in]   messageText         The notification message
+        * @param[in]  launchArguments  The launch arguments for application
+        * @exception   E_SUCCESS           The method is successful.
+        * @exception   E_INVALID_ARG       Either of the following conditions has occurred: @n
+        *                                  - A specified input parameter is invalid. @n
+        *                                  - The length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
+        *                                  - The length of @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
+        * @exception   E_APP_NOT_INSTALLED The application is not installed.
+        * @exception   E_SYSTEM            A system error has occurred.
+        * @exception   E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state. @n
+        *                                  The Construct() method is not called.
+        */
+       virtual result NotifyOngoingActivityByAppId(const Tizen::App::AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) = 0;
+
+       /**
+        * Removes the notification message for ongoing activity on behalf of the specified application.
+        *
+        * @return      An error code
+        * @param[in]   appId               The application ID
+        * @exception   E_SUCCESS           The method is successful.
+        * @exception   E_APP_NOT_INSTALLED The application is not installed.
+        * @exception   E_SYSTEM            A system error has occurred.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state. @n
+        *                                  The Construct() method is not called.
+        */
+       virtual result RemoveOngoingActivityNotificationByAppId(const Tizen::App::AppId& appId) = 0;
+
+       /**
+        * Removes the notification message on behalf of the specified application.
+        *
+        * @return      An error code
+        * @param[in]   appId               The application ID
+        * @exception   E_SUCCESS           The method was successful.
+        * @exception   E_APP_NOT_INSTALLED The application is not installed.
+        * @exception   E_SYSTEM            A system error occurred.
+        * @exception   E_INVALID_STATE     This instance is in an invalid state: @n
+        *                                  - The Construct() method is not called. @n
+        */
+       virtual result RemoveNotificationByAppId(const Tizen::App::AppId& appId) = 0;
+
+};
+
+} } // Tizen::App
+
+#endif // _FAPP_INTERNAL_INOTIFICATION_MANAGER_IMPL_H_