{
SysTryReturn(NID_APP, __pBundle != null, null, E_INVALID_STATE, "[E_INVALID_STATE] Improper bundle state.");
+ //Print();
+
HashMap* pHashMap = new (std::nothrow) HashMap(SingleObjectDeleter);
SysTryReturn(NID_APP, pHashMap != null, null, E_OUT_OF_MEMORY, "HashMap creation failure.");
return null;
}
- ArrayList* pList = _AppMessageImpl::GetValueArrayN(__pBundle, OSP_K_ARG);
- if (pList)
- {
- pHashMap->Add(new (std::nothrow) String(TIZEN_APPCONTROL_DATA_LEGACY), pList);
- }
return pHashMap;
}
#include <FAppAppControl.h>
#include <FAppAppManager.h>
#include <FAppPkgPackageAppInfo.h>
-#include <FAppIAppControlEventListener.h>
-#include <FAppIAppControlResponseListener.h>
#include <FBaseColHashMap.h>
#include <FBaseSysLog.h>
#include "FApp_AppControlImpl.h"
#include "FApp_AppControlManager.h"
#include "FApp_AppArg.h"
-#include "FApp_AppImpl.h"
#include "FApp_AppControlRegistry.h"
#include "FApp_AppMessageImpl.h"
#include "FApp_AppInfo.h"
namespace Tizen { namespace App
{
+class IAppControlEventListener;
+class IAppControlResponseListener;
+
const wchar_t TIZEN_OPERATION_MAIN[] = L"http://tizen.org/appcontrol/operation/main";
-const char TIZEN_APPCONTROL_DATA_LEGACY[] = "http://tizen.org/appcontrol/data/legacyresult";
_AppControlImpl::_AppControlImpl(const AppControl& value)
: _appControl(value)
SysTryReturnResult(NID_APP, b != NULL, E_SYSTEM, "Invalid result bundle.");
IAppControlEventListener* pListener = static_cast<IAppControlEventListener*>(data);
- SysTryReturnResult(NID_APP, typeid(pListener) == typeid(IAppControlEventListener*), E_SYSTEM, "Invalid result callback");
+ SysTryReturnResult(NID_APP, pListener == null || typeid(pListener) == typeid(IAppControlEventListener*), E_SYSTEM, "Invalid result callback");
bundle* inb = pArg->GetBundle();
SysTryReturnResult(NID_APP, inb != NULL, E_SYSTEM, "Empty caller bundle.");
ArrayList list(SingleObjectDeleter);
_AppArg::FillLegacyAppControlResult(list, res, pMap.get(), provider);
- // proper callback invokation
- pListener->OnAppControlCompleted(provider, oId, &list);
+ _AppControlManager::InvokeLegacyAppControlCompleteListener(*pListener, provider, oId, &list);
return E_SUCCESS;
}
SysTryReturnResult(NID_APP, b != NULL, E_SYSTEM, "Invalid result bundle.");
IAppControlResponseListener* pListener = static_cast<IAppControlResponseListener*>(data);
- SysTryReturnResult(NID_APP, typeid(pListener) == typeid(IAppControlResponseListener*), E_SYSTEM, "Invalid result callback");
+ SysTryReturnResult(NID_APP, pListener == null || typeid(pListener) == typeid(IAppControlResponseListener*), E_SYSTEM, "Invalid result callback");
bundle* inb = pArg->GetBundle();
SysTryReturnResult(NID_APP, inb != NULL, E_SYSTEM, "Empty caller bundle.");
}
else
{
- pListener->OnAppControlCompleteResponseReceived(provider, oId, ret, pMap.get());
- SysLog(NID_APP, "OnAppControlCompleteResponseReceived, Called");
+ _AppControlManager::InvokeAppControlCompleteListener(*pListener, provider, oId, ret, pMap.get());
}
return E_SUCCESS;
{
if(pEventArg->GetType() == _APPCONTROL_RESPONSETYPE_COMPLETE)
{
- pResponseListener->OnAppControlCompleteResponseReceived(pEventArg->GetAppId(), pEventArg->GetOperationId(), pEventArg->GetAppControlResult(), pEventArg->GetExtraData());
- SysLog(NID_APP, "OnAppControlCompleteResponseReceived called");
+ _AppControlManager::InvokeAppControlCompleteListener(*pResponseListener, pEventArg->GetAppId(), pEventArg->GetOperationId(), pEventArg->GetAppControlResult(), pEventArg->GetExtraData());
_AppControlResponseEvent* pResponseEvent = null;
_AppControlManager::GetInstance()->GetAppControlResponseEventContainer()->GetValue(pEventArg->GetRequestId(), pResponseEvent);
}
+void
+_AppControlManager::InvokeAppControlCompleteListener(IAppControlResponseListener& listener, const AppId& appId, const String& op, AppCtrlResult res, const IMap* pExtraData)
+{
+ listener.OnAppControlCompleteResponseReceived(appId, op, res, pExtraData);
+
+ _AppImpl::GetInstance()->RaiseWindow();
+
+ SysLog(NID_APP, "AppControl response finished.");
+}
+
+
+void
+_AppControlManager::InvokeLegacyAppControlCompleteListener(IAppControlEventListener& listener, const AppId& appId, const String& op, const IList* pList)
+{
+ listener.OnAppControlCompleted(appId, op, pList);
+
+ _AppImpl::GetInstance()->RaiseWindow();
+ SysLog(NID_APP, "Legacy AppControl response finished.");
+}
+
+
// callback for in-process event handling
void
_AppControlManager::OnAppControlEventReceivedN(int reqId, int res, const IMap* pArgs)
ArrayList list(SingleObjectDeleter);
_AppArg::FillLegacyAppControlResult(list, res, pArgs, aId);
- pListener->OnAppControlCompleted(aId, oId, &list);
+ InvokeLegacyAppControlCompleteListener(*pListener, aId, oId, &list);
}
else
{
}
else
{
- pListener->OnAppControlCompleteResponseReceived(aId, oId, ConvertAppControlResultCode(res), pArgs);
- SysLog(NID_APP, "OnAppControlCompleteResponseReceived called directly");
- IMap* pMap = const_cast<IMap*> (pArgs);
- delete pMap;
+ InvokeAppControlCompleteListener(*pListener, aId, oId, ConvertAppControlResultCode(res), pArgs);
+ SysLog(NID_APP, "Listener called directly");
+ delete pArgs;
}
}
else
}
else
{
- pResponseListener->OnAppControlCompleteResponseReceived(pEventArg->GetAppId(), pEventArg->GetOperationId(), pEventArg->GetAppControlResult(), pEventArg->GetExtraData());
- SysLog(NID_APP, "OnAppControlCompleteResponseReceived called");
+ InvokeAppControlCompleteListener(*pResponseListener, pEventArg->GetAppId(), pEventArg->GetOperationId(), pEventArg->GetAppControlResult(), pEventArg->GetExtraData());
+ SysLog(NID_APP, "Listener called");
_AppControlResponseEvent* pResponseEvent = null;
_AppControlManager::GetInstance()->GetAppControlResponseEventContainer()->GetValue(pEventArg->GetRequestId(), pResponseEvent);
state_handler.low_memory = &OnLowMemory;
state_handler.low_battery = NULL;
state_handler.language_changed = &OnLanguageChanged;
- state_handler.region_format_changed = &OnRegionFormatChanged;
+ state_handler.region_format_changed = NULL;
_Aul::SetPowerOffNotiListener(OnPowerOffNotiReceived, this);
// if (pAppManager != null)
SysLog(NID_APP, "Language change done.");
}
-void
-_AppImpl::OnRegionFormatChanged(void* user_data)
-{
- // Osp doesn't implement this callback.
-}
-
result
_AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs)
void
+_AppImpl::RaiseWindow(void)
+{
+ SysTryReturnVoidResult(NID_APP, __pIAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
+
+ __pIAppImpl->OnFrameRaiseRequested();
+}
+
+
+void
_AppImpl::OnAppCheckpoint(void)
{
if (__pCheckpointEventListener)
using namespace Tizen::Io;
using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
namespace Tizen { namespace App
{
}
-void
-_ServiceAppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation)
+long
+_ServiceAppImpl::OnWindowHandleRequest(void)
{
- SysLog(NID_APP, "System device orientation changed event on 0x%x state", _AppInfo::GetAppState());
+ return -1;
}
-long
-_ServiceAppImpl::OnWindowHandleRequest(void)
+result
+_ServiceAppImpl::OnFrameRaiseRequested(void)
{
- return -1;
+ return E_SUCCESS;
}
+
_ServiceAppImpl*
_ServiceAppImpl::GetInstance(void)
{
return __pServiceApp;
}
+
bool
_ServiceAppImpl::OnAppInitializing(void)
{
#include <FBaseRtIEventListener.h>
#include <FAppAppManager.h>
#include <FAppIAppControlEventListener.h>
+#include <FAppIAppControlResponseListener.h>
#include <FBaseSysLog.h>
#include "FApp_Types.h"
static AppCtrlResult ConvertAppControlResultCode(int res);
+ static void InvokeAppControlCompleteListener(IAppControlResponseListener& listener, const AppId& appId, const Tizen::Base::String& op, AppCtrlResult res, const Tizen::Base::Collection::IMap* pExtraData);
+
+ static void InvokeLegacyAppControlCompleteListener(IAppControlEventListener& listener, const AppId& appId, const Tizen::Base::String& op, const Tizen::Base::Collection::IList* pList);
+
private:
_OSP_LOCAL_ _AppControlManager(void);
/**
* @class _AppImpl
* @brief This class is the Impl class of a App class.
- * @since 2.1
*
* This class is the Impl class of a App class.
*/
/**
* Initializes this instance of _AppImpl with the specified arguments
*
- * @since 2.1
* @return An error code
* @param[in] pArgs A pointer to the list that contains the String instances of launch arguments
* @exception E_SUCCESS The method is successful.
* Executes an application implemented by inheriting App class.
* This method must be called from the UiApp or ServiceApp.
*
- * @since 2.1
* @return An error code
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG A specified input parameter is invalid.
/**
* Returns the _AppImpl's instance pointer.
*
- * @since 2.1
* @return A pointer to the %_AppImpl instance, @n
* else @c null if it fails
*/
/**
* Returns the App's instance pointer.
*
- * @since 2.1
* @return A pointer to the %App instance, @n
* else @c null if it fails
*/
/**
* Returns the status of the termination request
*
- * @since 2.1
* @return @c true if the termination is requested, @n
* else @c false
*/
/**
* Called when the application is started
*
- * @since 2.1
* @return @c true if the method is successful, @n
* else @c false
* @param[in] user_data The user data passed from the callback registration function
/**
* Called when other application send the launch request to the application
*
- * @since 2.1
* @param[in] service The handle to the service
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
/**
* Called when the application is completely obscured by another application and becomes invisible
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
/**
* Called when the application becomes visible
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
/**
* Called once after the main loop of application exits
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
/**
* Called when the system memory is running low
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
/**
* Called when language setting changes
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
static void OnLanguageChanged(void* user_data);
/**
- * Called when region format setting changes
- *
- * @since 2.1
- * @param[in] user_data The user data passed from the callback registration function
- * @remarks This is a system dependent callback function
- */
- static void OnRegionFormatChanged(void* user_data);
-
- /**
* Set Listener
*
- * @since 2.1
* @return An error code
* @param[in] appEvent _AppEvent event type
* @param[in] pListener Listener to set
* After this method succeeds, the application's state changes to Tizen::App::AppState::RUNNING.
* If the method fails, the application's state changes to Tizen::App::AppState::TERMINATING and call OnAppTerminating() subsequently.
*
- * @since 2.1
* @return @c true if the method is successful, @n
* else @c false
*/
/**
* Called when a checkpoint event occurs
- *
- * @since 2.1
*/
void OnAppCheckpoint(void);
/**
* Registers app request
*
- * @since 2.1
* @return An error code
* @param[in] service service handle
* @param[out] req request number
/**
* Gets the window handle if exists.
- *
- * @since 2.1
*/
long GetWindowHandle(void) const;
+ /**
+ * Raises the window if possible
+ */
+ void RaiseWindow(void);
void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
private:
/**
* This is the default constructor for this class.
- *
- * @since 2.1
*/
_AppImpl(void);
/**
* This is the constructor for this class.
- *
- * @since 2.1
*/
_AppImpl(App* pApp);
/**
* This is the destructor for this class.
- *
- * @since 2.1
*/
virtual ~_AppImpl(void);
/**
* Gets the list of the launch arguments. @n
*
- * @since 2.1
* @return A pointer to the list that contains the String instances of launch arguments
*/
Tizen::Base::Collection::IList* GetAppArgumentListN(void) const;
* Terminates the application while it is running. @n
* The OnAppTerminating() method is called after this method is executed successfully.
*
- * @since 2.1
* @return An error code
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state.
* After this method succeeds, the application's state changes to Tizen::App::AppState::RUNNING.
* If the method fails, the application's state changes to Tizen::App::AppState::TERMINATING and call OnAppTerminating() subsequently.
*
- * @since 2.1
* @return @c true if the method is successful, @n
* else @c false
*/
* Return @c false if you don't want your application to terminate. @n
* If the method returns @c true, the application's state changes to Tizen::App::AppState::TERMINATING and call OnAppTerminating() subsequently.
*
- * @since 2.1
* @return @c true if the method is successful, @n
* else @c false
*/
/**
* Sends the user event to the application itself and not to other application.
*
- * @since 2.1
* @return An error code
* @param[in] requestId The user defined event ID
* @param[in] pArgs A pointer to an argument list of type String
* Called asynchronously when the user event is sent by the SendUserEvent() method. @n
* The request ID and argument format for the user event can be defined as per the requirement.
*
- * @since 2.1
* @param[in] requestId The user defined event ID
* @param[in] pArgs A pointer to an argument list of type String
*/
/**
* Called asynchronously when AppControl provider event is received.
- *
- * @since 2.1
*/
void OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId);
/**
* Called asynchronously when DataControl provider event is received.
*
- * @since 2.1
* @param[in] arg The launch argument
*/
void OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId);
/**
* Called asynchronously when conditional app launch event is received.
- *
- * @since 2.1
*/
void OnConditionRequestReceived(const _AppArg& arg, RequestId reqId);
/**
* Handles AppControl/DataControl request
*
- * @since 2.1
* @return An error code
* @exception E_SUCCESS The method is succesful.
*/
/**
* Handles legacy UserEvent request
*
- * @since 2.1
* @return An error code
* @exception E_SUCCESS The method is succesful.
*/
/**
* Dummy implementation for app event request
*
- * @since 2.1
* @return An error code
* @exception E_SUCCESS The method is successful.
*/
/**
* Set legacy app service handler
*
- * @since 2.1
* @return An error code
* @exception E_SUCCESS The method is successful.
*/
/**
* Called when the application is started
*
- * @since 2.1
* @return @c true if the method is successful, @n
* else @c false
* @param[in] user_data The user data passed from the callback registration function
/**
* Called when the application's state changes to INITIALIZING
*
- * @since 2.1
* @return @c true if the method is successful, @n
* else @c false
*/
/**
* Called when the application's INITIALIZING state is finished
*
- * @since 2.1
* @return @c true if the method is successful, @n
* else @c false
*/
/**
* Called when other application send the launch request to the application
*
- * @since 2.1
* @param[in] service The handle to the service
* @param[in] initial initial launch
* @param[in] user_data The user data passed from the callback registration function
/**
* Called when the application is completely obscured by another application and becomes invisible
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
/**
* Called when the application becomes visible
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
/**
* Called once after the main loop of application exits
*
- * @since 2.1
* @param[in] user_data The user data passed from the callback registration function
* @remarks This is a system dependent callback function
*/
virtual void OnTerminate(void) = 0;
/**
- * Called when an orintation event occurs.
- *
- * @since 2.1
- * @param[in] orientation The information about the orientation event
+ * Called when the window is requested to be raised
*/
- virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation) = 0;
+ virtual result OnFrameRaiseRequested(void) = 0;
/**
* Called when the internal window handle is required.
- *
- * @since 2.1
*/
virtual long OnWindowHandleRequest(void) = 0;
};
virtual void OnTerminate(void);
/**
- * Called when an orintation event occurs.
- *
- * @since 2.1
- * @param[in] orientation The information about the orientation event
- */
- virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation);
-
- /**
* Called when the application's state changes to Tizen::App::AppState::INITIALIZING. @n
*
* @since 2.1
virtual long OnWindowHandleRequest(void);
/**
+ * Called when the window is requested to be raised.
+ */
+ virtual result OnFrameRaiseRequested(void);
+
+ /**
* Called when the application's state change to Tizen::App::AppState::TERMINATING. @n
*
* @since 2.1
_OSP_LOCAL_ extern const wchar_t LEGACY_LAUNCH_REASON_CONDITIONAL[];
_OSP_LOCAL_ extern const wchar_t TIZEN_OPERATION_MAIN[];
_OSP_EXPORT_ extern const wchar_t TIZEN_OPERATION_PICK[];
-_OSP_LOCAL_ extern const char TIZEN_APPCONTROL_DATA_LEGACY[];
_OSP_LOCAL_ extern const char TIZEN_NOTIFICATION_DATA[];
} } // Tizen::App