diff options
author | Andriy Byzhynar <abyzhynar@luxoft.com> | 2019-07-10 18:21:27 +0300 |
---|---|---|
committer | Andriy Byzhynar (GitHub) <AByzhynar@luxoft.com> | 2019-08-20 21:17:13 +0300 |
commit | 1febd81713ac41bf869d82d7bf8f487306d3621b (patch) | |
tree | 5900671aa5fb336ae0d71ecc68539c367de6b46d /src | |
parent | 3fa26cf5a0011a241ccb91da1c8a02dcfd75a75f (diff) | |
download | sdl_core-1febd81713ac41bf869d82d7bf8f487306d3621b.tar.gz |
Update application and its dependencies
Updated application interface and its implementation
Updated application state and its implementation
Updated Smart object keys
Diffstat (limited to 'src')
48 files changed, 1161 insertions, 416 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index 72122ff3ec..1ab0ddafec 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -146,6 +146,12 @@ typedef std::map<uint32_t, smart_objects::SmartObject*> SubMenuMap; typedef std::map<uint32_t, smart_objects::SmartObject*> ChoiceSetMap; /* + * @brief Typedef for map of window ids to data used as parameters + * to CreateWindow request. + */ +typedef std::map<WindowID, smart_objects::SmartObjectSPtr> WindowParamsMap; + +/* * @brief Typedef for perform interaction choice * @param choice id * @param SmartObject choice @@ -188,9 +194,16 @@ class DynamicApplicationData { virtual const smart_objects::SmartObject* keyboard_props() const = 0; virtual const smart_objects::SmartObject* menu_title() const = 0; virtual const smart_objects::SmartObject* menu_icon() const = 0; - virtual const smart_objects::SmartObject* day_color_scheme() const = 0; - virtual const smart_objects::SmartObject* night_color_scheme() const = 0; - virtual const std::string& display_layout() const = 0; + virtual smart_objects::SmartObject day_color_scheme() const = 0; + virtual smart_objects::SmartObject night_color_scheme() const = 0; + virtual std::string display_layout() const = 0; + + /** + * @brief Specific display capabilities of application + * @return display capabilities of application or NULL-initialized pointer if + * not specified + */ + virtual smart_objects::SmartObjectSPtr display_capabilities() const = 0; virtual void load_global_properties(const smart_objects::SmartObject& so) = 0; virtual void set_help_prompt( @@ -222,12 +235,71 @@ class DynamicApplicationData { virtual void set_video_stream_retry_number( const uint32_t& video_stream_retry_number) = 0; + virtual void set_display_layout(const std::string& layout) = 0; virtual void set_day_color_scheme( const smart_objects::SmartObject& color_scheme) = 0; virtual void set_night_color_scheme( const smart_objects::SmartObject& color_scheme) = 0; - virtual void set_display_layout(const std::string& layout) = 0; + /** + * @brief Set specific application display capabilities + * @param display_capabilities new display capabilities of application + */ + virtual void set_display_capabilities( + const smart_objects::SmartObject& display_capabilities) = 0; + + /** + * @brief Sets layout for application's specific window + * @param window_id window id for which layout should be set + * @param layout - layout to be set + */ + virtual void set_window_layout(const WindowID window_id, + const std::string& layout) = 0; + + /** + * @brief Sets day color scheme for application's specific window + * @param window_id window id for which day color scheme should be set + * @param color_scheme - color scheme to be set + */ + virtual void set_day_color_scheme( + const WindowID window_id, + const smart_objects::SmartObject& color_scheme) = 0; + + /** + * @brief Sets night color scheme for application's specific window + * @param window_id window id for which night color scheme should be set + * @param color_scheme - color scheme to be set + */ + virtual void set_night_color_scheme( + const WindowID window_id, + const smart_objects::SmartObject& color_scheme) = 0; + + /** + * @brief Gets window layout for application's specific window_id + * @param window_id window id for which display layout should be returned + * @return string containing set display layout, + * if no display layout is set - empty string is returned + */ + virtual std::string window_layout(const WindowID window_id) const = 0; + + /** + * @brief Gets day color scheme for application's specific window_id + * @param window_id window id for which color scheme should be returned + * @return day color scheme which is set for specified app window, + * if no day color scheme is set - Smart object with NullType is returned + */ + virtual smart_objects::SmartObject day_color_scheme( + const WindowID window_id) const = 0; + + /** + * @brief Gets night color scheme for application's specific window_id + * @param window_id window id for which color scheme should be returned + * @return night color scheme which is set for specified app window + * if no night color scheme is set - Smart object with NullType is returned + */ + virtual smart_objects::SmartObject night_color_scheme( + const WindowID window_id) const = 0; + /** * @brief Checks if application is media, voice communication or navigation * @return true if application is media, voice communication or navigation, @@ -290,6 +362,20 @@ class DynamicApplicationData { virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0; /* + * @brief Adds window info + * @param window_id unique id of a window + * @param window_info SmartObject that represent window info + */ + virtual void AddWindowInfo(const WindowID window_id, + const smart_objects::SmartObject& window_info) = 0; + + /* + * @brief Removes window info + * @param window_id unique id of a window + */ + virtual void RemoveWindowInfo(const WindowID window_id) = 0; + + /* * @brief Finds choice set with the specified choice_set_id id * * @param choice_set_id Unique ID of the interaction choice set @@ -324,6 +410,11 @@ class DynamicApplicationData { const = 0; /* + * @brief Retrieves window info map + */ + virtual DataAccessor<WindowParamsMap> window_optional_params_map() const = 0; + + /* * @brief Retrieve application commands */ virtual DataAccessor<CommandsMap> commands_map() const = 0; @@ -545,11 +636,26 @@ class Application : public virtual InitialApplicationData, virtual bool is_media_application() const = 0; virtual bool is_foreground() const = 0; virtual void set_foreground(const bool is_foreground) = 0; - virtual const mobile_api::HMILevel::eType hmi_level() const = 0; + + /** + * @brief hmi_level current HMI level of application's window + * @param window_id id of application's window to get + * @return HMI level of application's window + */ + virtual const mobile_api::HMILevel::eType hmi_level( + const WindowID window_id) const = 0; + virtual const uint32_t put_file_in_none_count() const = 0; virtual const uint32_t delete_file_in_none_count() const = 0; virtual const uint32_t list_files_in_none_count() const = 0; - virtual const mobile_api::SystemContext::eType system_context() const = 0; + + /** + * @brief system_context current system context of application's window + * @param window_id id of application's window to get + * @return system context of application's window + */ + virtual const mobile_api::SystemContext::eType system_context( + const WindowID window_id) const = 0; virtual const mobile_api::AudioStreamingState::eType audio_streaming_state() const = 0; virtual const mobile_api::VideoStreamingState::eType video_streaming_state() @@ -694,58 +800,91 @@ class Application : public virtual InitialApplicationData, /** * @brief SetInitialState sets initial HMI state for application on * registration + * @param window_id window id for HMI state + * @param window_name name of inited window * @param state Hmi state value */ - virtual void SetInitialState(HmiStatePtr state) = 0; + virtual void SetInitialState(const WindowID window_id, + const std::string& window_name, + HmiStatePtr state) = 0; /** * @brief SetRegularState set permanent state of application - * + * @param window_id window id for HMI state * @param state state to setup */ - virtual void SetRegularState(HmiStatePtr state) = 0; + virtual void SetRegularState(const WindowID window_id, HmiStatePtr state) = 0; /** * @brief SetPostponedState sets postponed state to application. * This state could be set as regular later - * + * @param window_id window id for HMI state * @param state state to setup */ - virtual void SetPostponedState(HmiStatePtr state) = 0; + virtual void SetPostponedState(const WindowID window_id, + HmiStatePtr state) = 0; - virtual void RemovePostponedState() = 0; + /** + * @brief RemovePostponedState removes postponed state for application + * After removal, this state will not be set as regular later + * @param window_id window id for HMI state + */ + virtual void RemovePostponedState(const WindowID window_id) = 0; /** * @brief AddHMIState the function that will change application's * hmi state. * - * @param app_id id of the application whose hmi level should be changed. + * @param window_id window id for HMI state * * @param state new hmi state for certain application. */ - virtual void AddHMIState(HmiStatePtr state) = 0; + virtual void AddHMIState(const WindowID window_id, HmiStatePtr state) = 0; /** * @brief RemoveHMIState the function that will turn back hmi_level after end * of some event * - * @param app_id id of the application whose hmi level should be changed. + * @param window_id window id for HMI state * * @param state_id that should be removed */ - virtual void RemoveHMIState(HmiState::StateID state_id) = 0; + virtual void RemoveHMIState(const WindowID window_id, + HmiState::StateID state_id) = 0; /** * @brief HmiState of application within active events PhoneCall, TTS< etc ... + * @param window_id window id for HMI state * @return Active HmiState of application */ - virtual const HmiStatePtr CurrentHmiState() const = 0; + virtual const HmiStatePtr CurrentHmiState(const WindowID window_id) const = 0; + + /** + * @brief Getter for a list of available application windows including the + * main + * @return list of available window IDs created by application + */ + virtual WindowIds GetWindowIds() const = 0; + + /** + * @brief Getter for a list of all existing window names + * @return list of available window names created by application + */ + virtual WindowNames GetWindowNames() const = 0; + + /** + * @brief Check if application has specified window + * @param window_id - id of window to check + * @return true if app has specified window , otherwise false + */ + virtual bool WindowIdExists(const WindowID window_id) const = 0; /** * @brief RegularHmiState of application without active events VR, TTS etc ... + * @param window_id window id for HMI state * @return HmiState of application */ - virtual const HmiStatePtr RegularHmiState() const = 0; + virtual const HmiStatePtr RegularHmiState(const WindowID window_id) const = 0; /** * @brief Checks if app is allowed to change audio source @@ -756,10 +895,11 @@ class Application : public virtual InitialApplicationData, /** * @brief PostponedHmiState returns postponed hmi state of application * if it's present - * + * @param window_id window id for HMI state * @return Postponed hmi state of application */ - virtual const HmiStatePtr PostponedHmiState() const = 0; + virtual const HmiStatePtr PostponedHmiState( + const WindowID window_id) const = 0; /** * @brief Keeps id of softbuttons which is created in commands: @@ -901,9 +1041,11 @@ class Application : public virtual InitialApplicationData, /** * @brief set_system_context Set system context for application + * @param window_id window id for HMI state * @param system_context Current context */ virtual void set_system_context( + const WindowID window_id, const mobile_api::SystemContext::eType& system_context) = 0; /** @@ -915,9 +1057,11 @@ class Application : public virtual InitialApplicationData, /** * @brief set_hmi_level Set HMI level for application + * @param window_id window id for HMI state * @param hmi_level Current HMI level */ - virtual void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) = 0; + virtual void set_hmi_level(const WindowID window_id, + const mobile_api::HMILevel::eType& hmi_level) = 0; /** * @brief Return pointer to extension by uid diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h index 7852d6805b..ebd2797065 100644 --- a/src/components/application_manager/include/application_manager/application_data_impl.h +++ b/src/components/application_manager/include/application_manager/application_data_impl.h @@ -88,6 +88,7 @@ class InitialApplicationDataImpl : public virtual Application { class DynamicApplicationDataImpl : public virtual Application { public: + typedef std::map<WindowID, smart_objects::SmartObject> AppWindowsTemplates; DynamicApplicationDataImpl(); ~DynamicApplicationDataImpl(); const smart_objects::SmartObject* help_prompt() const; @@ -100,9 +101,29 @@ class DynamicApplicationDataImpl : public virtual Application { const smart_objects::SmartObject* keyboard_props() const; const smart_objects::SmartObject* menu_title() const; const smart_objects::SmartObject* menu_icon() const; - const smart_objects::SmartObject* day_color_scheme() const; - const smart_objects::SmartObject* night_color_scheme() const; - const std::string& display_layout() const; + + smart_objects::SmartObject day_color_scheme() const OVERRIDE; + smart_objects::SmartObject night_color_scheme() const OVERRIDE; + std::string display_layout() const OVERRIDE; + smart_objects::SmartObjectSPtr display_capabilities() const OVERRIDE; + + void set_window_layout(const WindowID window_id, + const std::string& layout) OVERRIDE; + + void set_day_color_scheme( + const WindowID window_id, + const smart_objects::SmartObject& color_scheme) OVERRIDE; + void set_night_color_scheme( + const WindowID window_id, + const smart_objects::SmartObject& color_scheme) OVERRIDE; + + std::string window_layout(const WindowID window_id) const OVERRIDE; + + smart_objects::SmartObject day_color_scheme( + const WindowID window_id) const OVERRIDE; + + smart_objects::SmartObject night_color_scheme( + const WindowID window_id) const OVERRIDE; void load_global_properties(const smart_objects::SmartObject& properties_so); void set_help_prompt(const smart_objects::SmartObject& help_prompt); @@ -120,6 +141,8 @@ class DynamicApplicationDataImpl : public virtual Application { void set_day_color_scheme(const smart_objects::SmartObject& color_scheme); void set_night_color_scheme(const smart_objects::SmartObject& color_scheme); void set_display_layout(const std::string& layout); + void set_display_capabilities( + const smart_objects::SmartObject& display_capabilities) OVERRIDE; /* * @brief Adds a command to the in application menu */ @@ -156,6 +179,11 @@ class DynamicApplicationDataImpl : public virtual Application { */ bool IsSubMenuNameAlreadyExist(const std::string& name); + void AddWindowInfo(const WindowID window_id, + const smart_objects::SmartObject& window_info) OVERRIDE; + + void RemoveWindowInfo(const WindowID window_id) OVERRIDE; + /* * @brief Adds a interaction choice set to the application * @@ -221,6 +249,8 @@ class DynamicApplicationDataImpl : public virtual Application { */ inline DataAccessor<ChoiceSetMap> choice_set_map() const; + DataAccessor<WindowParamsMap> window_optional_params_map() const; + /* * @brief Sets perform interaction state * @@ -274,9 +304,8 @@ class DynamicApplicationDataImpl : public virtual Application { smart_objects::SmartObject* menu_title_; smart_objects::SmartObject* menu_icon_; smart_objects::SmartObject* tbt_show_command_; - smart_objects::SmartObject* day_color_scheme_; - smart_objects::SmartObject* night_color_scheme_; - std::string display_layout_; + smart_objects::SmartObjectSPtr display_capabilities_; + AppWindowsTemplates window_templates_; CommandsMap commands_; mutable std::shared_ptr<sync_primitives::RecursiveLock> commands_lock_ptr_; @@ -287,6 +316,8 @@ class DynamicApplicationDataImpl : public virtual Application { PerformChoiceSetMap performinteraction_choice_set_map_; mutable std::shared_ptr<sync_primitives::RecursiveLock> performinteraction_choice_set_lock_ptr_; + WindowParamsMap window_params_map_; + mutable std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_; uint32_t is_perform_interaction_active_; bool is_reset_global_properties_active_; int32_t perform_interaction_mode_; diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index fd9b77eb0f..2d9ff2b9c5 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -158,11 +158,13 @@ class ApplicationImpl : public virtual Application, bool is_media_application() const; bool is_foreground() const OVERRIDE; void set_foreground(const bool is_foreground) OVERRIDE; - const mobile_apis::HMILevel::eType hmi_level() const; + const mobile_apis::HMILevel::eType hmi_level( + const WindowID window_id) const OVERRIDE; const uint32_t put_file_in_none_count() const; const uint32_t delete_file_in_none_count() const; const uint32_t list_files_in_none_count() const; - const mobile_api::SystemContext::eType system_context() const; + const mobile_api::SystemContext::eType system_context( + const WindowID window_id) const OVERRIDE; inline const mobile_apis::AudioStreamingState::eType audio_streaming_state() const; inline const mobile_apis::VideoStreamingState::eType video_streaming_state() @@ -299,26 +301,35 @@ class ApplicationImpl : public virtual Application, /** * @brief SetInitialState sets initial HMI state for application on * registration + * @param window_id window id for HMI state + * @param window_name name of inited window * @param state Hmi state value */ - void SetInitialState(HmiStatePtr state) FINAL; + void SetInitialState(const WindowID window_id, + const std::string& window_name, + HmiStatePtr state) FINAL; /** * @brief SetRegularState set permanent state of application - * + * @param window_id window id for HMI state * @param state state to setup */ - virtual void SetRegularState(HmiStatePtr state); + void SetRegularState(const WindowID window_id, HmiStatePtr state) FINAL; /** * @brief SetPostponedState sets postponed state to application. * This state could be set as regular later - * + * @param window_id window id for HMI state * @param state state to setup */ - virtual void SetPostponedState(HmiStatePtr state); + void SetPostponedState(const WindowID window_id, HmiStatePtr state) FINAL; - virtual void RemovePostponedState(); + /** + * @brief RemovePostponedState removes postponed state for application + * After removal, this state will not be set as regular later + * @param window_id window id for HMI state + */ + void RemovePostponedState(const WindowID window_id) FINAL; /** * @brief AddHMIState the function that will change application's @@ -328,7 +339,7 @@ class ApplicationImpl : public virtual Application, * * @param state new hmi state for certain application. */ - virtual void AddHMIState(HmiStatePtr state); + void AddHMIState(const WindowID window_id, HmiStatePtr state) FINAL; /** * @brief RemoveHMIState the function that will turn back hmi_level after end @@ -338,13 +349,20 @@ class ApplicationImpl : public virtual Application, * * @param state_id that should be removed */ - virtual void RemoveHMIState(HmiState::StateID state_id); + void RemoveHMIState(const WindowID window_id, + HmiState::StateID state_id) FINAL; /** * @brief HmiState of application within active events PhoneCall, TTS< etc ... * @return Active HmiState of application */ - virtual const HmiStatePtr CurrentHmiState() const; + const HmiStatePtr CurrentHmiState(const WindowID window_i) const FINAL; + + WindowNames GetWindowNames() const FINAL; + + WindowIds GetWindowIds() const FINAL; + + bool WindowIdExists(const WindowID window_id) const FINAL; /** * @brief Checks if app is allowed to change audio source @@ -356,7 +374,7 @@ class ApplicationImpl : public virtual Application, * @brief RegularHmiState of application without active events VR, TTS etc ... * @return HmiState of application */ - virtual const HmiStatePtr RegularHmiState() const; + const HmiStatePtr RegularHmiState(const WindowID window_id) const FINAL; /** * @brief PostponedHmiState returns postponed hmi state of application @@ -364,7 +382,7 @@ class ApplicationImpl : public virtual Application, * * @return Postponed hmi state of application */ - virtual const HmiStatePtr PostponedHmiState() const; + const HmiStatePtr PostponedHmiState(const WindowID window_id) const FINAL; uint32_t audio_stream_retry_number() const; @@ -391,6 +409,7 @@ class ApplicationImpl : public virtual Application, * @param system_context new system context */ void set_system_context( + const WindowID window_id, const mobile_api::SystemContext::eType& system_context) OVERRIDE; /** * @brief Sets current audio streaming state @@ -402,7 +421,8 @@ class ApplicationImpl : public virtual Application, * @brief Sets current HMI level * @param hmi_level new HMI level */ - void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) OVERRIDE; + void set_hmi_level(const WindowID window_id, + const mobile_api::HMILevel::eType& hmi_level) OVERRIDE; void PushMobileMessage( smart_objects::SmartObjectSPtr mobile_message) OVERRIDE; @@ -632,7 +652,8 @@ uint32_t ApplicationImpl::app_id() const { const mobile_api::AudioStreamingState::eType ApplicationImpl::audio_streaming_state() const { using namespace mobile_apis; - const HmiStatePtr hmi_state = CurrentHmiState(); + const HmiStatePtr hmi_state = + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); return hmi_state ? hmi_state->audio_streaming_state() : AudioStreamingState::INVALID_ENUM; } @@ -640,7 +661,8 @@ ApplicationImpl::audio_streaming_state() const { const mobile_api::VideoStreamingState::eType ApplicationImpl::video_streaming_state() const { using namespace mobile_apis; - const HmiStatePtr hmi_state = CurrentHmiState(); + const HmiStatePtr hmi_state = + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); return hmi_state ? hmi_state->video_streaming_state() : VideoStreamingState::INVALID_ENUM; } diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index add099f975..9b26d7b599 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -476,6 +476,7 @@ class ApplicationManagerImpl /** * @brief CreateRegularState create regular HMI state for application * @param app Application + * @param window_type type of window * @param hmi_level of returned state * @param audio_state of returned state * @param system_context of returned state @@ -483,10 +484,11 @@ class ApplicationManagerImpl */ HmiStatePtr CreateRegularState( std::shared_ptr<Application> app, - mobile_apis::HMILevel::eType hmi_level, - mobile_apis::AudioStreamingState::eType audio_state, - mobile_apis::VideoStreamingState::eType video_state, - mobile_apis::SystemContext::eType system_context) const OVERRIDE; + const mobile_apis::WindowType::eType window_type, + const mobile_apis::HMILevel::eType hmi_level, + const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::VideoStreamingState::eType video_state, + const mobile_apis::SystemContext::eType system_context) const OVERRIDE; /** * @brief Checks, if given RPC is allowed at current HMI level for specific diff --git a/src/components/application_manager/include/application_manager/application_state.h b/src/components/application_manager/include/application_manager/application_state.h index d708a6188d..8c4d2d49d6 100644 --- a/src/components/application_manager/include/application_manager/application_state.h +++ b/src/components/application_manager/include/application_manager/application_state.h @@ -32,14 +32,21 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_ + +#include <map> #include <vector> + #include "application_manager/hmi_state.h" #include "utils/lock.h" #include "utils/macro.h" namespace application_manager { +typedef std::vector<WindowID> WindowIds; typedef std::vector<HmiStatePtr> HmiStates; +typedef std::map<WindowID, HmiStates> HmiStatesMap; +typedef std::vector<std::string> WindowNames; +typedef std::map<WindowID, std::string> WindowNamesMap; /* * Class represents application state, i.e. current HMI level, audio streaming @@ -63,94 +70,137 @@ class ApplicationState { /** * @brief Init state + * @param window_id window id for HMI state + * @param window_name name of inited window * @param state Initial state */ - void InitState(HmiStatePtr state); + void InitState(const WindowID window_id, + const std::string& window_name, + HmiStatePtr state); /** * @brief Adds state to states storage + * @param window_id window id for HMI state * @param state State of application */ - void AddState(HmiStatePtr state); + void AddState(const WindowID window_id, HmiStatePtr state); /** * @brief Removes state from states storage + * @param window_id window id for HMI state * @param state State of application */ - void RemoveState(HmiState::StateID state); + void RemoveState(const WindowID window_id, HmiState::StateID state); /** * @brief Gets state by state id + * @param window_id window id for HMI state * @param state_id State id * @return Pointer to application state */ - HmiStatePtr GetState(HmiState::StateID state_id) const; + HmiStatePtr GetState(const WindowID window_id, + HmiState::StateID state_id) const; + + /** + * @brief Gets the list of all states matches provided state id + * @param state_id state id to get + * @return list of all states matches provided state id + */ + HmiStates GetStates(const HmiState::StateID state_id) const; + + /** + * @brief Getter for a list of available application windows including the + * main + * @return list of available window ids + */ + WindowIds GetWindowIds() const; + + /** + * @brief Getter f0r a list of all existing window names + * @return list of available window names + */ + WindowNames GetWindowNames() const; private: /** * @brief AddHMIState the function that will change application's * hmi state. * - * @param app_id id of the application whose hmi level should be changed. + * @param window_id window id for HMI state * * @param state new hmi state for certain application. */ - void AddHMIState(HmiStatePtr state); + void AddHMIState(const WindowID window_id, HmiStatePtr state); /** * @brief RemoveHMIState the function that will turn back hmi_level after end * of some event * - * @param app_id id of the application whose hmi level should be changed. + * @param window_id window id for HMI state. * * @param state_id that should be removed */ - void RemoveHMIState(HmiState::StateID state_id); + void RemoveHMIState(const WindowID window_id, HmiState::StateID state_id); + + /** + * @brief RemoveWindowHMIStates removes all HMI states related to specified + * window + * @param window_id window ID to remove + */ + void RemoveWindowHMIStates(const WindowID window_id); /** * @brief Removes postponed state + * @param window_id window id for HMI state */ - void RemovePostponedState(); + void RemovePostponedState(const WindowID window_id); /** * @brief Sets regular state of application + * @param window_id window id for HMI state * @param state State of application */ - void SetRegularState(HmiStatePtr state); + void SetRegularState(const WindowID window_id, HmiStatePtr state); /** * @brief Sets postponed state of application. * This state could be set as regular later on - * + * @param window_id window id for HMI state * @param state state to setup */ - void SetPostponedState(HmiStatePtr state); + void SetPostponedState(const WindowID window_id, HmiStatePtr state); /** * @brief HmiState of application within active events PhoneCall, TTS< etc ... + * @param window_id window id for HMI state * @return Active HmiState of application */ - HmiStatePtr CurrentHmiState() const; + HmiStatePtr CurrentHmiState(const WindowID window_id) const; /** * @brief RegularHmiState of application without active events VR, TTS etc ... + * @param window_id window id for HMI state * @return HmiState of application */ - HmiStatePtr RegularHmiState() const; + HmiStatePtr RegularHmiState(const WindowID window_id) const; /** * @brief PostponedHmiState returns postponed hmi state of application * if it's present - * + * @param window_id window id for HMI state * @return Postponed hmi state of application */ - HmiStatePtr PostponedHmiState() const; + HmiStatePtr PostponedHmiState(const WindowID window_id) const; /** * @brief Active states of application */ - HmiStates hmi_states_; - mutable sync_primitives::Lock hmi_states_lock_; + HmiStatesMap hmi_states_map_; + + /** + * @brief hmi_states_map_lock_ + */ + mutable sync_primitives::Lock hmi_states_map_lock_; DISALLOW_COPY_AND_ASSIGN(ApplicationState); }; diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index b6a4c180e6..e8c2f8b914 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -46,6 +46,7 @@ class ApplicationManager; class Application; typedef std::shared_ptr<HmiState> HmiStatePtr; +typedef int32_t WindowID; /** * @brief The HmiState class @@ -206,11 +207,24 @@ class HmiState { state_id_ = state_id; } + /** + * @brief window_type getter for a window type for this type + * @return current state window type + */ + mobile_apis::WindowType::eType window_type() const; + + /** + * @brief set_window_type sets current state window type + * @param window_type new window type + */ + void set_window_type(const mobile_apis::WindowType::eType window_type); + protected: uint32_t hmi_app_id_; StateID state_id_; const ApplicationManager& app_mngr_; HmiStatePtr parent_; + mobile_apis::WindowType::eType window_type_; mobile_apis::HMILevel::eType hmi_level_; mobile_apis::AudioStreamingState::eType audio_streaming_state_; mobile_apis::VideoStreamingState::eType video_streaming_state_; diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 62fbe41d64..a03d6c4931 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -53,6 +53,7 @@ extern const char* info; extern const char* app_id; extern const char* full_app_id; extern const char* bundle_id; +extern const char* window_id; extern const char* app_info; extern const char* app_launch; extern const char* app_launch_list; @@ -172,6 +173,10 @@ extern const char* activate_app_hmi_level; extern const char* audio_streaming_state; extern const char* video_streaming_state; extern const char* system_context; +extern const char* window_name; +extern const char* window_type; +extern const char* associated_service_type; +extern const char* duplicate_updates_from_window_id; extern const char* speech_capabilities; extern const char* vr_capabilities; extern const char* audio_pass_thru_capabilities; @@ -196,6 +201,8 @@ extern const char* red; extern const char* green; extern const char* blue; extern const char* display_layout; +extern const char* template_configuration; +extern const char* template_layout; extern const char* icon_resumed; extern const char* nicknames; extern const char* enabled; @@ -205,6 +212,7 @@ extern const char* hybrid_app_preference; extern const char* is_cloud_application; extern const char* cloud_connection_status; extern const char* endpoint; +extern const char* display_capabilities; // PutFile extern const char* sync_file_name; @@ -377,6 +385,8 @@ extern const char* ign_off_count; extern const char* global_ign_on_counter; +extern const char* suspend_count; + extern const char* connection_info; extern const char* is_download_complete; @@ -413,6 +423,8 @@ extern const char* delivery_mode; extern const char* audio_streaming_indicator; +extern const char* windows_info; + // keys for default parameters loaded from hmi_capabilities.json: extern const char* const keyboard_properties_default; extern const char* const language_default; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc index cf1df2cb68..0a512b2839 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc @@ -94,7 +94,7 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( } const mobile_apis::HMILevel::eType acquiring_app_hmi_level = - acquiring_app->hmi_level(); + acquiring_app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) { LOG4CXX_DEBUG(logger_, diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc index a72b89b9de..bbf9032c96 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc @@ -72,6 +72,8 @@ const uint32_t kHMIAppId1 = 1u; const uint32_t kAppId2 = 22u; const std::string policy_app_id_1_ = "policy_id_1"; const uint32_t kSizeOfModules = 6u; +const application_manager::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace namespace rc_rpc_plugin_test { @@ -134,7 +136,8 @@ void RAManagerTest::CheckResultWithHMILevelAndAccessMode( ra_manager.AcquireResource(kModuleType1, kAppId1)); EXPECT_CALL(mock_app_mngr_, application(kAppId2)) .WillOnce(Return(mock_app_2_)); - EXPECT_CALL(*mock_app_2_, hmi_level()).WillOnce(Return(app_level)); + EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId)) + .WillOnce(Return(app_level)); // Second app tries to get already acquired resource by 1st app EXPECT_EQ(expected_result, ra_manager.AcquireResource(kModuleType1, kAppId2)); } @@ -306,7 +309,7 @@ TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) { EXPECT_CALL(mock_app_mngr_, application(kAppId2)) .WillOnce(Return(mock_app_2_)); - EXPECT_CALL(*mock_app_2_, hmi_level()) + EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE, ra_manager.AcquireResource(kModuleType1, kAppId2)); @@ -360,7 +363,7 @@ TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) { EXPECT_CALL(mock_app_mngr_, application(kAppId2)) .WillOnce(Return(mock_app_2_)); - EXPECT_CALL(*mock_app_2_, hmi_level()) + EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE, ra_manager.AcquireResource(kModuleType1, kAppId2)); @@ -400,7 +403,7 @@ TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) { EXPECT_CALL(mock_app_mngr_, application(kAppId2)) .WillRepeatedly(Return(mock_app_2_)); - EXPECT_CALL(*mock_app_2_, hmi_level()) + EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED, ra_manager.AcquireResource(kModuleType1, kAppId2)); @@ -461,7 +464,7 @@ TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) { EXPECT_CALL(mock_app_mngr_, application(kAppId2)) .WillRepeatedly(Return(mock_app_2_)); - EXPECT_CALL(*mock_app_2_, hmi_level()) + EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE, ra_manager.AcquireResource(kModuleType1, kAppId2)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc index dc225df3be..7a0fd79b08 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc @@ -251,7 +251,8 @@ bool AlertRequest::Validate(uint32_t app_id) { return false; } - if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() && + if (mobile_apis::HMILevel::HMI_BACKGROUND == + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) && app->AreCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::POLICY_TABLE)) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc index b2c9a3377f..46af8353b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc @@ -68,7 +68,9 @@ void DeleteFileRequest::Run() { return; } - if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && + if ((mobile_api::HMILevel::HMI_NONE == + application->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) && (application_manager_.get_settings().delete_file_in_none() <= application->delete_file_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc index 46a39513d5..b8714b4784 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc @@ -70,7 +70,9 @@ void ListFilesRequest::Run() { return; } - if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && + if ((mobile_api::HMILevel::HMI_NONE == + application->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) && (application_manager_.get_settings().list_files_in_none() <= application->list_files_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc index f0368a742d..a3a77cd4e2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc @@ -102,8 +102,10 @@ void OnButtonEventNotification::Run() { return; } - if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) { + const mobile_apis::HMILevel::eType app_hmi_level = + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { LOG4CXX_WARN(logger_, "CUSTOM_BUTTON OnButtonEvent notification is allowed only " << "in FULL or LIMITED hmi level"); @@ -127,8 +129,11 @@ void OnButtonEventNotification::Run() { } // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { + const mobile_apis::HMILevel::eType app_hmi_level = + subscribed_app->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { LOG4CXX_WARN(logger_, "OnButtonEvent notification is allowed only" << "in FULL or LIMITED hmi level"); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc index 7c77e29298..f0083586e9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc @@ -104,8 +104,10 @@ void OnButtonPressNotification::Run() { } // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) { + const mobile_apis::HMILevel::eType app_hmi_level = + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { LOG4CXX_WARN(logger_, "CUSTOM_BUTTON OnButtonPress notification is allowed only " << "in FULL or LIMITED hmi level"); @@ -129,8 +131,11 @@ void OnButtonPressNotification::Run() { } // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { + const mobile_apis::HMILevel::eType app_hmi_level = + subscribed_app->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && + (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { LOG4CXX_WARN(logger_, "OnButtonPress notification is allowed only" << "in FULL or LIMITED hmi level"); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc index 8ec8a86554..1c0609e17d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc @@ -76,7 +76,8 @@ void OnKeyBoardInputNotification::Run() { break; } - if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level()) { + if (mobile_apis::HMILevel::eType::HMI_FULL == + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { LOG4CXX_INFO(logger_, "There is application in HMI_FULL level"); app_to_notify = app; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc index ccbdab15c9..0a8420b6a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc @@ -67,7 +67,8 @@ void OnTBTClientStateNotification::Run() { std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin(); for (; applications.end() != it; ++it) { ApplicationSharedPtr app = *it; - if (mobile_apis::HMILevel::eType::HMI_NONE != app->hmi_level()) { + if (mobile_apis::HMILevel::eType::HMI_NONE != + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { (*message_)[strings::params][strings::connection_key] = app->app_id(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc index 8f8e4dbf6f..0481542565 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -87,7 +87,8 @@ void PerformAudioPassThruRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { + if (mobile_api::HMILevel::HMI_NONE == + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { LOG4CXX_ERROR(logger_, "application isn't activated"); SendResponse(false, mobile_apis::Result::REJECTED); return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index f68596ce27..e25215fb48 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -94,7 +94,9 @@ void PutFileRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() && + if (mobile_api::HMILevel::HMI_NONE == + application->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW) && application_manager_.get_settings().put_file_in_none() <= application->put_file_in_none_count()) { // If application is in the HMI_NONE level the quantity of allowed diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc index 2a8dc6cb70..36278168dc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc @@ -68,11 +68,12 @@ void ShowAppMenuRequest::Run() { return; } - if (mobile_apis::HMILevel::HMI_FULL != app->hmi_level() || + if (mobile_apis::HMILevel::HMI_FULL != + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) || helpers::Compare<mobile_apis::SystemContext::eType, helpers::NEQ, helpers::ALL>( - app->system_context(), + app->system_context(mobile_apis::PredefinedWindows::DEFAULT_WINDOW), mobile_apis::SystemContext::SYSCTXT_MAIN, mobile_apis::SystemContext::SYSCTXT_MENU)) { LOG4CXX_ERROR( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc index 2f8f5c2849..cda1f56444 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc @@ -1885,8 +1885,8 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) { policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcAllowed; - EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); + EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc index 5e0083d395..fe6ba7c4e3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc @@ -126,8 +126,8 @@ MATCHER_P2(CheckNotificationParams, function_id, state, "") { return is_function_id_matched && is_state_matched; } -ACTION_P(GetArg3, result) { - arg3 = *result; +ACTION_P(GetArg4, result) { + arg4 = *result; } ACTION_P(SetMessage, lockScreenDismissalWarning) { @@ -159,8 +159,8 @@ TEST_F(HMIOnDriverDistractionNotificationTest, policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcAllowed; - EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); MessageSharedPtr message_to_mobile( CreateMessage(smart_objects::SmartType_Map)); @@ -202,8 +202,9 @@ TEST_F(HMIOnDriverDistractionNotificationTest, policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcDisallowed; - EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); + EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(3); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); MessageSharedPtr pushed_message(CreateMessage(smart_objects::SmartType_Map)); EXPECT_CALL(*mock_app_, @@ -240,8 +241,8 @@ TEST_F(HMIOnDriverDistractionNotificationTest, policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcAllowed; - ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) - .WillByDefault(GetArg3(&result)); + ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillByDefault(GetArg4(&result)); MessageSharedPtr command_result; EXPECT_CALL(mock_rpc_service_, @@ -284,11 +285,11 @@ TEST_F(HMIOnDriverDistractionNotificationTest, policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcAllowed; - EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); - MessageSharedPtr message_to_mobile( CreateMessage(smart_objects::SmartType_Map)); + EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(2); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( CheckNotificationParams( @@ -331,8 +332,8 @@ TEST_F(HMIOnDriverDistractionNotificationTest, policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcAllowed; - EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); MessageSharedPtr message_to_mobile( CreateMessage(smart_objects::SmartType_Map)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index 113c6d32a0..dc7731bfc8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -73,6 +73,8 @@ const uint32_t kDefaultTimeout = 1000u; const uint32_t kCorrelationId = 2u; const mobile_apis::FunctionID::eType kFunctionId = mobile_apis::FunctionID::AlertID; +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { @@ -138,9 +140,9 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { *mock_app_, AreCommandLimitsExceeded(kFunctionId, am::TLimitSource::POLICY_TABLE)) .WillByDefault(Return(false)); - ON_CALL(*mock_app_, hmi_level()) + ON_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); - ON_CALL(*mock_app_, hmi_level()) + ON_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); } @@ -155,7 +157,8 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { } void ExpectCallHmiLevel(const mobile_apis::HMILevel::eType level) { - EXPECT_CALL(*mock_app_, hmi_level()).WillRepeatedly(Return(level)); + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) + .WillRepeatedly(Return(level)); } void ExpectManageMobileCommandWithResultCode( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc index 4081583099..cce53bb480 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc @@ -98,6 +98,8 @@ namespace { const uint32_t kConnectionKey = 1u; const uint32_t kCorrelationId = 10u; const int32_t kMenuId = 5; +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace class DeleteFileRequestTest @@ -134,7 +136,7 @@ TEST_F(DeleteFileRequestTest, Run_HMILevelNone_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE)); EXPECT_CALL(app_mngr_, get_settings()) @@ -161,7 +163,7 @@ TEST_F(DeleteFileRequestTest, Run_ValidFileName_SUCCESS) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(mock_app_)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); EXPECT_CALL(app_mngr_, get_settings()) @@ -191,7 +193,7 @@ TEST_F(DeleteFileRequestTest, Run_InvalidFile_UNSUCCESS) { (*message_)[am::strings::msg_params][am::strings::sync_file_name] = file_name; EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); EXPECT_CALL(app_mngr_, get_settings()) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc index 8b6f6696b7..06ecc1116e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc @@ -60,6 +60,11 @@ namespace am = ::application_manager; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::ListFilesRequest; +namespace { +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +} + class ListFilesRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: @@ -86,7 +91,7 @@ TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) { std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); - ON_CALL(*app, hmi_level()) + ON_CALL(*app, hmi_level(kDefaultWindowId)) .WillByDefault(Return(mobile_apis::HMILevel::HMI_NONE)); const uint32_t kListFilesInNoneAllowed = 1u; @@ -121,7 +126,7 @@ TEST_F(ListFilesRequestTest, Run_SUCCESS) { ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); - ON_CALL(*app, hmi_level()) + ON_CALL(*app, hmi_level(kDefaultWindowId)) .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); ON_CALL(*app, increment_list_files_in_none_count()).WillByDefault(Return()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc index 1f514e09c5..c0305a15ca 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc @@ -65,6 +65,8 @@ namespace { const uint32_t kAppId = 5u; const uint32_t kCustomButtonId = 3u; const mobile_apis::ButtonName::eType kButtonName = mobile_apis::ButtonName::OK; +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace template <class NotificationT, @@ -217,7 +219,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) { this->template CreateCommand<Notification>(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); - ON_CALL(*mock_app, hmi_level()) + ON_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app)); EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId)) @@ -264,7 +266,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_InvalidHmiLevel_UNSUCCESS) { std::vector<ApplicationSharedPtr> subscribed_apps_list; subscribed_apps_list.push_back(mock_app); - EXPECT_CALL(*mock_app, hmi_level()) + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE)); EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName)) @@ -290,7 +292,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, std::vector<ApplicationSharedPtr> subscribed_apps_list; subscribed_apps_list.push_back(mock_app); - EXPECT_CALL(*mock_app, hmi_level()) + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED)); EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName)) @@ -316,7 +318,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) { std::vector<ApplicationSharedPtr> subscribed_apps_list; subscribed_apps_list.push_back(mock_app); - EXPECT_CALL(*mock_app, hmi_level()) + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc index 501b4d8631..b7b827bb4c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc @@ -48,6 +48,8 @@ namespace strings = application_manager::strings; namespace { const uint32_t kConnectionKey = 1u; +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace using application_manager::ApplicationSet; @@ -102,7 +104,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) { EXPECT_CALL(*mock_app, is_perform_interaction_active()).WillOnce(Return(1)); EXPECT_CALL(*mock_app, perform_interaction_layout()) .WillOnce(Return(mobile_apis::LayoutMode::KEYBOARD)); - EXPECT_CALL(*mock_app, hmi_level()).Times(0); + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)).Times(0); EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey)); @@ -126,7 +128,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) { EXPECT_CALL(*mock_app, is_perform_interaction_active()) .WillRepeatedly(Return(0)); - EXPECT_CALL(*mock_app, hmi_level()) + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::eType::HMI_FULL)); EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey)); @@ -151,7 +153,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) { EXPECT_CALL(*mock_app, is_perform_interaction_active()) .WillRepeatedly(Return(0)); - EXPECT_CALL(*mock_app, hmi_level()) + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND)); EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc index f1e1a291d3..c43dea76e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc @@ -60,6 +60,8 @@ typedef std::shared_ptr<OnTBTClientStateNotification> NotificationPtr; namespace { const uint32_t kAppId = 1u; +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace class OnTBTClientStateNotificationTest @@ -79,7 +81,7 @@ TEST_F(OnTBTClientStateNotificationTest, Run_HmiLevelNone_UNSUCCESS) { EXPECT_CALL(app_mngr_, applications_with_navi()) .WillOnce(Return(applications_with_navi)); - EXPECT_CALL(*mock_app, hmi_level()) + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); EXPECT_CALL(*mock_app, app_id()).Times(0); @@ -122,7 +124,7 @@ TEST_F(OnTBTClientStateNotificationTest, EXPECT_CALL(app_mngr_, applications_with_navi()) .WillOnce(Return(applications_with_navi)); - EXPECT_CALL(*mock_app, hmi_level()) + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc index b0df0e57d3..2915418d43 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -72,6 +72,8 @@ const std::string kCorrectDisplayText1 = "CorrectDisplayText1"; const std::string kCorrectDisplayText2 = "CorrectDisplayText2"; const std::string kFunctionId = "FunctionId"; const uint32_t kTimeoutForTTSSpeak = 1u; +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace class PerformAudioPassThruRequestTest @@ -109,7 +111,7 @@ class PerformAudioPassThruRequestTest msg_params_[field] = "prompt\\n"; } - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); CallRun caller(*command_sptr_); @@ -206,7 +208,7 @@ TEST_F(PerformAudioPassThruRequestTest, (*mobile_request)[am::strings::msg_params][am::strings::initial_prompt] = initial_prompt; - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); std::shared_ptr<PerformAudioPassThruRequest> command = CreateCommand<PerformAudioPassThruRequest>(mobile_request); @@ -286,7 +288,7 @@ TEST_F(PerformAudioPassThruRequestTest, } TEST_F(PerformAudioPassThruRequestTest, Run_HmiLevelNone_Rejected) { - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE)); CallRun caller(*command_sptr_); @@ -319,7 +321,7 @@ TEST_F(PerformAudioPassThruRequestTest, // First we need to call SendSpeakRequest() // to enable the "is_active_tts_speak" key - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); msg_params_[am::strings::initial_prompt][0][am::strings::text] = @@ -407,7 +409,7 @@ TEST_F(PerformAudioPassThruRequestTest, TEST_F(PerformAudioPassThruRequestTest, Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteTrue) { - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); msg_params_[am::strings::initial_prompt][0][am::strings::text] = @@ -481,7 +483,7 @@ TEST_F(PerformAudioPassThruRequestTest, TEST_F(PerformAudioPassThruRequestTest, Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteFalse) { - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); msg_params_[am::strings::initial_prompt][0][am::strings::text] = @@ -536,7 +538,7 @@ TEST_F(PerformAudioPassThruRequestTest, TEST_F( PerformAudioPassThruRequestTest, Run_InitPromptEmpty_PerformAndRecordStartNotificationsAndStartRecording) { - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); MessageSharedPtr start_record_result_msg; @@ -766,7 +768,7 @@ TEST_F(PerformAudioPassThruRequestTest, EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(true)); EXPECT_CALL(app_mngr_, StopAudioPassThru(_)); - EXPECT_CALL(*application_sptr_, hmi_level()) + EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); msg_params_[am::strings::initial_prompt][0][am::strings::text] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc index e8e03484ed..8db533f446 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc @@ -78,6 +78,8 @@ const int64_t kZeroOffset = 0u; const std::string kStorageFolder = "./storage"; const std::string kFolder = "folder"; const std::string kAppFolder = "app_folder"; +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } // namespace class PutFileRequestTest @@ -99,7 +101,7 @@ class PutFileRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); - ON_CALL(*mock_app_, hmi_level()) + ON_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); } @@ -179,7 +181,7 @@ TEST_F(PutFileRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) { } TEST_F(PutFileRequestTest, Run_HmiLevelNone_UNSUCCESS) { - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); const uint32_t settings_put_file_in_none = 1u; diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc index 0636748977..f63551da33 100644 --- a/src/components/application_manager/src/application_data_impl.cc +++ b/src/components/application_manager/src/application_data_impl.cc @@ -173,19 +173,16 @@ InitialApplicationDataImpl::perform_interaction_layout() const { } DynamicApplicationDataImpl::DynamicApplicationDataImpl() - : help_prompt_(NULL) - , timeout_prompt_(NULL) - , vr_help_title_(NULL) - , vr_help_(NULL) + : help_prompt_(nullptr) + , timeout_prompt_(nullptr) + , vr_help_title_(nullptr) + , vr_help_(nullptr) , tbt_state_(mobile_api::TBTState::INVALID_ENUM) - , show_command_(NULL) - , keyboard_props_(NULL) - , menu_title_(NULL) - , menu_icon_(NULL) - , tbt_show_command_(NULL) - , day_color_scheme_(NULL) - , night_color_scheme_(NULL) - , display_layout_("") + , show_command_(nullptr) + , keyboard_props_(nullptr) + , menu_title_(nullptr) + , menu_icon_(nullptr) + , tbt_show_command_(nullptr) , commands_() , commands_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>()) , sub_menu_() @@ -195,6 +192,8 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl() , performinteraction_choice_set_map_() , performinteraction_choice_set_lock_ptr_( std::make_shared<sync_primitives::RecursiveLock>()) + , window_params_map_() + , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , is_perform_interaction_active_(false) , is_reset_global_properties_active_(false) , perform_interaction_mode_(-1) {} @@ -230,16 +229,6 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() { tbt_show_command_ = NULL; } - if (day_color_scheme_) { - delete day_color_scheme_; - day_color_scheme_ = NULL; - } - - if (night_color_scheme_) { - delete night_color_scheme_; - night_color_scheme_ = NULL; - } - for (CommandsMap::iterator command_it = commands_.begin(); commands_.end() != command_it; ++command_it) { @@ -265,6 +254,8 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() { performinteraction_choice_set_map_[it->first].clear(); } performinteraction_choice_set_map_.clear(); + + window_params_map_.clear(); } const smart_objects::SmartObject* DynamicApplicationDataImpl::help_prompt() @@ -316,18 +307,55 @@ const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon() return menu_icon_; } -const smart_objects::SmartObject* DynamicApplicationDataImpl::day_color_scheme() +smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme() const { - return day_color_scheme_; + using namespace mobile_apis::PredefinedWindows; + auto default_window_it = window_templates_.find(DEFAULT_WINDOW); + + if (window_templates_.end() != default_window_it) { + const smart_objects::SmartObject template_config = + default_window_it->second; + if (template_config.keyExists(strings::day_color_scheme)) { + return template_config[strings::day_color_scheme]; + } + } + + return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null); } -const smart_objects::SmartObject* -DynamicApplicationDataImpl::night_color_scheme() const { - return night_color_scheme_; +smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme() + const { + using namespace mobile_apis::PredefinedWindows; + auto default_window_it = window_templates_.find(DEFAULT_WINDOW); + + if (window_templates_.end() != default_window_it) { + const smart_objects::SmartObject template_config = + default_window_it->second; + if (template_config.keyExists(strings::night_color_scheme)) { + return template_config[strings::night_color_scheme]; + } + } + + return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null); } -const std::string& DynamicApplicationDataImpl::display_layout() const { - return display_layout_; +std::string DynamicApplicationDataImpl::display_layout() const { + using namespace mobile_apis::PredefinedWindows; + auto default_window_it = window_templates_.find(DEFAULT_WINDOW); + + if (window_templates_.end() != default_window_it) { + smart_objects::SmartObject template_config = default_window_it->second; + if (template_config.keyExists(strings::template_layout)) { + return template_config[strings::template_layout].asString(); + } + } + + return std::string(); +} + +smart_objects::SmartObjectSPtr +DynamicApplicationDataImpl::display_capabilities() const { + return display_capabilities_; } void DynamicApplicationDataImpl::load_global_properties( @@ -447,24 +475,104 @@ void DynamicApplicationDataImpl::set_menu_icon( void DynamicApplicationDataImpl::set_day_color_scheme( const smart_objects::SmartObject& color_scheme) { - if (day_color_scheme_) { - delete day_color_scheme_; - } - - day_color_scheme_ = new smart_objects::SmartObject(color_scheme); + using namespace mobile_apis::PredefinedWindows; + DCHECK(color_scheme.getType() == smart_objects::SmartType_Map); + window_templates_[DEFAULT_WINDOW][strings::day_color_scheme] = color_scheme; } void DynamicApplicationDataImpl::set_night_color_scheme( const smart_objects::SmartObject& color_scheme) { - if (night_color_scheme_) { - delete night_color_scheme_; + using namespace mobile_apis::PredefinedWindows; + DCHECK(color_scheme.getType() == smart_objects::SmartType_Map); + window_templates_[DEFAULT_WINDOW][strings::night_color_scheme] = color_scheme; +} + +void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) { + LOG4CXX_AUTO_TRACE(logger_); + using namespace mobile_apis::PredefinedWindows; + smart_objects::SmartObject template_config(smart_objects::SmartType_Map); + template_config[strings::template_layout] = layout; + window_templates_[DEFAULT_WINDOW] = template_config; +} + +void DynamicApplicationDataImpl::set_display_capabilities( + const smart_objects::SmartObject& display_capabilities) { + display_capabilities_.reset( + new smart_objects::SmartObject(display_capabilities)); +} + +void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id, + const std::string& layout) { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject template_config(smart_objects::SmartType_Map); + + template_config[strings::template_layout] = layout; + window_templates_[window_id] = template_config; +} + +void DynamicApplicationDataImpl::set_day_color_scheme( + const WindowID window_id, const smart_objects::SmartObject& color_scheme) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(color_scheme.getType() == smart_objects::SmartType_Map); + window_templates_[window_id][strings::day_color_scheme] = color_scheme; +} + +void DynamicApplicationDataImpl::set_night_color_scheme( + const WindowID window_id, const smart_objects::SmartObject& color_scheme) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(color_scheme.getType() == smart_objects::SmartType_Map); + window_templates_[window_id][strings::night_color_scheme] = color_scheme; +} + +std::string DynamicApplicationDataImpl::window_layout( + const WindowID window_id) const { + LOG4CXX_AUTO_TRACE(logger_); + AppWindowsTemplates::const_iterator window_template_it = + window_templates_.find(window_id); + + if (window_templates_.end() != window_template_it) { + const smart_objects::SmartObject template_config = + window_template_it->second; + if (template_config.keyExists(strings::template_layout)) { + return template_config[strings::template_layout].asString(); + } } - night_color_scheme_ = new smart_objects::SmartObject(color_scheme); + return std::string(); } -void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) { - display_layout_ = layout; +smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme( + const WindowID window_id) const { + LOG4CXX_AUTO_TRACE(logger_); + AppWindowsTemplates::const_iterator window_template_it = + window_templates_.find(window_id); + + if (window_templates_.end() != window_template_it) { + const smart_objects::SmartObject template_config = + window_template_it->second; + if (template_config.keyExists(strings::day_color_scheme)) { + return template_config[strings::day_color_scheme]; + } + } + + return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null); +} + +smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme( + const WindowID window_id) const { + LOG4CXX_AUTO_TRACE(logger_); + AppWindowsTemplates::const_iterator window_template_it = + window_templates_.find(window_id); + + if (window_templates_.end() != window_template_it) { + const smart_objects::SmartObject template_config = + window_template_it->second; + if (template_config.keyExists(strings::night_color_scheme)) { + return template_config[strings::night_color_scheme]; + } + } + + return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null); } void DynamicApplicationDataImpl::SetGlobalProperties( @@ -555,6 +663,27 @@ bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist( return false; } +DataAccessor<WindowParamsMap> +DynamicApplicationDataImpl::window_optional_params_map() const { + return DataAccessor<WindowParamsMap>(window_params_map_, + window_params_map_lock_ptr_); +} + +void DynamicApplicationDataImpl::AddWindowInfo( + const WindowID window_id, const smart_objects::SmartObject& window_info) { + LOG4CXX_AUTO_TRACE(logger_); + const auto it = window_params_map_.find(window_id); + if (window_params_map_.end() == it) { + window_params_map_[window_id] = + std::make_shared<smart_objects::SmartObject>(window_info); + } +} + +void DynamicApplicationDataImpl::RemoveWindowInfo(const WindowID window_id) { + LOG4CXX_AUTO_TRACE(logger_); + window_params_map_.erase(window_id); +} + void DynamicApplicationDataImpl::AddChoiceSet( uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) { sync_primitives::AutoLock lock(choice_set_map_lock_ptr_); diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 3b2f51f26c..92509aa704 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -187,7 +187,8 @@ void ApplicationImpl::CloseActiveMessage() { } bool ApplicationImpl::IsFullscreen() const { - return mobile_api::HMILevel::HMI_FULL == hmi_level(); + return mobile_api::HMILevel::HMI_FULL == + hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); } bool ApplicationImpl::is_audio() const { @@ -265,19 +266,21 @@ bool ApplicationImpl::IsVideoApplication() const { return is_video_app; } -void ApplicationImpl::SetRegularState(HmiStatePtr state) { +void ApplicationImpl::SetRegularState(const WindowID window_id, + HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); - state_.AddState(state); + state_.AddState(window_id, state); } -void ApplicationImpl::RemovePostponedState() { +void ApplicationImpl::RemovePostponedState(const WindowID window_id) { LOG4CXX_AUTO_TRACE(logger_); - state_.RemoveState(HmiState::STATE_ID_POSTPONED); + state_.RemoveState(window_id, HmiState::STATE_ID_POSTPONED); } -void ApplicationImpl::SetPostponedState(HmiStatePtr state) { +void ApplicationImpl::SetPostponedState(const WindowID window_id, + HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); - state_.AddState(state); + state_.AddState(window_id, state); } void ApplicationImpl::set_mobile_projection_enabled(bool option) { @@ -297,22 +300,56 @@ struct StateIDComparator { } }; -void ApplicationImpl::AddHMIState(HmiStatePtr state) { +void ApplicationImpl::AddHMIState(const WindowID window_id, HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); - state_.AddState(state); + state_.AddState(window_id, state); } -void ApplicationImpl::RemoveHMIState(HmiState::StateID state_id) { +void ApplicationImpl::RemoveHMIState(const WindowID window_id, + HmiState::StateID state_id) { LOG4CXX_AUTO_TRACE(logger_); - state_.RemoveState(state_id); + state_.RemoveState(window_id, state_id); } -const HmiStatePtr ApplicationImpl::CurrentHmiState() const { - return state_.GetState(HmiState::STATE_ID_CURRENT); +const HmiStatePtr ApplicationImpl::CurrentHmiState( + const WindowID window_id) const { + return state_.GetState(window_id, HmiState::STATE_ID_CURRENT); } -const HmiStatePtr ApplicationImpl::RegularHmiState() const { - return state_.GetState(HmiState::STATE_ID_REGULAR); +const HmiStatePtr ApplicationImpl::RegularHmiState( + const WindowID window_id) const { + return state_.GetState(window_id, HmiState::STATE_ID_REGULAR); +} + +WindowNames ApplicationImpl::GetWindowNames() const { + LOG4CXX_DEBUG(logger_, + "Collecting window names for application " << app_id()); + + WindowNames window_names; + std::string stringified_window_names; + + sync_primitives::AutoLock auto_lock(window_params_map_lock_ptr_); + for (const auto& window_info_item : window_params_map_) { + const auto window_name = + (*window_info_item.second)[strings::window_name].asString(); + window_names.push_back(window_name); + stringified_window_names += + (stringified_window_names.empty() ? "" : ",") + window_name; + } + + LOG4CXX_DEBUG(logger_, + "Existing window names: [" + stringified_window_names + "]"); + return window_names; +} + +WindowIds ApplicationImpl::GetWindowIds() const { + LOG4CXX_DEBUG(logger_, "Collecting window IDs for application " << app_id()); + return state_.GetWindowIds(); +} + +bool ApplicationImpl::WindowIdExists(const WindowID window_id) const { + const WindowIds window_ids = GetWindowIds(); + return helpers::in_range(window_ids, window_id); } bool ApplicationImpl::IsAllowedToChangeAudioSource() const { @@ -322,8 +359,9 @@ bool ApplicationImpl::IsAllowedToChangeAudioSource() const { return false; } -const HmiStatePtr ApplicationImpl::PostponedHmiState() const { - return state_.GetState(HmiState::STATE_ID_POSTPONED); +const HmiStatePtr ApplicationImpl::PostponedHmiState( + const WindowID window_id) const { + return state_.GetState(window_id, HmiState::STATE_ID_POSTPONED); } const smart_objects::SmartObject* ApplicationImpl::active_message() const { @@ -354,9 +392,10 @@ bool ApplicationImpl::is_media_application() const { return is_media_; } -const mobile_api::HMILevel::eType ApplicationImpl::hmi_level() const { +const mobile_api::HMILevel::eType ApplicationImpl::hmi_level( + const WindowID window_id) const { using namespace mobile_apis; - const HmiStatePtr hmi_state = CurrentHmiState(); + const HmiStatePtr hmi_state = CurrentHmiState(window_id); return hmi_state ? hmi_state->hmi_level() : HMILevel::INVALID_ENUM; } @@ -380,9 +419,10 @@ const uint32_t ApplicationImpl::list_files_in_none_count() const { return list_files_in_none_count_; } -const mobile_api::SystemContext::eType ApplicationImpl::system_context() const { +const mobile_api::SystemContext::eType ApplicationImpl::system_context( + const WindowID window_id) const { using namespace mobile_apis; - const HmiStatePtr hmi_state = CurrentHmiState(); + const HmiStatePtr hmi_state = CurrentHmiState(window_id); return hmi_state ? hmi_state->system_context() : SystemContext::INVALID_ENUM; ; } @@ -930,8 +970,10 @@ bool ApplicationImpl::is_application_data_changed() const { return is_application_data_changed_; } -void ApplicationImpl::SetInitialState(HmiStatePtr state) { - state_.InitState(state); +void ApplicationImpl::SetInitialState(const WindowID window_id, + const std::string& window_name, + HmiStatePtr state) { + state_.InitState(window_id, window_name, state); } void ApplicationImpl::set_is_application_data_changed( @@ -1098,8 +1140,9 @@ void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) { } void ApplicationImpl::set_system_context( + const WindowID window_id, const mobile_api::SystemContext::eType& system_context) { - const HmiStatePtr hmi_state = CurrentHmiState(); + HmiStatePtr hmi_state = CurrentHmiState(window_id); hmi_state->set_system_context(system_context); } @@ -1112,13 +1155,20 @@ void ApplicationImpl::set_audio_streaming_state( " for non-media application to different from NOT_AUDIBLE"); return; } - CurrentHmiState()->set_audio_streaming_state(state); + + // According to proposal SDL-0216 audio and video streaming states should + // be applied for all windows to keep consistency + HmiStates hmi_states = state_.GetStates(HmiState::STATE_ID_CURRENT); + for (const auto& hmi_state : hmi_states) { + hmi_state->set_audio_streaming_state(state); + } } void ApplicationImpl::set_hmi_level( + const WindowID window_id, const mobile_api::HMILevel::eType& new_hmi_level) { using namespace mobile_apis; - const HMILevel::eType current_hmi_level = hmi_level(); + const HMILevel::eType current_hmi_level = hmi_level(window_id); if (HMILevel::HMI_NONE != current_hmi_level && HMILevel::HMI_NONE == new_hmi_level) { put_file_in_none_count_ = 0; @@ -1127,7 +1177,8 @@ void ApplicationImpl::set_hmi_level( } ApplicationSharedPtr app = application_manager_.application(app_id()); DCHECK_OR_RETURN_VOID(app) - application_manager_.state_controller().SetRegularState(app, new_hmi_level); + application_manager_.state_controller().SetRegularState( + app, window_id, new_hmi_level); LOG4CXX_INFO(logger_, "hmi_level = " << new_hmi_level); usage_report_.RecordHmiStateChanged(new_hmi_level); } diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 04fcf2c53f..7814b58a35 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -304,7 +304,9 @@ ApplicationSharedPtr ApplicationManagerImpl::active_application() const { } bool LimitedAppPredicate(const ApplicationSharedPtr app) { - return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED : false; + return app ? app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) == + mobile_api::HMILevel::HMI_LIMITED + : false; } ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application() @@ -315,7 +317,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application() bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) { return app ? (app->is_navi() && - app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) + app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) == + mobile_api::HMILevel::HMI_LIMITED) : false; } @@ -327,7 +330,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_navi_application() bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) { return app ? (app->is_voice_communication_supported() && - app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) + app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) == + mobile_api::HMILevel::HMI_LIMITED) : false; } @@ -349,7 +353,8 @@ ApplicationManagerImpl::applications_with_navi() { bool LimitedMobileProjectionPredicate(const ApplicationSharedPtr app) { return app ? (app->mobile_projection_enabled() && - app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) + app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) == + mobile_api::HMILevel::HMI_LIMITED) : false; } @@ -574,12 +579,16 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( HmiStatePtr initial_state = CreateRegularState(std::shared_ptr<Application>(application), + mobile_apis::WindowType::MAIN, mobile_apis::HMILevel::INVALID_ENUM, mobile_apis::AudioStreamingState::INVALID_ENUM, mobile_apis::VideoStreamingState::INVALID_ENUM, mobile_api::SystemContext::SYSCTXT_MAIN); - application->SetInitialState(initial_state); + application->SetInitialState( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + std::string(), // should not be tracked for main window + initial_state); application->set_folder_name(policy_app_id + "_" + application->mac_address()); @@ -1314,11 +1323,13 @@ void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) { HmiStatePtr ApplicationManagerImpl::CreateRegularState( std::shared_ptr<Application> app, - mobile_apis::HMILevel::eType hmi_level, - mobile_apis::AudioStreamingState::eType audio_state, - mobile_apis::VideoStreamingState::eType video_state, - mobile_apis::SystemContext::eType system_context) const { + const mobile_apis::WindowType::eType window_type, + const mobile_apis::HMILevel::eType hmi_level, + const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::VideoStreamingState::eType video_state, + const mobile_apis::SystemContext::eType system_context) const { HmiStatePtr state(new HmiState(app, *this)); + state->set_window_type(window_type); state->set_hmi_level(hmi_level); state->set_audio_streaming_state(audio_state); state->set_video_streaming_state(video_state); @@ -3063,7 +3074,9 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( params_permissions->undefined_params = result.list_of_undefined_params; } - if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE && + // Record statistics for default window only + if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) == + mobile_apis::HMILevel::HMI_NONE && function_id != MessageHelper::StringifiedFunctionID( mobile_apis::FunctionID::UnregisterAppInterfaceID)) { if (result.hmi_level_permitted != policy::kRpcAllowed) { @@ -3074,7 +3087,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( #ifdef ENABLE_LOG const std::string log_msg = "Application: " + app->policy_app_id() + ", RPC: " + function_id + - ", HMI status: " + MessageHelper::StringifiedHMILevel(app->hmi_level()); + ", window_id: " + std::to_string(window_id) + ", HMI status: " + + MessageHelper::StringifiedHMILevel(app->hmi_level(window_id)); #endif // ENABLE_LOG if (result.hmi_level_permitted != policy::kRpcAllowed) { LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg); @@ -3147,7 +3161,10 @@ bool ApplicationManagerImpl::HMILevelAllowsStreaming( LOG4CXX_WARN(logger_, "An application is not registered."); return false; } - return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED); + return Compare<eType, EQ, ONE>( + app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW), + HMI_FULL, + HMI_LIMITED); } bool ApplicationManagerImpl::CanAppStream( @@ -3836,10 +3853,12 @@ void ApplicationManagerImpl::OnUpdateHMIAppType( if (flag_diffirence_app_hmi_type) { (*it)->set_app_types(transform_app_hmi_types); (*it)->ChangeSupportingAppHMIType(); - if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) { + const mobile_apis::HMILevel::eType app_hmi_level = + (*it)->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); + if (app_hmi_level == mobile_api::HMILevel::HMI_BACKGROUND) { MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this); - } else if (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) || - ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) { + } else if ((app_hmi_level == mobile_api::HMILevel::HMI_FULL) || + (app_hmi_level == mobile_api::HMILevel::HMI_LIMITED)) { MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this); state_controller().SetRegularState( *it, mobile_apis::HMILevel::HMI_BACKGROUND, true); @@ -4342,9 +4361,10 @@ void ApplicationManagerImpl::ChangeAppsHMILevel( LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id); return; } - const mobile_apis::HMILevel::eType old_level = app->hmi_level(); + const mobile_apis::HMILevel::eType old_level = + app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW); if (old_level != level) { - app->set_hmi_level(level); + app->set_hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, level); OnHMILevelChanged(app_id, old_level, level); } else { LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level); diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc index 2b02e9b658..6ed784424a 100644 --- a/src/components/application_manager/src/application_state.cc +++ b/src/components/application_manager/src/application_state.cc @@ -31,7 +31,10 @@ */ #include "application_manager/application_state.h" + #include <algorithm> +#include <string> + #include "utils/logger.h" #include "utils/macro.h" @@ -53,193 +56,293 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") ApplicationState::ApplicationState() {} -void ApplicationState::InitState(HmiStatePtr state) { +void ApplicationState::InitState(const WindowID window_id, + const std::string& window_name, + HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(state); - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - hmi_states_.clear(); - hmi_states_.push_back(state); + LOG4CXX_DEBUG(logger_, + "Initing state " << state << " for window " << window_id + << " with name " << window_name); + { + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + HmiStates& states = hmi_states_map_[window_id]; + states.push_back(state); + } } -void ApplicationState::AddState(HmiStatePtr state) { +void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(state); switch (state->state_id()) { case HmiState::StateID::STATE_ID_REGULAR: - SetRegularState(state); + SetRegularState(window_id, state); return; case HmiState::StateID::STATE_ID_POSTPONED: - SetPostponedState(state); + SetPostponedState(window_id, state); return; case HmiState::StateID::STATE_ID_CURRENT: - LOG4CXX_ERROR(logger_, "State of type '" << state << "' can't be added."); + LOG4CXX_ERROR(logger_, + "State of type '" << state << "' can't be added for window " + << window_id); return; default: - AddHMIState(state); + AddHMIState(window_id, state); break; } return; } -void ApplicationState::RemoveState(HmiState::StateID state) { +void ApplicationState::RemoveState(const WindowID window_id, + HmiState::StateID state) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(state); switch (state) { case HmiState::StateID::STATE_ID_CURRENT: case HmiState::StateID::STATE_ID_REGULAR: - LOG4CXX_ERROR(logger_, - "State of type '" << state << "'can't be removed."); + if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) { + LOG4CXX_ERROR(logger_, + "State of type '" << state + << "' can't be removed for window " + << window_id); + return; + } + + RemoveWindowHMIStates(window_id); break; case HmiState::StateID::STATE_ID_POSTPONED: - RemovePostponedState(); + RemovePostponedState(window_id); break; default: - RemoveHMIState(state); + RemoveHMIState(window_id, state); break; } } -HmiStatePtr ApplicationState::GetState(HmiState::StateID state_id) const { +HmiStatePtr ApplicationState::GetState(const WindowID window_id, + HmiState::StateID state_id) const { switch (state_id) { case HmiState::StateID::STATE_ID_REGULAR: - LOG4CXX_DEBUG(logger_, "Getting regular state."); - return RegularHmiState(); + LOG4CXX_DEBUG(logger_, "Getting regular state for window " << window_id); + return RegularHmiState(window_id); case HmiState::StateID::STATE_ID_POSTPONED: - LOG4CXX_DEBUG(logger_, "Getting postponed state."); - return PostponedHmiState(); + LOG4CXX_DEBUG(logger_, + "Getting postponed state for window " << window_id); + return PostponedHmiState(window_id); default: - LOG4CXX_DEBUG(logger_, "Getting current state."); - return CurrentHmiState(); + LOG4CXX_DEBUG(logger_, "Getting current state for window " << window_id); + return CurrentHmiState(window_id); + } +} + +HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const { + LOG4CXX_DEBUG(logger_, "Collecting all states of type " << state_id); + + HmiStates hmi_states; + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + for (const auto& hmi_state_pair : hmi_states_map_) { + hmi_states.push_back(GetState(hmi_state_pair.first, state_id)); } + + return hmi_states; } -void ApplicationState::AddHMIState(HmiStatePtr state) { +WindowIds ApplicationState::GetWindowIds() const { + LOG4CXX_DEBUG(logger_, "Collecting available window ID's"); + + WindowIds window_ids; + std::string stringified_window_ids; + + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + for (const auto& hmi_state_pair : hmi_states_map_) { + window_ids.push_back(hmi_state_pair.first); + stringified_window_ids += (stringified_window_ids.empty() ? "" : ", ") + + std::to_string(hmi_state_pair.first); + } + + LOG4CXX_DEBUG(logger_, + "Existing window IDs: [" + stringified_window_ids + "]"); + return window_ids; +} + +void ApplicationState::AddHMIState(const WindowID window_id, + HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(state); - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - HmiStates::iterator it = std::find_if(hmi_states_.begin(), - hmi_states_.end(), + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + HmiStates& hmi_states = hmi_states_map_[window_id]; + HmiStates::iterator it = std::find_if(hmi_states.begin(), + hmi_states.end(), StateIDComparator(state->state_id())); - if (hmi_states_.end() != it) { - LOG4CXX_WARN( - logger_, - "Hmi state with ID " - << state->state_id() - << "has been already applied to this application. Ignoring"); + if (hmi_states.end() != it) { + LOG4CXX_WARN(logger_, + "Hmi state with ID " << state->state_id() + << "has been already applied for window " + << window_id + << " of this application. Ignoring"); return; } - hmi_states_.push_back(state); + hmi_states.push_back(state); } -void ApplicationState::RemoveHMIState(HmiState::StateID state_id) { +void ApplicationState::RemoveHMIState(const WindowID window_id, + HmiState::StateID state_id) { LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock auto_lock(hmi_states_lock_); + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + HmiStates& hmi_states = hmi_states_map_[window_id]; HmiStates::iterator it = std::find_if( - hmi_states_.begin(), hmi_states_.end(), StateIDComparator(state_id)); - if (it == hmi_states_.end()) { - LOG4CXX_ERROR(logger_, "Unsuccesful remove HmiState: " << state_id); + hmi_states.begin(), hmi_states.end(), StateIDComparator(state_id)); + if (hmi_states.end() == it) { + LOG4CXX_ERROR(logger_, + "Unsuccesful remove HmiState: " << state_id << " for window " + << window_id); return; } // unable to remove regular state - DCHECK_OR_RETURN_VOID(it != hmi_states_.begin()); + DCHECK_OR_RETURN_VOID(hmi_states.begin() != it); HmiStates::iterator next = it; HmiStates::iterator prev = it; next++; prev--; - if (next != hmi_states_.end()) { + + if (next != hmi_states.end()) { HmiStatePtr next_state = *next; HmiStatePtr prev_state = *prev; next_state->set_parent(prev_state); } - hmi_states_.erase(it); + + hmi_states.erase(it); } -void ApplicationState::RemovePostponedState() { +void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) { LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - DCHECK_OR_RETURN_VOID(!hmi_states_.empty()); + DCHECK_OR_RETURN_VOID(mobile_apis::PredefinedWindows::DEFAULT_WINDOW != + window_id); + + LOG4CXX_DEBUG(logger_, + "Removing HMI states for window with id #" << window_id); + { + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + hmi_states_map_.erase(window_id); + } +} + +void ApplicationState::RemovePostponedState(const WindowID window_id) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + HmiStates& hmi_states = hmi_states_map_[window_id]; + DCHECK_OR_RETURN_VOID(!hmi_states.empty()); StateIDComparator finder(HmiState::StateID::STATE_ID_POSTPONED); HmiStates::iterator postponed_state = - std::find_if(hmi_states_.begin(), hmi_states_.end(), finder); + std::find_if(hmi_states.begin(), hmi_states.end(), finder); - if (hmi_states_.end() == postponed_state) { - LOG4CXX_ERROR(logger_, "No postponed state is set for app."); + if (hmi_states.end() == postponed_state) { + LOG4CXX_ERROR(logger_, + "No postponed state is set for window " << window_id); return; } - hmi_states_.erase(postponed_state); + + hmi_states.erase(postponed_state); } -void ApplicationState::SetRegularState(HmiStatePtr state) { +void ApplicationState::SetRegularState(const WindowID window_id, + HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::StateID::STATE_ID_REGULAR); - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - DCHECK_OR_RETURN_VOID(!hmi_states_.empty()); + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + HmiStates& hmi_states = hmi_states_map_[window_id]; + DCHECK_OR_RETURN_VOID(!hmi_states.empty()); - HmiStatePtr front_state = hmi_states_.front(); + HmiStatePtr front_state = hmi_states.front(); HmiState::StateID front_state_id = front_state->state_id(); if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) { // Drop postponed state - hmi_states_.erase(hmi_states_.begin()); + hmi_states.erase(hmi_states.begin()); } // Drop regular state - hmi_states_.erase(hmi_states_.begin()); + hmi_states.erase(hmi_states.begin()); - if (!hmi_states_.empty()) { - HmiStatePtr front_state = hmi_states_.front(); + if (!hmi_states.empty()) { + HmiStatePtr front_state = hmi_states.front(); front_state->set_parent(state); } - hmi_states_.insert(hmi_states_.begin(), state); + + // Insert new regular state + hmi_states.insert(hmi_states.begin(), state); if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) { - hmi_states_.insert(hmi_states_.begin(), front_state); + // Restore postponed state if it was before + hmi_states.insert(hmi_states.begin(), front_state); } } -void ApplicationState::SetPostponedState(HmiStatePtr state) { +void ApplicationState::SetPostponedState(const WindowID window_id, + HmiStatePtr state) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::StateID::STATE_ID_POSTPONED); - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - DCHECK_OR_RETURN_VOID(!hmi_states_.empty()); - HmiStatePtr front_state = hmi_states_.front(); + + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + HmiStates& hmi_states = hmi_states_map_[window_id]; + DCHECK_OR_RETURN_VOID(!hmi_states.empty()); + HmiStatePtr front_state = hmi_states.front(); if (front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED) { - hmi_states_.erase(hmi_states_.begin()); + hmi_states.erase(hmi_states.begin()); } - hmi_states_.insert(hmi_states_.begin(), state); + + hmi_states.insert(hmi_states.begin(), state); } -HmiStatePtr ApplicationState::CurrentHmiState() const { - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr()); - HmiStatePtr back_state = hmi_states_.back(); +HmiStatePtr ApplicationState::CurrentHmiState(const WindowID window_id) const { + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + auto it_states = hmi_states_map_.find(window_id); + DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr()); + + const HmiStates& hmi_states = it_states->second; + DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr()); + + HmiStatePtr back_state = hmi_states.back(); DCHECK_OR_RETURN( back_state->state_id() != HmiState::StateID::STATE_ID_POSTPONED, HmiStatePtr()); + return back_state; } -HmiStatePtr ApplicationState::RegularHmiState() const { - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr()); - HmiStates::const_iterator front_itr = hmi_states_.begin(); +HmiStatePtr ApplicationState::RegularHmiState(const WindowID window_id) const { + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + auto it_states = hmi_states_map_.find(window_id); + DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr()); + + const HmiStates& hmi_states = it_states->second; + DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr()); + + HmiStates::const_iterator front_itr = hmi_states.begin(); if ((*front_itr)->state_id() == HmiState::StateID::STATE_ID_POSTPONED) { ++front_itr; } + return *front_itr; } -HmiStatePtr ApplicationState::PostponedHmiState() const { - sync_primitives::AutoLock auto_lock(hmi_states_lock_); - DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr()); - HmiStatePtr front_state = hmi_states_.front(); +HmiStatePtr ApplicationState::PostponedHmiState( + const WindowID window_id) const { + sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); + auto it_states = hmi_states_map_.find(window_id); + DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr()); + + const HmiStates& hmi_states = it_states->second; + DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr()); + + HmiStatePtr front_state = hmi_states.front(); return front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED ? front_state : HmiStatePtr(); diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index 77880eddc0..ff689408f1 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -48,6 +48,7 @@ HmiState::HmiState(std::shared_ptr<Application> app, : hmi_app_id_(app->hmi_app_id()) , state_id_(state_id) , app_mngr_(app_mngr) + , window_type_(mobile_apis::WindowType::INVALID_ENUM) , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) , video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM) @@ -60,6 +61,7 @@ HmiState::HmiState(std::shared_ptr<Application> app, : hmi_app_id_(app->hmi_app_id()) , state_id_(STATE_ID_REGULAR) , app_mngr_(app_mngr) + , window_type_(mobile_apis::WindowType::INVALID_ENUM) , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) , video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM) @@ -96,6 +98,15 @@ bool HmiState::is_mobile_projection_app() const { return app ? app->mobile_projection_enabled() : false; } +mobile_apis::WindowType::eType HmiState::window_type() const { + return window_type_; +} + +void HmiState::set_window_type( + const mobile_apis::WindowType::eType window_type) { + window_type_ = window_type; +} + mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state() const { using namespace mobile_apis; diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index bae4802e56..b4c1fb9ed2 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1609,8 +1609,8 @@ bool MessageHelper::CreateHMIApplicationStruct( const smart_objects::SmartObject* app_types = app->app_types(); const smart_objects::SmartObject* ngn_media_screen_name = app->ngn_media_screen_name(); - const smart_objects::SmartObject* day_color_scheme = app->day_color_scheme(); - const smart_objects::SmartObject* night_color_scheme = + const smart_objects::SmartObject day_color_scheme = app->day_color_scheme(); + const smart_objects::SmartObject night_color_scheme = app->night_color_scheme(); message = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -1686,12 +1686,12 @@ bool MessageHelper::CreateHMIApplicationStruct( SmartObject(smart_objects::SmartType_Array); } - if (day_color_scheme) { - message[strings::day_color_scheme] = *day_color_scheme; + if (day_color_scheme.getType() == smart_objects::SmartType_Map) { + message[strings::day_color_scheme] = day_color_scheme; } - if (night_color_scheme) { - message[strings::night_color_scheme] = *night_color_scheme; + if (night_color_scheme.getType() == smart_objects::SmartType_Map) { + message[strings::night_color_scheme] = night_color_scheme; } message[strings::device_info] = diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index fdbd0ce391..3db438380a 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -126,7 +126,10 @@ struct HMILevelPredicate : level_(level) {} bool operator()(const ApplicationSharedPtr app) const { - return level_ == app->hmi_level() ? true : false; + return level_ == app->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW) + ? true + : false; } private: @@ -967,7 +970,8 @@ void PolicyHandler::OnPendingPermissionChange( return; } - mobile_apis::HMILevel::eType app_hmi_level = app->hmi_level(); + mobile_apis::HMILevel::eType app_hmi_level = + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); switch (app_hmi_level) { case mobile_apis::HMILevel::eType::HMI_FULL: @@ -1357,7 +1361,8 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, // The application currently not running (i.e. in NONE) should change HMI // level to default - mobile_apis::HMILevel::eType current_hmi_level = app->hmi_level(); + mobile_apis::HMILevel::eType current_hmi_level = + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); mobile_apis::HMILevel::eType hmi_level = MessageHelper::StringToHMILevel(default_hmi); @@ -1495,12 +1500,13 @@ bool PolicyHandler::GetPriority(const std::string& policy_app_id, void PolicyHandler::CheckPermissions( const application_manager::ApplicationSharedPtr app, + const application_manager::WindowID window_id, const PTString& rpc, const RPCParams& rpc_params, CheckPermissionResult& result) { POLICY_LIB_CHECK_VOID(); const std::string hmi_level = - MessageHelper::StringifiedHMILevel(app->hmi_level()); + MessageHelper::StringifiedHMILevel(app->hmi_level(window_id)); if (hmi_level.empty()) { LOG4CXX_WARN(logger_, "HMI level for " << app->policy_app_id() << " is invalid, rpc " @@ -2276,7 +2282,8 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app, mobile_apis::HMILevel::eType level) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); - if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE) { + if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) == + mobile_apis::HMILevel::HMI_NONE) { // If default is FULL, send request to HMI. Notification to mobile will be // sent on response receiving. if (mobile_apis::HMILevel::HMI_FULL == level) { diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 02b7098414..9188a47bf9 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -2731,7 +2731,8 @@ bool ResumptionDataDB::UpdateApplicationData( utils::dbms::SQLQuery query(db()); const int64_t time_stamp = static_cast<int64_t>(time(NULL)); - const mobile_apis::HMILevel::eType hmi_level = application->hmi_level(); + const mobile_apis::HMILevel::eType hmi_level = + application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (!query.Prepare(kUpdateApplicationData)) { LOG4CXX_WARN(logger_, @@ -2843,7 +2844,8 @@ ApplicationParams::ApplicationParams(app_mngr::ApplicationSharedPtr application) m_grammar_id = application->get_grammar_id(); m_connection_key = application->app_id(); m_hmi_app_id = application->hmi_app_id(); - m_hmi_level = application->hmi_level(); + m_hmi_level = + application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); m_is_media_application = application->IsAudioApplication(); app_ptr = application; } diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index 591166c687..525d3694d4 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -64,7 +64,8 @@ void ResumptionDataJson::SaveApplication( const uint32_t grammar_id = application->get_grammar_id(); const uint32_t time_stamp = (uint32_t)time(NULL); const std::string device_mac = application->mac_address(); - const mobile_apis::HMILevel::eType hmi_level = application->hmi_level(); + const mobile_apis::HMILevel::eType hmi_level = + application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); const bool is_subscribed_for_way_points = application_manager_.IsAppSubscribedForWayPoints(application); diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index fef5ef0163..34e6e0679d 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -177,7 +177,8 @@ bool RPCServiceImpl::ManageMobileCommand( mobile_apis::HMILevel::eType app_hmi_level = mobile_apis::HMILevel::INVALID_ENUM; if (app) { - app_hmi_level = app->hmi_level(); + app_hmi_level = + app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); } // commands will be launched from request_ctrl diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index 4dd431e8cb..319b06323d 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -20,6 +20,7 @@ const char* info = "info"; const char* app_id = "appID"; const char* full_app_id = "fullAppID"; const char* bundle_id = "appBundleID"; +const char* window_id = "windowID"; const char* app_info = "appInfo"; const char* app_launch = "app_launch"; const char* app_launch_list = "app_launch_list"; @@ -139,6 +140,10 @@ const char* activate_app_hmi_level = "level"; const char* audio_streaming_state = "audioStreamingState"; const char* video_streaming_state = "videoStreamingState"; const char* system_context = "systemContext"; +const char* window_name = "windowName"; +const char* window_type = "type"; +const char* associated_service_type = "associatedServiceType"; +const char* duplicate_updates_from_window_id = "duplicateUpdatesFromWindowID"; const char* speech_capabilities = "speechCapabilities"; const char* vr_capabilities = "vrCapabilities"; const char* audio_pass_thru_capabilities = "audioPassThruCapabilities"; @@ -163,6 +168,8 @@ const char* red = "red"; const char* green = "green"; const char* blue = "blue"; const char* display_layout = "displayLayout"; +const char* template_configuration = "templateConfiguration"; +const char* template_layout = "template"; const char* icon_resumed = "iconResumed"; const char* nicknames = "nicknames"; const char* enabled = "enabled"; @@ -172,6 +179,7 @@ const char* hybrid_app_preference = "hybridAppPreference"; const char* is_cloud_application = "isCloudApplication"; const char* cloud_connection_status = "cloudConnectionStatus"; const char* endpoint = "endpoint"; +const char* display_capabilities = "displayCapabilities"; // PutFile const char* sync_file_name = "syncFileName"; @@ -380,6 +388,8 @@ const char* delivery_mode = "deliveryMode"; const char* audio_streaming_indicator = "audioStreamingIndicator"; +const char* windows_info = "windowsInfo"; + const char* const keyboard_properties_supported = "keyboardPropertiesSupported"; const char* const language_supported = "languageSupported"; const char* const keyboard_layout_supported = "keyboardLayoutSupported"; diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index 46d35bdbef..080b3f8f6a 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -69,7 +69,14 @@ using ::testing::Return; using ::testing::ReturnRef; using usage_statistics_test::MockStatisticsManager; -typedef void (ApplicationImpl::*AddSet)(HmiStatePtr args); +typedef void (ApplicationImpl::*AddSet)(const WindowID window_id, + HmiStatePtr args); + +namespace { +const WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +const std::string kDefaultWindowName = "DefaultName"; +} // namespace class ApplicationImplTest : public ::testing::Test { protected: @@ -106,7 +113,8 @@ class ApplicationImplTest : public ::testing::Test { mock_application_manager_)); HmiStatePtr initial_state = CreateTestHmiState(); - app_impl->SetInitialState(initial_state); + app_impl->SetInitialState( + kDefaultWindowId, kDefaultWindowName, initial_state); } virtual void TearDown() OVERRIDE { @@ -159,12 +167,12 @@ HmiStatePtr ApplicationImplTest::TestAddHmiState(HMILevel::eType hmi_lvl, test_lvl = hmi_lvl; state_id = id_state; HmiStatePtr state = CreateTestHmiState(); - ((app_impl.get())->*hmi_action)(state); + ((app_impl.get())->*hmi_action)(kDefaultWindowId, state); return state; } void ApplicationImplTest::CheckCurrentHMIState() { - HmiStatePtr current_state = app_impl->CurrentHmiState(); + HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId); EXPECT_EQ(test_lvl, current_state->hmi_level()); EXPECT_EQ(state_id, current_state->state_id()); } @@ -207,7 +215,7 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetRegularState) { HmiState::STATE_ID_VIDEO_STREAMING, &ApplicationImpl::AddHMIState); - HmiStatePtr current_state = app_impl->RegularHmiState(); + HmiStatePtr current_state = app_impl->RegularHmiState(kDefaultWindowId); EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level()); EXPECT_EQ(HmiState::STATE_ID_REGULAR, current_state->state_id()); EXPECT_EQ(app_id, app_impl->app_id()); @@ -228,8 +236,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveLastState) { CheckCurrentHMIState(); // Remove last state - app_impl->RemoveHMIState(state3->state_id()); - HmiStatePtr current_state = app_impl->CurrentHmiState(); + app_impl->RemoveHMIState(kDefaultWindowId, state3->state_id()); + HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId); EXPECT_EQ(state2, current_state); EXPECT_EQ(HMILevel::HMI_NONE, current_state->hmi_level()); EXPECT_EQ(HmiState::STATE_ID_VIDEO_STREAMING, current_state->state_id()); @@ -249,8 +257,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) { CheckCurrentHMIState(); // Remove not last state - app_impl->RemoveHMIState(state2->state_id()); - HmiStatePtr current_state = app_impl->CurrentHmiState(); + app_impl->RemoveHMIState(kDefaultWindowId, state2->state_id()); + HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId); EXPECT_EQ(state3, current_state); // HMI level is equal to parent hmi_level EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level()); @@ -272,8 +280,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) { CheckCurrentHMIState(); // Remove first added state - app_impl->RemoveHMIState(state1->state_id()); - HmiStatePtr current_state = app_impl->CurrentHmiState(); + app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id()); + HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId); EXPECT_EQ(state3, current_state); // Last state does not have a parent EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level()); @@ -295,8 +303,8 @@ TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) { CheckCurrentHMIState(); // Remove first state - app_impl->RemoveHMIState(state1->state_id()); - HmiStatePtr current_state = app_impl->CurrentHmiState(); + app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id()); + HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId); EXPECT_EQ(state3, current_state); // Last state has a parent EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level()); @@ -311,12 +319,12 @@ TEST_F(ApplicationImplTest, SetPostponedState_RemovePostponedState) { &ApplicationImpl::SetPostponedState); // Check that state was setted correctly - HmiStatePtr state2 = app_impl->PostponedHmiState(); + HmiStatePtr state2 = app_impl->PostponedHmiState(kDefaultWindowId); EXPECT_EQ(state1, state2); // Check that state was correctly removed - app_impl->RemovePostponedState(); - state2 = app_impl->PostponedHmiState(); + app_impl->RemovePostponedState(kDefaultWindowId); + state2 = app_impl->PostponedHmiState(kDefaultWindowId); EXPECT_EQ(nullptr, state2); } @@ -327,9 +335,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) { HmiState::STATE_ID_REGULAR, &ApplicationImpl::SetRegularState); - EXPECT_EQ(test_lvl, app_impl->hmi_level()); + EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId)); EXPECT_EQ(audiostate, app_impl->audio_streaming_state()); - EXPECT_EQ(syst_context, app_impl->system_context()); + EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId)); audiostate = AudioStreamingState::AUDIBLE; syst_context = SystemContext::SYSCTXT_MENU; @@ -337,9 +345,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) { HmiState::STATE_ID_VIDEO_STREAMING, &ApplicationImpl::AddHMIState); - EXPECT_EQ(test_lvl, app_impl->hmi_level()); + EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId)); EXPECT_EQ(audiostate, app_impl->audio_streaming_state()); - EXPECT_EQ(syst_context, app_impl->system_context()); + EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId)); } TEST_F(ApplicationImplTest, IsAudioApplication) { diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc index 1f4b94a991..1f0b705f41 100644 --- a/src/components/application_manager/test/application_manager_impl_test.cc +++ b/src/components/application_manager/test/application_manager_impl_test.cc @@ -102,6 +102,8 @@ connection_handler::DeviceHandle kDeviceId = 12345u; const std::string kAppId = "someID"; const uint32_t kConnectionKey = 1232u; const std::string kAppName = "appName"; +const WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; #if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT) // Cloud application params @@ -386,7 +388,7 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_VideoServiceStart) { const int32_t session_key = 123; EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); bool result = false; @@ -417,7 +419,7 @@ TEST_F(ApplicationManagerImplTest, EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); // is_navi() is false EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(false)); - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); bool result = false; @@ -448,7 +450,7 @@ TEST_F(ApplicationManagerImplTest, EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); // HMI level is not FULL nor LIMITED - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); bool result = false; @@ -478,7 +480,7 @@ TEST_F(ApplicationManagerImplTest, const int32_t session_key = 123; EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED)); bool result = false; @@ -562,7 +564,7 @@ TEST_F(ApplicationManagerImplTest, const int32_t session_key = 123; EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); bool result = false; @@ -636,7 +638,7 @@ TEST_F(ApplicationManagerImplTest, const int32_t session_key = 123; EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); bool result = false; @@ -671,7 +673,7 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_AudioServiceStart) { const int32_t session_key = 123; EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); bool result = false; @@ -701,7 +703,7 @@ TEST_F(ApplicationManagerImplTest, const int32_t session_key = 123; EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key)); EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_app_ptr_, hmi_level()) + EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); bool result = false; @@ -837,7 +839,7 @@ TEST_F(ApplicationManagerImplTest, .WillRepeatedly(Return(policy_app_id_switch)); const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL; - EXPECT_CALL(*switching_app_ptr, hmi_level()) + EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(hmi_level_switching_app)); std::shared_ptr<MockApplication> nonswitching_app_ptr = @@ -854,7 +856,7 @@ TEST_F(ApplicationManagerImplTest, .WillRepeatedly(Return(policy_app_id_nonswitch)); const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED; - EXPECT_CALL(*nonswitching_app_ptr, hmi_level()) + EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(hmi_level_nonswitching_app)); // Act @@ -903,7 +905,7 @@ TEST_F(ApplicationManagerImplTest, .WillRepeatedly(Return(policy_app_id_switch)); const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL; - EXPECT_CALL(*switching_app_ptr, hmi_level()) + EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(hmi_level_switching_app)); std::shared_ptr<MockApplication> nonswitching_app_ptr = @@ -925,7 +927,7 @@ TEST_F(ApplicationManagerImplTest, Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4)); const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED; - EXPECT_CALL(*nonswitching_app_ptr, hmi_level()) + EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(hmi_level_nonswitching_app)); // Act diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc index 5ebcdd29c7..22d111f926 100644 --- a/src/components/application_manager/test/application_state_test.cc +++ b/src/components/application_manager/test/application_state_test.cc @@ -50,6 +50,11 @@ using namespace mobile_apis; typedef HmiState::StateID StateID; namespace { + +const WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +const std::string kDefaultWindowName = "DefaultName"; + std::vector<StateID> GenerateCurrentStates() { std::vector<StateID> states; states.push_back(StateID::STATE_ID_PHONE_CALL); @@ -87,8 +92,8 @@ TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); - app_state.AddState(state); - EXPECT_EQ(state, app_state.GetState(current_id)); + app_state.AddState(kDefaultWindowId, state); + EXPECT_EQ(state, app_state.GetState(kDefaultWindowId, current_id)); } } @@ -99,16 +104,16 @@ TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); - HmiStatePtr curr_state = app_state.GetState(current_id); + HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id); ASSERT_EQ(*new_state, curr_state->state_id()); } new_state = added_states_.end() - 1; while (new_state != added_states_.begin()) { - app_state.RemoveState(*new_state); - HmiStatePtr curr_state = app_state.GetState(current_id); + app_state.RemoveState(kDefaultWindowId, *new_state); + HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id); --new_state; EXPECT_EQ(*new_state, curr_state->state_id()); } @@ -122,19 +127,20 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); } // Postponed state wasn't added - HmiStatePtr get_postponed_id = app_state.GetState(postponed_id); + HmiStatePtr get_postponed_id = + app_state.GetState(kDefaultWindowId, postponed_id); EXPECT_EQ(nullptr, get_postponed_id); // Add posponed state HmiStatePtr state = std::make_shared<HmiState>( static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); // Postponed state exists - get_postponed_id = app_state.GetState(postponed_id); + get_postponed_id = app_state.GetState(kDefaultWindowId, postponed_id); EXPECT_EQ(state, get_postponed_id); } @@ -146,7 +152,7 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) { app_mngr_, *new_state); state->set_hmi_level(HMILevel::HMI_FULL); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); ++new_state; // Add some other for (; new_state != added_states_.end(); ++new_state) { @@ -154,13 +160,14 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); state->set_hmi_level(HMILevel::HMI_LIMITED); } // Regular state will be the first added state new_state = added_states_.begin(); - HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR); + HmiStatePtr reg_state = + app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR); EXPECT_EQ(*new_state, reg_state->state_id()); EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level()); } @@ -171,7 +178,7 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); ++new_state; // Add postponed state @@ -179,10 +186,10 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); // Make sure that the state was added - HmiStatePtr post_state = app_state.GetState(postponed_id); + HmiStatePtr post_state = app_state.GetState(kDefaultWindowId, postponed_id); ASSERT_EQ(state, post_state); for (; new_state != added_states_.end(); ++new_state) { @@ -190,19 +197,20 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); } // Regular state will be the first added state new_state = added_states_.begin(); - HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR); + HmiStatePtr reg_state = + app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR); ASSERT_EQ(*new_state, reg_state->state_id()); - app_state.RemoveState(*new_state); + app_state.RemoveState(kDefaultWindowId, *new_state); ++new_state; // Now regular state is the next state except postponed - reg_state = app_state.GetState(StateID::STATE_ID_REGULAR); + reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR); EXPECT_EQ(*new_state, reg_state->state_id()); } @@ -213,14 +221,14 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, first_state); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); // Add postponed state state = std::make_shared<HmiState>( static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); // Add new postponed state std::shared_ptr<MockApplication> mock_app_2(new MockApplication); @@ -228,21 +236,22 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); // Add regular state state = std::make_shared<HmiState>( static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, StateID::STATE_ID_REGULAR); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); // Postponed state is the first - HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_POSTPONED); + HmiStatePtr reg_state = + app_state.GetState(kDefaultWindowId, StateID::STATE_ID_POSTPONED); ASSERT_EQ(postponed_id, reg_state->state_id()); // Regular state is the second one - reg_state = app_state.GetState(StateID::STATE_ID_REGULAR); + reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR); EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id()); } @@ -253,12 +262,14 @@ TEST_F(ApplicationStateTest, InitState_GetRegularState) { app_mngr_, init_state); - app_state.InitState(state); + app_state.InitState(kDefaultWindowId, kDefaultWindowName, state); - HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR); + HmiStatePtr reg_state = + app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR); EXPECT_EQ(state, reg_state); - HmiStatePtr curr_state = app_state.GetState(StateID::STATE_ID_CURRENT); + HmiStatePtr curr_state = + app_state.GetState(kDefaultWindowId, StateID::STATE_ID_CURRENT); EXPECT_EQ(state, curr_state); } @@ -271,23 +282,24 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { init_state); state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL); - app_state.InitState(state); + app_state.InitState(kDefaultWindowId, kDefaultWindowName, state); // Add postponed state state = std::make_shared<HmiState>( static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); - app_state.AddState(state); + app_state.AddState(kDefaultWindowId, state); // Make sure that state was added - HmiStatePtr get_postponed_state = app_state.GetState(postponed_id); + HmiStatePtr get_postponed_state = + app_state.GetState(kDefaultWindowId, postponed_id); ASSERT_EQ(state, get_postponed_state); // Remove postponed state - app_state.RemoveState(postponed_id); + app_state.RemoveState(kDefaultWindowId, postponed_id); - get_postponed_state = app_state.GetState(postponed_id); + get_postponed_state = app_state.GetState(kDefaultWindowId, postponed_id); EXPECT_EQ(nullptr, get_postponed_state); } @@ -298,13 +310,13 @@ TEST_F(ApplicationStateTest, static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, reg_state); - app_state.InitState(state); + app_state.InitState(kDefaultWindowId, kDefaultWindowName, state); // Try deleting regular state - app_state.RemoveState(reg_state); + app_state.RemoveState(kDefaultWindowId, reg_state); // Get regular state - HmiStatePtr get_reg_state = app_state.GetState(reg_state); + HmiStatePtr get_reg_state = app_state.GetState(kDefaultWindowId, reg_state); EXPECT_EQ(state, get_reg_state); } diff --git a/src/components/application_manager/test/help_prompt_manager_test.cc b/src/components/application_manager/test/help_prompt_manager_test.cc index dc6635b049..502c1bdbbf 100644 --- a/src/components/application_manager/test/help_prompt_manager_test.cc +++ b/src/components/application_manager/test/help_prompt_manager_test.cc @@ -65,6 +65,9 @@ const std::string kDirectoryName = "./test_storage"; const uint8_t expected_tread_pool_size = 2u; const uint8_t stop_streaming_timeout = 1u; const std::vector<std::string> kTimeoutPrompt{"timeoutPrompt"}; +const WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +const std::string kDefaultWindowName = "DefaultName"; } // namespace using namespace application_manager; @@ -244,7 +247,8 @@ void HelpPromptManagerTest::CreateApplication( app_mngr_, mock_help_prompt_manager)); HmiStatePtr initial_state = CreateTestHmiState(); - app_impl_->SetInitialState(initial_state); + app_impl_->SetInitialState( + kDefaultWindowId, kDefaultWindowName, initial_state); } TEST_F(HelpPromptManagerTest, AddCommand_OnVrCommandAdded) { diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h index 74d09661c7..36c33da0d3 100644 --- a/src/components/application_manager/test/include/application_manager/mock_application.h +++ b/src/components/application_manager/test/include/application_manager/mock_application.h @@ -34,6 +34,7 @@ #include <string> #include "application_manager/app_extension.h" #include "application_manager/application.h" +#include "application_manager/hmi_state.h" #include "application_manager/usage_statistics.h" #include "gmock/gmock.h" #include "smart_objects/smart_object.h" @@ -97,11 +98,15 @@ class MockApplication : public ::application_manager::Application { MOCK_METHOD1(set_folder_name, void(const std::string& folder_name)); MOCK_CONST_METHOD0(folder_name, const std::string()); MOCK_CONST_METHOD0(is_media_application, bool()); - MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType()); + MOCK_CONST_METHOD1(hmi_level, + const mobile_apis::HMILevel::eType( + const application_manager::WindowID window_id)); MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t()); MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t()); MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t()); - MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType()); + MOCK_CONST_METHOD1(system_context, + const mobile_apis::SystemContext::eType( + const application_manager::WindowID window_id)); MOCK_CONST_METHOD0(audio_streaming_state, const mobile_apis::AudioStreamingState::eType()); MOCK_CONST_METHOD0(video_streaming_state, @@ -109,11 +114,20 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(app_icon_path, const std::string&()); MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle()); MOCK_CONST_METHOD0(secondary_device, connection_handler::DeviceHandle()); - MOCK_CONST_METHOD0(CurrentHmiState, const application_manager::HmiStatePtr()); - MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr()); + MOCK_CONST_METHOD1(CurrentHmiState, + const application_manager::HmiStatePtr( + const application_manager::WindowID window_id)); + MOCK_CONST_METHOD1(RegularHmiState, + const application_manager::HmiStatePtr( + const application_manager::WindowID window_id)); + MOCK_CONST_METHOD0(GetWindowIds, application_manager::WindowIds()); + MOCK_CONST_METHOD0(GetWindowNames, application_manager::WindowNames()); + MOCK_CONST_METHOD1(WindowIdExists, + bool(const application_manager::WindowID window_id)); MOCK_CONST_METHOD0(IsAllowedToChangeAudioSource, bool()); - MOCK_CONST_METHOD0(PostponedHmiState, - const application_manager::HmiStatePtr()); + MOCK_CONST_METHOD1(PostponedHmiState, + const application_manager::HmiStatePtr( + const application_manager::WindowID window_id)); MOCK_METHOD1(set_tts_properties_in_none, void(bool active)); MOCK_METHOD0(tts_properties_in_none, bool()); MOCK_METHOD1(set_tts_properties_in_full, void(bool active)); @@ -167,14 +181,24 @@ class MockApplication : public ::application_manager::Application { ::application_manager::HelpPromptManager&()); MOCK_CONST_METHOD0(help_prompt_manager, const ::application_manager::HelpPromptManager&()); - MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state)); - MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state)); - MOCK_METHOD1(SetPostponedState, - void(::application_manager::HmiStatePtr state)); - MOCK_METHOD0(RemovePostponedState, void()); - MOCK_METHOD1(AddHMIState, void(::application_manager::HmiStatePtr state)); - MOCK_METHOD1(RemoveHMIState, - void(::application_manager::HmiState::StateID state_id)); + MOCK_METHOD3(SetInitialState, + void(const application_manager::WindowID window_id, + const std::string& window_name, + application_manager::HmiStatePtr state)); + MOCK_METHOD2(SetRegularState, + void(const application_manager::WindowID window_id, + application_manager::HmiStatePtr state)); + MOCK_METHOD2(SetPostponedState, + void(const application_manager::WindowID window_id, + ::application_manager::HmiStatePtr state)); + MOCK_METHOD1(RemovePostponedState, + void(const application_manager::WindowID window_id)); + MOCK_METHOD2(AddHMIState, + void(const application_manager::WindowID window_id, + application_manager::HmiStatePtr state)); + MOCK_METHOD2(RemoveHMIState, + void(const application_manager::WindowID window_id, + ::application_manager::HmiState::StateID state_id)); MOCK_METHOD2(SubscribeToSoftButtons, void(int32_t cmd_id, const ::application_manager::SoftButtonID& softbuttons_id)); @@ -220,9 +244,32 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*()); - MOCK_CONST_METHOD0(day_color_scheme, const smart_objects::SmartObject*()); - MOCK_CONST_METHOD0(night_color_scheme, const smart_objects::SmartObject*()); - MOCK_CONST_METHOD0(display_layout, const std::string&()); + MOCK_CONST_METHOD0(day_color_scheme, smart_objects::SmartObject()); + MOCK_CONST_METHOD0(night_color_scheme, smart_objects::SmartObject()); + MOCK_CONST_METHOD0(display_layout, std::string()); + MOCK_CONST_METHOD0(display_capabilities, smart_objects::SmartObjectSPtr()); + + MOCK_METHOD2(set_window_layout, + void(const application_manager::WindowID window_id, + const std::string& layout)); + MOCK_METHOD2(set_day_color_scheme, + void(const application_manager::WindowID window_id, + const smart_objects::SmartObject& color_scheme)); + MOCK_METHOD2(set_night_color_scheme, + void(const application_manager::WindowID window_id, + const smart_objects::SmartObject& color_scheme)); + MOCK_CONST_METHOD1( + window_layout, + std::string(const application_manager::WindowID window_id)); + MOCK_CONST_METHOD1(day_color_scheme, + smart_objects::SmartObject( + const application_manager::WindowID window_id)); + MOCK_CONST_METHOD1(night_color_scheme, + smart_objects::SmartObject( + const application_manager::WindowID window_id)); + MOCK_METHOD1(set_display_capabilities, + void(const smart_objects::SmartObject& display_capabilities)); + MOCK_METHOD1(load_global_properties, void(const smart_objects::SmartObject& so)); MOCK_METHOD1(set_help_prompt, @@ -316,9 +363,10 @@ class MockApplication : public ::application_manager::Application { SwapMobileMessageQueue, void(::application_manager::MobileMessageQueue& mobile_messages)); - MOCK_METHOD1( + MOCK_METHOD2( set_system_context, - void(const application_manager::mobile_api::SystemContext::eType&)); + void(const application_manager::WindowID window_id, + const application_manager::mobile_api::SystemContext::eType&)); MOCK_METHOD1( set_audio_streaming_state, void(const application_manager::mobile_api::AudioStreamingState::eType& @@ -329,9 +377,10 @@ class MockApplication : public ::application_manager::Application { bool(smart_objects::SmartObject module)); MOCK_METHOD1(UnsubscribeFromInteriorVehicleData, bool(smart_objects::SmartObject module)); - MOCK_METHOD1( + MOCK_METHOD2( set_hmi_level, - void(const application_manager::mobile_api::HMILevel::eType& hmi_level)); + void(const application_manager::WindowID window_id, + const application_manager::mobile_api::HMILevel::eType& hmi_level)); MOCK_METHOD1(QueryInterface, application_manager::AppExtensionPtr( application_manager::AppExtensionUID uid)); @@ -357,6 +406,13 @@ class MockApplication : public ::application_manager::Application { void(const mobile_apis::HybridAppPreference::eType& hybrid_app_preference)); MOCK_METHOD1(set_cloud_app_certificate, void(const std::string& certificate)); + MOCK_METHOD2(AddWindowInfo, + void(const ::application_manager::WindowID windowID, + const smart_objects::SmartObject& window_info)); + MOCK_METHOD1(RemoveWindowInfo, + void((const ::application_manager::WindowID window_id))); + MOCK_CONST_METHOD0(window_optional_params_map, + DataAccessor< ::application_manager::WindowParamsMap>()); }; } // namespace application_manager_test diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 6bd2c7fda6..aa140dfa49 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -91,6 +91,8 @@ using ::testing::SetArgReferee; typedef NiceMock<application_manager_test::MockRPCService> MockRPCService; const std::string kDummyData = "some_data"; +const WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; class PolicyHandlerTest : public ::testing::Test { public: @@ -236,7 +238,7 @@ class PolicyHandlerTest : public ::testing::Test { EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_)) .WillRepeatedly(Return(mock_app_)); EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); EXPECT_CALL(mock_message_helper_, StringToHMILevel(default_hmi_level)) @@ -552,14 +554,15 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string)) .WillOnce(Return(new_hmi_level)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); EXPECT_CALL(mock_message_helper_, SendOnPermissionsChangeNotification(kAppId1_, _, _)); EXPECT_CALL(app_manager_, state_controller()) .WillRepeatedly(ReturnRef(mock_state_controller)); - EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, true)); + EXPECT_CALL(mock_state_controller, + SetRegularState(_, kDefaultWindowId, new_hmi_level, true)); // Act Permissions perms; policy_handler_.OnPermissionsUpdated( @@ -580,14 +583,15 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string)) .WillOnce(Return(new_hmi_level)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE)); EXPECT_CALL(mock_message_helper_, SendOnPermissionsChangeNotification(kAppId1_, _, _)); EXPECT_CALL(app_manager_, state_controller()) .WillRepeatedly(ReturnRef(mock_state_controller)); - EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, false)); + EXPECT_CALL(mock_state_controller, + SetRegularState(_, kDefaultWindowId, new_hmi_level, false)); // Act Permissions perms; policy_handler_.OnPermissionsUpdated( @@ -607,7 +611,7 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string)) .WillOnce(Return(new_hmi_level)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_LIMITED)); EXPECT_CALL(mock_message_helper_, SendOnPermissionsChangeNotification(kAppId1_, _, _)); @@ -637,7 +641,8 @@ TEST_F(PolicyHandlerTest, CheckPermissions) { const uint32_t device = 3; const mobile_apis::HMILevel::eType hmi_level = mobile_apis::HMILevel::HMI_NONE; - EXPECT_CALL(*mock_app_, hmi_level()).WillOnce(Return(hmi_level)); + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) + .WillOnce(Return(hmi_level)); EXPECT_CALL(*mock_app_, device()).WillOnce(Return(device)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_)); EXPECT_CALL(*mock_policy_manager_, @@ -963,7 +968,8 @@ void PolicyHandlerTest::OnPendingPermissionChangePrecondition( EXPECT_CALL(app_manager_, application(_, _)).WillOnce(Return(application)); EXPECT_CALL(*application, app_id()).WillRepeatedly(Return(kAppId1_)); - EXPECT_CALL(*application, hmi_level()).WillRepeatedly(Return(hmi_level)); + EXPECT_CALL(*application, hmi_level(kDefaultWindowId)) + .WillRepeatedly(Return(hmi_level)); } TEST_F(PolicyHandlerTest, @@ -1998,7 +2004,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_GetDefaultMacAddress) { test_app.insert(mock_app_); EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL)); EXPECT_CALL(app_manager_, connection_handler()) .WillOnce(ReturnRef(conn_handler)); @@ -2021,7 +2027,7 @@ void PolicyHandlerTest::GetAppIDForSending() { // Check expectations EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL)); EXPECT_CALL(mock_session_observer, GetDataOnDeviceID( @@ -2048,7 +2054,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { const uint32_t app_in_full_id = 1; EXPECT_CALL(*mock_app_in_full, app_id()) .WillRepeatedly(Return(app_in_full_id)); - EXPECT_CALL(*mock_app_in_full, hmi_level()) + EXPECT_CALL(*mock_app_in_full, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL)); ON_CALL(*mock_app_in_full, IsRegistered()).WillByDefault(Return(true)); @@ -2060,7 +2066,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { const uint32_t app_in_limited_id = 2; EXPECT_CALL(*mock_app_in_limited, app_id()) .WillRepeatedly(Return(app_in_limited_id)); - EXPECT_CALL(*mock_app_in_limited, hmi_level()) + EXPECT_CALL(*mock_app_in_limited, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_LIMITED)); ON_CALL(*mock_app_in_limited, IsRegistered()).WillByDefault(Return(true)); @@ -2072,7 +2078,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { const uint32_t app_in_background_id = 3; EXPECT_CALL(*mock_app_in_background, app_id()) .WillRepeatedly(Return(app_in_background_id)); - EXPECT_CALL(*mock_app_in_background, hmi_level()) + EXPECT_CALL(*mock_app_in_background, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_BACKGROUND)); ON_CALL(*mock_app_in_background, IsRegistered()).WillByDefault(Return(true)); @@ -2083,7 +2089,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { const uint32_t app_in_none_id = 4; EXPECT_CALL(*mock_app_in_none, app_id()) .WillRepeatedly(Return(app_in_none_id)); - EXPECT_CALL(*mock_app_in_none, hmi_level()) + EXPECT_CALL(*mock_app_in_none, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE)); EXPECT_CALL(*mock_app_in_none, IsRegistered()).Times(0); @@ -2113,7 +2119,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) { const uint32_t app_in_none_id_1 = 1; EXPECT_CALL(*mock_app_in_none_1, app_id()) .WillRepeatedly(Return(app_in_none_id_1)); - EXPECT_CALL(*mock_app_in_none_1, hmi_level()) + EXPECT_CALL(*mock_app_in_none_1, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL)); ON_CALL(*mock_app_in_none_1, IsRegistered()).WillByDefault(Return(true)); @@ -2125,7 +2131,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) { const uint32_t app_in_none_id_2 = 2; EXPECT_CALL(*mock_app_in_none_2, app_id()) .WillRepeatedly(Return(app_in_none_id_2)); - EXPECT_CALL(*mock_app_in_none_2, hmi_level()) + EXPECT_CALL(*mock_app_in_none_2, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE)); ON_CALL(*mock_app_in_none_2, IsRegistered()).WillByDefault(Return(true)); @@ -2160,7 +2166,7 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); EXPECT_CALL(*mock_app_, policy_app_id()) .WillRepeatedly(Return(kPolicyAppId_)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true)); @@ -2187,7 +2193,7 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_)); EXPECT_CALL(*mock_app_, policy_app_id()) .WillRepeatedly(Return(kPolicyAppId_)); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE)); EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true)); @@ -2215,9 +2221,9 @@ TEST_F(PolicyHandlerTest, CanUpdate_TwoApplicationForSending_SUCCESS) { std::shared_ptr<application_manager_test::MockApplication> second_mock_app = std::make_shared<application_manager_test::MockApplication>(); - EXPECT_CALL(*mock_app_, hmi_level()) + EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); - EXPECT_CALL(*second_mock_app, hmi_level()) + EXPECT_CALL(*second_mock_app, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED)); EXPECT_CALL(*second_mock_app, app_id()).WillRepeatedly(Return(kAppId2_)); diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc index 29718b631c..516090c032 100644 --- a/src/components/application_manager/test/resumption/resumption_data_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_test.cc @@ -352,7 +352,8 @@ void ResumptionDataTest::PrepareData() { ON_CALL(*app_mock, curHash()).WillByDefault(ReturnRef(hash_)); ON_CALL(*app_mock, get_grammar_id()).WillByDefault(Return(grammar_id_)); ON_CALL(*app_mock, device()).WillByDefault(Return(device_handle_)); - ON_CALL(*app_mock, hmi_level()).WillByDefault(Return(hmi_level_)); + ON_CALL(*app_mock, hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillByDefault(Return(hmi_level_)); ON_CALL(*app_mock, app_id()).WillByDefault(Return(app_id_)); ON_CALL(*app_mock, hmi_app_id()).WillByDefault(Return(hmi_app_id_)); ON_CALL(*app_mock, IsAudioApplication()).WillByDefault(Return(is_audio_)); diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 1579341be7..461f67632c 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -277,9 +277,10 @@ class MockApplicationManager : public application_manager::ApplicationManager { void(uint32_t app_id, protocol_handler::ServiceType service_type, bool state)); - MOCK_CONST_METHOD5(CreateRegularState, + MOCK_CONST_METHOD6(CreateRegularState, application_manager::HmiStatePtr( application_manager::ApplicationSharedPtr app, + const mobile_apis::WindowType::eType window_type, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::VideoStreamingState::eType video_state, |