diff options
Diffstat (limited to 'src/components/policy/policy_external/include/policy')
5 files changed, 123 insertions, 16 deletions
diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h index 15eb51565d..19a475371d 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager.h +++ b/src/components/policy/policy_external/include/policy/cache_manager.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_CACHE_MANAGER_H_ #include <map> +#include "boost/optional.hpp" #include "policy/cache_manager_interface.h" #include "policy/pt_ext_representation.h" @@ -158,6 +159,11 @@ class CacheManager : public CacheManagerInterface { */ virtual const VehicleInfo GetVehicleInfo() const; + const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE; + + const boost::optional<std::string> LockScreenDismissalWarningMessage( + const std::string& language) const OVERRIDE; + /** * @brief Get a list of enabled cloud applications * @param enabled_apps List filled with the policy app id of each enabled @@ -283,7 +289,7 @@ class CacheManager : public CacheManagerInterface { std::vector<UserFriendlyMessage> GetUserFriendlyMsg( const std::vector<std::string>& msg_codes, const std::string& language, - const std::string& active_hmi_language); + const std::string& active_hmi_language) const; /** * @brief GetLockScreenIcon allows to obtain lock screen icon url; diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h index 980ad42dcd..0cbbb6df1f 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h @@ -35,6 +35,7 @@ #include <string> #include <vector> +#include "boost/optional.hpp" #include "policy/policy_table/types.h" #include "policy/pt_representation.h" @@ -270,6 +271,24 @@ class CacheManagerInterface { const std::string& policy_app_id) const = 0; /** + * @brief Returns state of the lock screen that could be able to be dismissed + * while connected to SDL, allowing users the ability to interact with the + * app. + * @return bool True if lock screen can be dismissed. + */ + virtual const boost::optional<bool> LockScreenDismissalEnabledState() + const = 0; + + /** + * @brief Returns lock screen warning message. In case when specified language + * is absent in policy table will be returned message on default language + * ("en-us"). Otherwise returns uninitialized boost::optional<std::string> + * @return std::string Lock screen warning message + */ + virtual const boost::optional<std::string> LockScreenDismissalWarningMessage( + const std::string& language) const = 0; + + /** * @brief Allows to update 'vin' field in module_meta table. * * @param new 'vin' value. @@ -290,7 +309,7 @@ class CacheManagerInterface { virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg( const std::vector<std::string>& msg_codes, const std::string& language, - const std::string& active_hmi_language) = 0; + const std::string& active_hmi_language) const = 0; /** * @brief Get list of URL to send PTS to diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index 2f8f6cf070..261f66a3b2 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -122,6 +122,7 @@ class PolicyManagerImpl : public PolicyManager { * @brief Check if specified RPC for specified application * has permission to be executed in specified HMI Level * and also its permitted params. + * @param device_id device identifier * @param app_id Id of application provided during registration * @param hmi_level Current HMI Level of application * @param rpc Name of RPC @@ -129,7 +130,8 @@ class PolicyManagerImpl : public PolicyManager { * @param result containing flag if HMI Level is allowed * and list of allowed params. */ - void CheckPermissions(const PTString& app_id, + void CheckPermissions(const PTString& device_id, + const PTString& app_id, const PTString& hmi_level, const PTString& rpc, const RPCParams& rpc_params, @@ -148,6 +150,11 @@ class PolicyManagerImpl : public PolicyManager { */ void KmsChanged(int kilometers) OVERRIDE; + const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE; + + const boost::optional<std::string> LockScreenDismissalWarningMessage( + const std::string& language) const OVERRIDE; + /** * @brief Increments counter of ignition cycles */ @@ -262,12 +269,15 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Update Application Policies as reaction * on User allowing/disallowing device this app is running on. + * @param device_handle device identifier * @param app_id Unique application id * @param is_device_allowed true if user allowing device otherwise false * @return true if operation was successful */ - bool ReactOnUserDevConsentForApp(const std::string& app_id, - const bool is_device_allowed) OVERRIDE; + bool ReactOnUserDevConsentForApp( + const transport_manager::DeviceHandle& device_handle, + const std::string& app_id, + const bool is_device_allowed) OVERRIDE; /** * @brief Retrieves data from app_policies about app on its registration: @@ -310,12 +320,14 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Get default HMI level for application + * @param device_id device identifier * @param policy_app_id Unique application id * @param default_hmi Default HMI level for application or empty, if value * was not set * @return true, if succedeed, otherwise - false */ - bool GetDefaultHmi(const std::string& policy_app_id, + bool GetDefaultHmi(const std::string& device_id, + const std::string& policy_app_id, std::string* default_hmi) const OVERRIDE; /** @@ -360,9 +372,11 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Return device id, which hosts specific application + * @param device_id device identifier * @param policy_app_id Application id, which is required to update device id */ std::string& GetCurrentDeviceId( + const transport_manager::DeviceHandle& device_id, const std::string& policy_app_id) const OVERRIDE; /** @@ -404,11 +418,12 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Gets specific application permissions changes since last policy * table update + * @param device_id device identifier * @param policy_app_id Unique application id * @return Permissions changes */ AppPermissions GetAppPermissionsChanges( - const std::string& policy_app_id) OVERRIDE; + const std::string& device_id, const std::string& policy_app_id) OVERRIDE; /** * @brief Removes specific application permissions changes @@ -418,10 +433,11 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Send OnPermissionsUpdated for choosen application + * @param device_id device identifier * @param application_id Unique application id */ void SendNotificationOnPermissionsUpdated( - const std::string& application_id) OVERRIDE; + const std::string& device_id, const std::string& application_id) OVERRIDE; /** * @brief Removes unpaired device records and related records from DB @@ -452,20 +468,24 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Adds, application to the db or update existed one * run PTU if policy update is necessary for application. + * @param device_id device identifier * @param application_id Unique application id * @param hmi_types application HMI types * @return function that will notify update manager about new application */ StatusNotifier AddApplication( + const std::string& device_id, const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE; /** * @brief Assigns new HMI types for specified application + * @param device_handle device identifier * @param application_id Unique application id * @param hmi_types new HMI types list */ - void SetDefaultHmiTypes(const std::string& application_id, + void SetDefaultHmiTypes(const transport_manager::DeviceHandle& device_handle, + const std::string& application_id, const std::vector<int>& hmi_types) OVERRIDE; /** @@ -559,10 +579,12 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Gets request types for application + * @param device_handle device identifier * @param policy_app_id Unique application id * @return request types of application */ const std::vector<std::string> GetAppRequestTypes( + const transport_manager::DeviceHandle& device_handle, const std::string policy_app_id) const OVERRIDE; /** @@ -684,10 +706,13 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief OnAppRegisteredOnMobile allows to handle event when application were * succesfully registered on mobile device. - * It will send OnAppPermissionSend notification and will try to start PTU. * + * It will send OnAppPermissionSend notification and will try to start PTU. + * + * @param device_id device identifier * @param application_id registered application. */ - void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE; + void OnAppRegisteredOnMobile(const std::string& device_id, + const std::string& application_id) OVERRIDE; void OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) OVERRIDE; @@ -851,6 +876,17 @@ class PolicyManagerImpl : public PolicyManager { const std::shared_ptr<policy_table::Table> snapshot); /** + * @brief Compares current policies to the updated one. + * Trigger actions in case if certain fields after udate was changes. + * This function should be called after PT update. + * Actions require already updated policy table + * @param update Shared pointer to policy table udpate + * @param snapshot Shared pointer to old copy of policy table + */ + void CheckPermissionsChangesAfterUpdate(const policy_table::Table& update, + const policy_table::Table& snapshot); + + /** * @brief Processes results from policy table update analysis done by * CheckPermissionsChanges() by filling ApplicationsPoliciesActions struct * with actions which should be done for every application and passes them to @@ -902,19 +938,23 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Allows to process case when added application is not present in * policy db. + * @param device_id device identifier * @param policy application id. * @param cuuren consent for application's device. */ - void AddNewApplication(const std::string& application_id, + void AddNewApplication(const std::string& device_id, + const std::string& application_id, DeviceConsent device_consent); /** * @brief Allows to process case when added application is already * in policy db. + * @param device_id device identifier * @param policy application id. * @param cuuren consent for application's device. */ - void PromoteExistedApplication(const std::string& application_id, + void PromoteExistedApplication(const std::string& device_id, + const std::string& application_id, DeviceConsent device_consent); /** @@ -932,9 +972,12 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Checks whether need ask the permission of users + * @param device_id device identifier + * @param appid policy application id * @return true if user consent is needed */ - virtual bool IsConsentNeeded(const std::string& app_id); + virtual bool IsConsentNeeded(const std::string& device_id, + const std::string& app_id); /** * @brief Changes isConsentNeeded for app pending permissions, in case @@ -1020,11 +1063,13 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Notify application about its permissions changes by preparing and * sending OnPermissionsChanged notification + * @param device_id device identifier * @param policy_app_id Application id to send notification to * @param app_group_permissons Current permissions for groups assigned to * application */ void NotifyPermissionsChanges( + const std::string& device_id, const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& app_group_permissions); @@ -1049,11 +1094,13 @@ class PolicyManagerImpl : public PolicyManager { * user consents (if any) and ExternalConsent consents (if any) will be * updated * appropiately to current ExternalConsent status stored by policy table + * @param device_id device identifier * @param application_id Application id * @param processing_policy Defines whether consents timestamps must be * considered or external consents take over */ void ProcessExternalConsentStatusForApp( + const std::string& device_id, const std::string& application_id, const ConsentProcessingPolicy processing_policy); /** @@ -1081,16 +1128,20 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief Notifies system by sending OnAppPermissionChanged notification + * @param device_id device identifier * @param app_policy Reference to application policy */ - void NotifySystem(const AppPoliciesValueType& app_policy) const; + void NotifySystem(const std::string& device_id, + const AppPoliciesValueType& app_policy) const; /** * @brief Sends OnPermissionChange notification to application if its * currently registered + * @param device_id device identifier * @param app_policy Reference to application policy */ - void SendPermissionsToApp(const AppPoliciesValueType& app_policy); + void SendPermissionsToApp(const std::string& device_id, + const AppPoliciesValueType& app_policy); /** * @brief Gets groups names from collection of groups permissions diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h index 28b0caf95b..d3aee9dcf8 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h @@ -472,6 +472,36 @@ enum FunctionID { PerformAppServiceInteractionID = 55, /** + * @brief UnpublishAppServiceID. + */ + UnpublishAppServiceID = 56, + + /** + * @brief CancelInteractionID. + */ + CancelInteractionID = 57, + + /** + * @brief CloseApplicationID. + */ + CloseApplicationID = 58, + + /** + * @brief ShowAppMenuID. + */ + ShowAppMenuID = 59, + + /** + * @brief CreateWindowID. + */ + CreateWindowID = 60, + + /** + * @brief DeleteWindowID. + */ + DeleteWindowID = 61, + + /** * @brief OnHMIStatusID. */ OnHMIStatusID = 32768, diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h index 994fd86579..8795e2690f 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/types.h +++ b/src/components/policy/policy_external/include/policy/policy_table/types.h @@ -364,6 +364,7 @@ struct ModuleConfig : CompositeType { Optional<String<0, 65535> > certificate; Optional<Boolean> preloaded_pt; Optional<Boolean> full_app_id_supported; + Optional<Boolean> lock_screen_dismissal_enabled; public: ModuleConfig(); |