diff --git a/interfaces/inner_api/ability_manager/include/ability_first_frame_state_data.h b/interfaces/inner_api/ability_manager/include/ability_first_frame_state_data.h index f1b32351c6..338a24e588 100644 --- a/interfaces/inner_api/ability_manager/include/ability_first_frame_state_data.h +++ b/interfaces/inner_api/ability_manager/include/ability_first_frame_state_data.h @@ -48,11 +48,11 @@ struct AbilityFirstFrameStateData : public Parcelable { */ static AbilityFirstFrameStateData *Unmarshalling(Parcel &parcel); + bool coldStart = false; + int32_t appIndex; std::string bundleName; std::string moduleName; std::string abilityName; - int32_t appIndex; - bool coldStart = false; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/abilitymgr/include/ability_cache_manager.h b/services/abilitymgr/include/ability_cache_manager.h index 3910b35d1b..e2bbac389f 100644 --- a/services/abilitymgr/include/ability_cache_manager.h +++ b/services/abilitymgr/include/ability_cache_manager.h @@ -121,12 +121,12 @@ public: uint32_t devLruCapacity_ = 0; uint32_t procLruCapacity_ = 0; uint32_t devLruCnt_ = 0; - std::mutex mutex_; std::map procLruMap_; std::list> devRecLru_; std::shared_ptr AddToProcLru(std::shared_ptr abilityRecord); std::shared_ptr AddToDevLru(std::shared_ptr abilityRecord, std::shared_ptr rec); + std::mutex mutex_; void RemoveAbilityRecInDevList(std::shared_ptr abilityRecord); void RemoveAbilityRecInProcList(std::shared_ptr abilityRecord); std::shared_ptr GetAbilityRecInProcList(const AbilityRequest &abilityRequest); diff --git a/services/abilitymgr/include/ability_connect_manager.h b/services/abilitymgr/include/ability_connect_manager.h index ab52482da2..451118741c 100644 --- a/services/abilitymgr/include/ability_connect_manager.h +++ b/services/abilitymgr/include/ability_connect_manager.h @@ -647,37 +647,31 @@ private: const std::string TASK_ON_CALLBACK_DIED = "OnCallbackDiedTask"; const std::string TASK_ON_ABILITY_DIED = "OnAbilityDiedTask"; - ffrt::mutex serialMutex_; + int userId_; + uint32_t sceneBoardTokenId_ = 0; - std::mutex connectMapMutex_; - ConnectMapType connectMap_; - - ffrt::mutex serviceMapMutex_; + ConnectMapType connectMap_; ServiceMapType serviceMap_; - std::list> terminatingExtensionList_; - - std::mutex recipientMapMutex_; - RecipientMapType recipientMap_; - - std::mutex uiExtRecipientMapMutex_; + RecipientMapType recipientMap_; RecipientMapType uiExtRecipientMap_; - + UIExtensionMapType uiExtensionMap_; + WindowExtensionMapType windowExtensionMap_; + + std::list> terminatingExtensionList_; std::shared_ptr taskHandler_; std::shared_ptr eventHandler_; - int userId_; std::vector restartResidentTaskList_; - - std::mutex startServiceReqListLock_; std::unordered_map>> startServiceReqList_; - - std::mutex uiExtensionMapMutex_; - UIExtensionMapType uiExtensionMap_; - - std::mutex windowExtensionMapMutex_; - WindowExtensionMapType windowExtensionMap_; - + std::unique_ptr uiExtensionAbilityRecordMgr_ = nullptr; - uint32_t sceneBoardTokenId_ = 0; + ffrt::mutex serialMutex_; + std::mutex connectMapMutex_; + ffrt::mutex serviceMapMutex_; + std::mutex recipientMapMutex_; + std::mutex uiExtRecipientMapMutex_; + std::mutex uiExtensionMapMutex_; + std::mutex windowExtensionMapMutex_; + std::mutex startServiceReqListLock_; DISALLOW_COPY_AND_MOVE(AbilityConnectManager); }; diff --git a/services/abilitymgr/include/ability_first_frame_state_observer_manager.h b/services/abilitymgr/include/ability_first_frame_state_observer_manager.h index 9c5fe61ab5..7a4aa79b7c 100644 --- a/services/abilitymgr/include/ability_first_frame_state_observer_manager.h +++ b/services/abilitymgr/include/ability_first_frame_state_observer_manager.h @@ -43,10 +43,10 @@ protected: void RemoveObserverDeathRecipient(const sptr &observer); private: - ffrt::mutex observerLock_; + bool isNotifyAllBundles_; AbilityFirstFrameStateObserverMap observerMap_; std::map, sptr> recipientMap_; - bool isNotifyAllBundles_; + ffrt::mutex observerLock_; }; class AbilityFirstFrameStateObserverManager { diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 90493360a9..222c54e709 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -2437,38 +2437,8 @@ private: void StartKeepAliveAppsInner(int32_t userId); - sptr windowVisibilityChangedListener_; - std::shared_ptr taskHandler_; - std::shared_ptr eventHandler_; - ServiceRunningState state_; - - std::shared_ptr freeInstallManager_; - - std::shared_ptr subManagersHelper_; - - std::shared_ptr userController_; - sptr abilityController_ = nullptr; bool controllerIsAStabilityTest_ = false; - std::unordered_set windowVisibleList_; - - ffrt::mutex globalLock_; - ffrt::mutex bgtaskObserverMutex_; - ffrt::mutex abilityTokenLock_; - ffrt::mutex preStartSessionMapLock_; - ffrt::mutex windowVisibleListLock_; - - std::multimap timeoutMap_; - std::map> preStartSessionMap_; - - static sptr instance_; - int32_t uniqueId_ = 0; - ffrt::mutex iAcquireShareDataMapLock_; - std::map>> iAcquireShareDataMap_; - // first is callstub, second is ability token - std::map, sptr> callStubTokenMap_; -#ifdef SUPPORT_GRAPHICS - sptr focusListener_; -#endif // SUPPORT_GRAPHICS + bool isParamStartAbilityEnable_ = false; // Component StartUp rule switch bool startUpNewRule_ = true; /** It only takes effect when startUpNewRule_ is TRUE @@ -2486,12 +2456,37 @@ private: * FALSE: white list unable. */ bool whiteListassociatedWakeUpFlag_ = true; + bool isPrepareTerminateEnable_ = false; + bool shouldBlockAllAppStart_ = false; + + int32_t uniqueId_ = 0; + std::unordered_set windowVisibleList_; + + sptr windowVisibilityChangedListener_; + std::shared_ptr taskHandler_; + std::shared_ptr eventHandler_; + ServiceRunningState state_; + + std::shared_ptr freeInstallManager_; + std::shared_ptr subManagersHelper_; + std::shared_ptr userController_; + sptr abilityController_ = nullptr; + + std::multimap timeoutMap_; + std::map> preStartSessionMap_; + + static sptr instance_; + std::map>> iAcquireShareDataMap_; + // first is callstub, second is ability token + std::map, sptr> callStubTokenMap_; +#ifdef SUPPORT_GRAPHICS + sptr focusListener_; +#endif // SUPPORT_GRAPHICS std::shared_ptr screenSubscriber_; std::shared_ptr abilityAutoStartupService_; - std::mutex whiteListMutex_; std::map> whiteListMap_; std::list exportWhiteList_; @@ -2503,8 +2498,6 @@ private: bool IsInWhiteList(const std::string &callerBundleName, const std::string &calleeBundleName, const std::string &calleeAbilityName); - bool isParamStartAbilityEnable_ = false; - std::string GetConfigFileAbsolutePath(const std::string &relativePath); int32_t ParseJsonValueFromFile(nlohmann::json &value, const std::string& fullPath); @@ -2534,31 +2527,35 @@ private: sptr abilityBundleEventCallback_; #ifdef SUPPORT_SCREEN - int32_t ShowPickerDialog(const Want& want, int32_t userId, const sptr &token); + bool isAnimationEnabled_ = true; //only use on mission list bool CheckWindowMode(int32_t windowMode, const std::vector& windowModes) const; + int32_t ShowPickerDialog(const Want& want, int32_t userId, const sptr &token); void InitFocusListener(); void RegisterFocusListener(); void InitPrepareTerminateConfig(); std::shared_ptr implicitStartProcessor_; sptr wmsHandler_; - bool isAnimationEnabled_ = true; //only use on mission list #endif std::shared_ptr interceptorExecuter_; std::shared_ptr afterCheckExecuter_; std::unordered_map appRecoveryHistory_; // uid:time - bool isPrepareTerminateEnable_ = false; std::multimap, std::greater> startAbilityChain_; - - ffrt::mutex collaboratorMapLock_; std::unordered_map> collaboratorMap_; - ffrt::mutex abilityDebugDealLock_; std::shared_ptr abilityDebugDeal_; std::shared_ptr appExitReasonHelper_; + ffrt::mutex globalLock_; + ffrt::mutex bgtaskObserverMutex_; + ffrt::mutex abilityTokenLock_; + ffrt::mutex preStartSessionMapLock_; + ffrt::mutex windowVisibleListLock_; + ffrt::mutex iAcquireShareDataMapLock_; + ffrt::mutex collaboratorMapLock_; + ffrt::mutex abilityDebugDealLock_; ffrt::mutex shouldBlockAllAppStartMutex_; - bool shouldBlockAllAppStart_ = false; + std::mutex whiteListMutex_; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/ability_manager_xcollie.h b/services/abilitymgr/include/ability_manager_xcollie.h index e877278bfa..af42586460 100644 --- a/services/abilitymgr/include/ability_manager_xcollie.h +++ b/services/abilitymgr/include/ability_manager_xcollie.h @@ -34,9 +34,9 @@ public: static const uint32_t TIME_OUT_SECONDS; private: + bool isCanceled_ = false; int32_t id_ = -1; std::string tag_; - bool isCanceled_ = false; }; } } diff --git a/services/abilitymgr/include/ability_record.h b/services/abilitymgr/include/ability_record.h index 215fb0318d..dbb18ed0f7 100644 --- a/services/abilitymgr/include/ability_record.h +++ b/services/abilitymgr/include/ability_record.h @@ -156,13 +156,13 @@ private: */ struct CallerAbilityInfo { public: - std::string callerBundleName; - std::string callerAbilityName; int32_t callerTokenId = 0; int32_t callerUid = 0; int32_t callerPid = 0; - std::string callerNativeName; int32_t callerAppCloneIndex = 0; + std::string callerNativeName; + std::string callerBundleName; + std::string callerAbilityName; }; /** @@ -243,53 +243,46 @@ enum CollaboratorType { }; struct AbilityRequest { - Want want; - AppExecFwk::AbilityInfo abilityInfo; - AppExecFwk::ApplicationInfo appInfo; - int32_t uid = 0; - int requestCode = -1; bool restart = false; - int32_t restartCount = -1; - int64_t restartTime = 0; bool startRecent = false; + bool uriReservedFlag = false; + bool isFromIcon = false; + bool isShellCall = false; + // ERMS embedded atomic service + bool isQueryERMS = false; + bool isEmbeddedAllowed = false; + bool callSpecifiedFlagTimeout = false; + int32_t restartCount = -1; + int32_t uid = 0; int32_t collaboratorType = CollaboratorType::DEFAULT_TYPE; - - // call ability - int callerUid = -1; - AbilityCallType callType = AbilityCallType::INVALID_TYPE; - sptr callerToken = nullptr; int32_t callerTokenRecordId = -1; - sptr asCallerSourceToken = nullptr; + int32_t userId = -1; uint32_t callerAccessTokenId = -1; + uint32_t specifyTokenId = 0; + int callerUid = -1; // call ability + int requestCode = -1; + AbilityCallType callType = AbilityCallType::INVALID_TYPE; // call ability + int64_t restartTime = 0; + sptr callerToken = nullptr; // call ability + sptr asCallerSourceToken = nullptr; // call ability sptr connect = nullptr; - - std::vector supportWindowModes; + sptr abilityInfoCallback = nullptr; + sptr sessionInfo; std::shared_ptr startSetting = nullptr; std::shared_ptr processOptions = nullptr; std::shared_ptr startWindowOption = nullptr; - std::string specifiedFlag; - int32_t userId = -1; - bool callSpecifiedFlagTimeout = false; - sptr abilityInfoCallback = nullptr; - + std::vector supportWindowModes; AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED; AppExecFwk::ExtensionProcessMode extensionProcessMode = AppExecFwk::ExtensionProcessMode::UNDEFINED; + std::pair IsContinuation() const + std::string specifiedFlag; std::string customProcess; - - sptr sessionInfo; - uint32_t specifyTokenId = 0; - bool uriReservedFlag = false; std::string reservedBundleName; - bool isFromIcon = false; - bool isShellCall = false; - - // ERMS embedded atomic service - bool isQueryERMS = false; std::string appId; std::string startTime; - bool isEmbeddedAllowed = false; - - std::pair IsContinuation() const + Want want; + AppExecFwk::AbilityInfo abilityInfo; + AppExecFwk::ApplicationInfo appInfo; { auto flags = want.GetFlags(); if ((flags & Want::FLAG_ABILITY_CONTINUATION) == Want::FLAG_ABILITY_CONTINUATION) { @@ -1252,24 +1245,64 @@ private: #endif static int64_t abilityRecordId; - int recordId_ = 0; // record id + bool isReady_ = false; // is ability thread attached? + bool isWindowStarted_ = false; // is window hotstart or coldstart? + bool isWindowAttached_ = false; // Is window of this ability attached? + bool isLauncherAbility_ = false; // is launcher? + bool isLoading_ = false; // is loading? + bool isTerminating_ = false; // is terminating ? + bool isCreateByConnect_ = false; // is created by connect ability mode? + bool isUninstall_ = false; + bool isLauncherRoot_ = false; + bool isSwitchingPause_ = false; + /** + * When this ability startAbilityForResult another ability, if another ability is terminated, + * this ability will move to foreground, during this time, isAbilityForegrounding_ is true, + * isAbilityForegrounding_ will be set to false when this ability is background + */ + bool isAbilityForegrounding_ = false; + bool isRestarting_ = false; // is restarting ? + bool isStartedByCall_ = false; // new version + bool isStartToBackground_ = false; // new version + bool isStartToForeground_ = false; // new version + bool minimizeReason_ = false; // new version + bool clearMissionFlag_ = false; + bool keepAliveBundle_ = false; + bool isNeedBackToOtherMissionStack_ = false; + bool lockedState_ = false; + bool isAttachDebug_ = false; + bool isAssertDebug_ = false; + bool isAppAutoStartup_ = false; + bool isConnected = false; + bool isRestartApp_ = false; // Only app calling RestartApp can be set to true + bool isLaunching_ = true; + bool securityFlag_ = false; + std::atomic_bool isCallerSetProcess_ = false; // new version + std::atomic_bool backgroundAbilityWindowDelayed_ = false; + int32_t uiExtensionAbilityId_ = 0; // uiextension ability id + int32_t uid_ = 0; + int32_t pid_ = 0; + int32_t missionId_ = -1; + int32_t ownerMissionUserId_ = -1; + uint32_t extensionProcessMode_ = 0; // new version + int32_t appIndex_ = 0; // new version + int32_t restartCount_ = -1; + int32_t restartMax_ = -1; + int32_t collaboratorType_ = 0; + uint32_t callerAccessTokenId_ = -1; + uint32_t specifyTokenId_ = 0; + + int recordId_ = 0; // record id + int requestCode_ = -1; // requestCode_: >= 0 for-result start mode; <0 for normal start mode in default. + int startId_ = 0; // service(ability) start id + AppExecFwk::AbilityInfo abilityInfo_ = {}; // the ability info get from BMS std::weak_ptr preAbilityRecord_ = {}; // who starts this ability record std::weak_ptr nextAbilityRecord_ = {}; // ability that started by this ability int64_t startTime_ = 0; // records first time of ability start int64_t restartTime_ = 0; // the time of last trying restart - bool isReady_ = false; // is ability thread attached? - bool isWindowStarted_ = false; // is window hotstart or coldstart? - bool isWindowAttached_ = false; // Is window of this ability attached? - bool isLauncherAbility_ = false; // is launcher? - sptr scheduler_ = {}; // kit scheduler - bool isLoading_ = false; // is loading? - bool isTerminating_ = false; // is terminating ? - bool isCreateByConnect_ = false; // is created by connect ability mode? - - int requestCode_ = -1; // requestCode_: >= 0 for-result start mode; <0 for normal start mode in default. sptr schedulerDeathRecipient_ = {}; // scheduler binderDied Recipient /** @@ -1279,56 +1312,25 @@ private: */ std::shared_ptr result_ = {}; - /** - * When this ability startAbilityForResult another ability, if another ability is terminated, - * this ability will move to foreground, during this time, isAbilityForegrounding_ is true, - * isAbilityForegrounding_ will be set to false when this ability is background - */ - bool isAbilityForegrounding_ = false; // service(ability) can be connected by multi-pages(abilities), so need to store this service's connections mutable ffrt::mutex connRecordListMutex_; std::list> connRecordList_ = {}; // service(ability) onConnect() return proxy of service ability sptr connRemoteObject_ = {}; - int startId_ = 0; // service(ability) start id // page(ability) can be started by multi-pages(abilities), so need to store this ability's caller std::list> callerList_ = {}; - bool isUninstall_ = false; - - bool isLauncherRoot_ = false; - PacMap stateDatas_; // ability saved ability state data WindowConfig windowConfig_; - bool isRestarting_ = false; // is restarting ? AppState appState_ = AppState::BEGIN; - int32_t uid_ = 0; - int32_t pid_ = 0; - int32_t missionId_ = -1; - int32_t ownerMissionUserId_ = -1; - bool isSwitchingPause_ = false; - - // new version - std::shared_ptr callContainer_ = nullptr; - bool isStartedByCall_ = false; - bool isStartToBackground_ = false; - bool isStartToForeground_ = false; - std::atomic_bool isCallerSetProcess_ = false; - std::string customProcessFlag_ = ""; - uint32_t extensionProcessMode_ = 0; - int32_t appIndex_ = 0; - bool minimizeReason_ = false; - - bool clearMissionFlag_ = false; - bool keepAliveBundle_ = false; - int32_t restartCount_ = -1; - int32_t restartMax_ = -1; + std::shared_ptr callContainer_ = nullptr; // new version + std::string customProcessFlag_ = ""; // new version std::string specifiedFlag_; std::string uri_; - ffrt::mutex lock_; + mutable ffrt::mutex dumpInfoLock_; mutable ffrt::mutex dumpLock_; mutable ffrt::mutex resultLock_; @@ -1346,35 +1348,23 @@ private: #ifdef SUPPORT_SCREEN bool isStartingWindow_ = false; - uint32_t bgColor_ = 0; - std::shared_ptr startingWindowBg_ = nullptr; - bool isCompleteFirstFrameDrawing_ = false; bool coldStart_ = false; + uint32_t bgColor_ = 0; + std::shared_ptr startingWindowBg_ = nullptr; #endif - uint32_t callerAccessTokenId_ = -1; - bool isNeedBackToOtherMissionStack_ = false; std::weak_ptr otherMissionStackAbilityRecord_; // who starts this ability record by SA - int32_t collaboratorType_ = 0; - std::string missionAffinity_ = ""; - bool lockedState_ = false; - bool isAttachDebug_ = false; - bool isAssertDebug_ = false; - bool isAppAutoStartup_ = false; - bool isConnected = false; - std::atomic_bool backgroundAbilityWindowDelayed_ = false; - - bool isRestartApp_ = false; // Only app calling RestartApp can be set to true - uint32_t specifyTokenId_ = 0; std::shared_ptr connectWant_ = nullptr; std::shared_ptr saCallerInfo_ = nullptr; - ffrt::mutex connectWantLock_; - bool isLaunching_ = true; LaunchDebugInfo launchDebugInfo_; + std::string instanceKey_ = ""; - bool securityFlag_ = false; + std::string missionAffinity_ = ""; + + ffrt::mutex lock_; + ffrt::mutex connectWantLock_; std::mutex collaborateWantLock_; }; } // namespace AAFwk diff --git a/services/abilitymgr/include/ams_configuration_parameter.h b/services/abilitymgr/include/ams_configuration_parameter.h index 052d1e663a..d1f9ec2e8d 100644 --- a/services/abilitymgr/include/ams_configuration_parameter.h +++ b/services/abilitymgr/include/ams_configuration_parameter.h @@ -164,24 +164,26 @@ private: private: bool nonConfigFile_ {false}; + bool supportBackToCaller_ {true}; + bool supportSceneboardCrashReboot_{true}; + int maxRootLauncherRestartNum_ = 0; int maxResidentRestartNum_ = 0; int restartIntervalTime_ {120000}; - std::string orientation_ {""}; int missionSaveTime_ {12 * 60 * 60 * 1000}; int anrTime_ {5000}; int amsTime_ {5000}; int bootAnimationTime_ {5}; int timeoutUnitTime_ {1000}; + int multiUserType_ {0}; + + std::vector residentWhiteList_; + std::string orientation_ {""}; std::string bundleName_ {""}; std::string abilityName_ {""}; std::string pickerType_ {""}; - nlohmann::json pickerJsonObject_ = nlohmann::json::object(); std::map picker_; - int multiUserType_ {0}; - bool supportBackToCaller_ {true}; - bool supportSceneboardCrashReboot_{true}; - std::vector residentWhiteList_; + nlohmann::json pickerJsonObject_ = nlohmann::json::object(); }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/app_scheduler.h b/services/abilitymgr/include/app_scheduler.h index 089b2549a1..a2c05c437d 100644 --- a/services/abilitymgr/include/app_scheduler.h +++ b/services/abilitymgr/include/app_scheduler.h @@ -645,12 +645,12 @@ protected: virtual void NotifyAppPreCache(int32_t pid, int32_t userId) override; private: - std::mutex lock_; bool isInit_ {false}; + AppAbilityState appAbilityState_ = AppAbilityState::ABILITY_STATE_UNDEFINED; std::weak_ptr callback_; std::unique_ptr appMgrClient_; - AppAbilityState appAbilityState_ = AppAbilityState::ABILITY_STATE_UNDEFINED; sptr startSpecifiedAbilityResponse_; + std::mutex lock_; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/background_task_observer.h b/services/abilitymgr/include/background_task_observer.h index f7a03e3f90..14e8a78f56 100644 --- a/services/abilitymgr/include/background_task_observer.h +++ b/services/abilitymgr/include/background_task_observer.h @@ -57,11 +57,11 @@ private: sptr GetAppManager(); private: + sptr appManager_ = nullptr; std::list bgTaskUids_; - std::mutex bgTaskMutex_; std::list efficiencyUids_; std::mutex efficiencyMutex_; - sptr appManager_ = nullptr; + std::mutex bgTaskMutex_; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/call_record.h b/services/abilitymgr/include/call_record.h index 95ef892fac..57d83ce127 100644 --- a/services/abilitymgr/include/call_record.h +++ b/services/abilitymgr/include/call_record.h @@ -82,15 +82,15 @@ public: private: static int64_t callRecordId; - int recordId_; // record id - int32_t callerUid_; // caller uid CallState state_; // call state + int32_t callerUid_; // caller uid + int recordId_; // record id + int64_t startTime_ = 0; // records first time of ability start sptr callRemoteObject_ = nullptr; sptr callDeathRecipient_ = nullptr; std::weak_ptr service_; // target:service need to be called sptr connCallback_ = nullptr; // service connect callback sptr callerToken_ = nullptr; // caller token - int64_t startTime_ = 0; // records first time of ability start DISALLOW_COPY_AND_MOVE(CallRecord); }; diff --git a/services/abilitymgr/include/connection_record.h b/services/abilitymgr/include/connection_record.h index da28fd46be..4bce040093 100644 --- a/services/abilitymgr/include/connection_record.h +++ b/services/abilitymgr/include/connection_record.h @@ -150,6 +150,9 @@ public: Want GetConnectWant() const; private: static int64_t connectRecordId; + int32_t callerUid_ = 0; // caller uid + int32_t callerPid_ = 0; // caller pid + uint32_t callerTokenId_ = 0; // caller pid int recordId_ = 0; // record id ConnectionState state_; // service connection state sptr callerToken_ = nullptr; // from:caller token @@ -157,9 +160,6 @@ private: mutable std::mutex callbackMutex_; sptr connCallback_ = nullptr; // service connect callback - int32_t callerUid_ = 0; // caller uid - int32_t callerPid_ = 0; // caller pid - uint32_t callerTokenId_ = 0; // caller pid std::string callerName_; // caller bundleName or processName Want connectWant_; diff --git a/services/abilitymgr/include/connection_state_manager.h b/services/abilitymgr/include/connection_state_manager.h index 4fa539263f..23a3a9fe1d 100644 --- a/services/abilitymgr/include/connection_state_manager.h +++ b/services/abilitymgr/include/connection_state_manager.h @@ -216,6 +216,7 @@ private: void InitAppStateObserver(); private: + int32_t retry_ = 0; std::shared_ptr observerController_; ffrt::mutex stateLock_; @@ -229,7 +230,6 @@ private: sptr appStateObserver_; std::shared_ptr handler_; - int32_t retry_ = 0; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/data_ability/data_ability_record.h b/services/abilitymgr/include/data_ability/data_ability_record.h index f346455df1..224394136b 100644 --- a/services/abilitymgr/include/data_ability/data_ability_record.h +++ b/services/abilitymgr/include/data_ability/data_ability_record.h @@ -65,12 +65,12 @@ private: int32_t GetDiedCallerPid(const sptr &remote); private: + sptr scheduler_ {}; + sptr callerDeathRecipient_; // caller binderDied Recipient + std::list clients_ {}; ffrt::condition_variable loadedCond_ {}; AbilityRequest request_ {}; AbilityRecordPtr ability_ {}; - sptr scheduler_ {}; - std::list clients_ {}; - sptr callerDeathRecipient_; // caller binderDied Recipient }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/disposed_observer.h b/services/abilitymgr/include/disposed_observer.h index e51d78ac77..836515b39b 100644 --- a/services/abilitymgr/include/disposed_observer.h +++ b/services/abilitymgr/include/disposed_observer.h @@ -35,10 +35,10 @@ private: void OnAbilityStateChanged(const AppExecFwk::AbilityStateData &abilityStateData) override; void OnPageShow(const AppExecFwk::PageStateData &pageStateData) override; private: - ffrt::mutex observerLock_; - AppExecFwk::DisposedRule disposedRule_; sptr token_ = nullptr; std::shared_ptr interceptor_ = nullptr; + AppExecFwk::DisposedRule disposedRule_; + ffrt::mutex observerLock_; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/extension_config.h b/services/abilitymgr/include/extension_config.h index c430c4156a..c1e4c3a99a 100644 --- a/services/abilitymgr/include/extension_config.h +++ b/services/abilitymgr/include/extension_config.h @@ -55,8 +55,8 @@ private: std::unordered_map serviceEnableFlags_; std::unordered_map> serviceBlockedLists_; std::unordered_map networkEnableFlags_; - std::mutex networkEnableMutex_; std::unordered_map saEnableFlags_; + std::mutex networkEnableMutex_; std::mutex saEnableMutex_; }; } // OHOS diff --git a/services/abilitymgr/include/extension_record/extension_record.h b/services/abilitymgr/include/extension_record/extension_record.h index 2fc9355ae2..01aa323f6d 100644 --- a/services/abilitymgr/include/extension_record/extension_record.h +++ b/services/abilitymgr/include/extension_record/extension_record.h @@ -53,12 +53,12 @@ public: int32_t RegisterStateObserver(const std::string &hostBundleName); - std::shared_ptr abilityRecord_ = nullptr; - std::string hostBundleName_; + bool isHostSpecified_ = false; int32_t extensionRecordId_ = INVALID_EXTENSION_RECORD_ID; uint32_t processMode_ = 0; - bool isHostSpecified_ = false; pid_t hostPid_ = 0; + std::shared_ptr abilityRecord_ = nullptr; + std::string hostBundleName_; private: sptr rootCallerToken_ = nullptr; sptr focusedCallerToken_ = nullptr; diff --git a/services/abilitymgr/include/extension_record/extension_record_manager.h b/services/abilitymgr/include/extension_record/extension_record_manager.h index d30335f064..75f222c1e4 100644 --- a/services/abilitymgr/include/extension_record/extension_record_manager.h +++ b/services/abilitymgr/include/extension_record/extension_record_manager.h @@ -131,11 +131,11 @@ private: private: int32_t userId_; static std::atomic_int32_t extensionRecordId_; - std::mutex mutex_; std::set extensionRecordIdSet_; + std::mutex mutex_; + std::mutex preloadUIExtensionMapMutex_; ExtensionAbilityRecordMap extensionRecords_; ExtensionAbilityRecordMap terminateRecords_; - std::mutex preloadUIExtensionMapMutex_; PreLoadUIExtensionMapType preloadUIExtensionMap_; void SetCachedFocusedCallerToken(int32_t extensionRecordId, sptr &focusedCallerToken); diff --git a/services/abilitymgr/include/free_install_manager.h b/services/abilitymgr/include/free_install_manager.h index b54799cbac..0772c7ec9f 100644 --- a/services/abilitymgr/include/free_install_manager.h +++ b/services/abilitymgr/include/free_install_manager.h @@ -33,28 +33,28 @@ namespace AAFwk { class AbilityManagerService; struct FreeInstallInfo { - Want want; + bool isInstalled = false; + bool isPreStartMissionCalled = false; + bool isStartUIAbilityBySCBCalled = false; + bool isFreeInstallFinished = false; + bool isOpenAtomicServiceShortUrl = false; + uint32_t specifyTokenId = 0; int32_t userId = -1; int32_t requestCode = -1; + int resultCode = 0; std::shared_ptr> promise; - bool isInstalled = false; std::string identity; sptr callerToken = nullptr; sptr dmsCallback = nullptr; - bool isPreStartMissionCalled = false; - bool isStartUIAbilityBySCBCalled = false; - uint32_t specifyTokenId = 0; - bool isFreeInstallFinished = false; - int resultCode = 0; - bool isOpenAtomicServiceShortUrl = false; std::shared_ptr originalWant = nullptr; std::shared_ptr startOptions = nullptr; + Want want; }; struct FreeInstallParams { bool isAsync = false; - uint32_t specifyTokenId = 0; bool isOpenAtomicServiceShortUrl = false; + uint32_t specifyTokenId = 0; std::shared_ptr originalWant = nullptr; std::shared_ptr startOptions = nullptr; }; diff --git a/services/abilitymgr/include/implicit_start_processor.h b/services/abilitymgr/include/implicit_start_processor.h index f6bad456f6..6df64df739 100644 --- a/services/abilitymgr/include/implicit_start_processor.h +++ b/services/abilitymgr/include/implicit_start_processor.h @@ -36,15 +36,15 @@ struct IdentityNode { {} }; -struct AddInfoParam { - AppExecFwk::AbilityInfo info; - int32_t userId = 0; +struct AddInfoParam { bool isExtension = false; bool isMoreHapList = false; bool withDefault = false; + bool isExistDefaultApp = false; + int32_t userId = 0; std::string typeName; std::vector infoNames; - bool isExistDefaultApp = false; + AppExecFwk::AbilityInfo info; }; struct GenerateRequestParam { diff --git a/services/abilitymgr/include/inner_mission_info.h b/services/abilitymgr/include/inner_mission_info.h index 99000723bc..fe4bab58d9 100644 --- a/services/abilitymgr/include/inner_mission_info.h +++ b/services/abilitymgr/include/inner_mission_info.h @@ -40,19 +40,18 @@ enum class StartMethod { * InnerMissionInfo is used to save informations about mission information. */ struct InnerMissionInfo { - MissionInfo missionInfo; - std::string missionName; - std::string missionAffinity; + bool isTemporary; + bool hasRecoverInfo; int32_t launchMode; int32_t startMethod; - std::string bundleName; - int32_t uid; - bool isTemporary; - std::string specifiedFlag; - bool hasRecoverInfo; int32_t collaboratorType = 0; - + int32_t uid; + std::string bundleName; + std::string specifiedFlag; std::string ToJsonStr() const; + std::string missionName; + std::string missionAffinity; + MissionInfo missionInfo; bool FromJsonStr(const std::string &jsonStr); void Dump(std::vector &info) const; bool CheckJsonNode(nlohmann::json &value, const std::string &node, JsonType jsonType); diff --git a/services/abilitymgr/include/insight_intent/insight_intent_execute_manager.h b/services/abilitymgr/include/insight_intent/insight_intent_execute_manager.h index 78c3ddd5b5..7484b8b79d 100644 --- a/services/abilitymgr/include/insight_intent/insight_intent_execute_manager.h +++ b/services/abilitymgr/include/insight_intent/insight_intent_execute_manager.h @@ -34,10 +34,10 @@ enum class InsightIntentExecuteState { }; struct InsightIntentExecuteRecord { + InsightIntentExecuteState state = InsightIntentExecuteState::UNKNOWN; uint64_t key = 0; sptr callerToken = nullptr; sptr deathRecipient = nullptr; - InsightIntentExecuteState state = InsightIntentExecuteState::UNKNOWN; std::string bundleName; std::string callerBundleName; }; diff --git a/services/abilitymgr/include/keep_alive/keep_alive_process_manager.h b/services/abilitymgr/include/keep_alive/keep_alive_process_manager.h index a888a0db90..a348feb74d 100644 --- a/services/abilitymgr/include/keep_alive/keep_alive_process_manager.h +++ b/services/abilitymgr/include/keep_alive/keep_alive_process_manager.h @@ -29,11 +29,11 @@ namespace AAFwk { using AbilityKeepAliveService = AbilityRuntime::AbilityKeepAliveService; struct KeepAliveAbilityInfo { + int32_t userId = 0; + int32_t appCloneIndex = 0; std::string bundleName; std::string moduleName; std::string abilityName; - int32_t userId = 0; - int32_t appCloneIndex = 0; }; class CheckStatusBarTask { diff --git a/services/abilitymgr/include/mission/mission.h b/services/abilitymgr/include/mission/mission.h index a0ebc95774..60a127cc21 100644 --- a/services/abilitymgr/include/mission/mission.h +++ b/services/abilitymgr/include/mission/mission.h @@ -218,19 +218,19 @@ public: } private: - int32_t missionId_; - int32_t startMethod_; - std::shared_ptr abilityRecord_; - std::string missionName_; - std::string specifiedFlag_; - std::weak_ptr ownerMissionList_; bool lockedState_ = false; bool isMovingToFront_ = false; bool isANRState_ = false; bool needNotify_ = true; bool needNotifyUpdateLabel_ = false; - std::string missionTime_ = "0"; bool unclearable_ = false; + int32_t missionId_; + int32_t startMethod_; + std::weak_ptr ownerMissionList_; + std::shared_ptr abilityRecord_; + std::string missionName_; + std::string specifiedFlag_; + std::string missionTime_ = "0"; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/mission/mission_info_mgr.h b/services/abilitymgr/include/mission/mission_info_mgr.h index b55d9284f0..23c2ab7e34 100644 --- a/services/abilitymgr/include/mission/mission_info_mgr.h +++ b/services/abilitymgr/include/mission/mission_info_mgr.h @@ -211,12 +211,12 @@ private: private: int32_t currentMissionId_ = MIN_MISSION_ID; + sptr snapshotHandler_; + std::shared_ptr taskDataPersistenceMgr_; std::unordered_map missionIdMap_; // key:distributed missionid, vaule: has been saved std::list missionInfoList_; - std::shared_ptr taskDataPersistenceMgr_; - sptr snapshotHandler_; - mutable ffrt::mutex mutex_; std::unordered_map savingSnapshot_; + mutable ffrt::mutex mutex_; ffrt::mutex savingSnapshotLock_; ffrt::condition_variable waitSavingCondition_; }; diff --git a/services/abilitymgr/include/mission/mission_list_manager.h b/services/abilitymgr/include/mission/mission_list_manager.h index 8802dbe851..dd0e2e0b2d 100644 --- a/services/abilitymgr/include/mission/mission_list_manager.h +++ b/services/abilitymgr/include/mission/mission_list_manager.h @@ -544,20 +544,20 @@ private: void SendKeyEvent(const AbilityRequest &abilityRequest); + bool isPrepareTerminateEnable_ = false; int userId_; - mutable ffrt::mutex managerLock_; - // launcher list is also in currentMissionLists_ - std::list> currentMissionLists_; // only manager the ability of standard in the default list std::shared_ptr defaultStandardList_; // only manager the ability of singleton in the default list for the fast search std::shared_ptr defaultSingleList_; std::shared_ptr launcherList_; + std::shared_ptr listenerController_; + // launcher list is also in currentMissionLists_ + std::list> currentMissionLists_; std::list> terminateAbilityList_; std::queue waitingAbilityQueue_; - std::shared_ptr listenerController_; - bool isPrepareTerminateEnable_ = false; + mutable ffrt::mutex managerLock_; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/mission/mission_listener_controller.h b/services/abilitymgr/include/mission/mission_listener_controller.h index cf30817ca5..6cfe29f56d 100644 --- a/services/abilitymgr/include/mission/mission_listener_controller.h +++ b/services/abilitymgr/include/mission/mission_listener_controller.h @@ -150,10 +150,10 @@ private: }; private: - ffrt::mutex listenerLock_; + sptr listenerDeathRecipient_; std::shared_ptr handler_; std::vector> missionListeners_; - sptr listenerDeathRecipient_; + ffrt::mutex listenerLock_; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/pending_want_key.h b/services/abilitymgr/include/pending_want_key.h index b769afb645..84109990e6 100644 --- a/services/abilitymgr/include/pending_want_key.h +++ b/services/abilitymgr/include/pending_want_key.h @@ -60,16 +60,16 @@ public: private: int32_t type_ = {}; - std::string bundleName_ = {}; - std::string requestWho_ = {}; int32_t requestCode_ = {}; - Want requestWant_ = {}; - std::string requestResolvedType_ = {}; - std::vector allWantsInfos_ = {}; int32_t flags_ = {}; int32_t code_ = {}; int32_t userId_ = {}; int32_t appIndex_ = 0; + std::string requestResolvedType_ = {}; + std::string bundleName_ = {}; + std::string requestWho_ = {}; + std::vector allWantsInfos_ = {}; + Want requestWant_ = {}; std::mutex wantsInfosMutex_; std::mutex requestWantMutex_; }; diff --git a/services/abilitymgr/include/pending_want_record.h b/services/abilitymgr/include/pending_want_record.h index 5a4860e24a..83af767a4f 100644 --- a/services/abilitymgr/include/pending_want_record.h +++ b/services/abilitymgr/include/pending_want_record.h @@ -59,12 +59,12 @@ private: void CheckAppInstanceKey(const std::string& bundleName, WantParams &wantParams); private: - std::weak_ptr pendingWantManager_ = {}; + bool canceled_ = false; int32_t uid_ = 0; int32_t callerUid_ = 0; int32_t callerTokenId_ = 0; sptr callerToken_ = {}; - bool canceled_ = false; + std::weak_ptr pendingWantManager_ = {}; std::shared_ptr key_ = {}; std::list> mCancelCallbacks_ = {}; ffrt::mutex lock_ = {}; diff --git a/services/abilitymgr/include/rdb/rdb_data_manager.h b/services/abilitymgr/include/rdb/rdb_data_manager.h index b47582d4fc..17bd3d8977 100644 --- a/services/abilitymgr/include/rdb/rdb_data_manager.h +++ b/services/abilitymgr/include/rdb/rdb_data_manager.h @@ -32,12 +32,12 @@ constexpr static int32_t ABILITY_RDB_VERSION = 1; } // namespace struct AmsRdbConfig { + int32_t version{ ABILITY_RDB_VERSION }; std::string dbPath{ ABILITY_RDB_PATH }; std::string dbName{ ABILITY_RDB_NAME }; std::string tableName; std::string journalMode; std::string syncMode; - int32_t version{ ABILITY_RDB_VERSION }; }; class RdbDataManager final { @@ -56,9 +56,9 @@ public: void ClearCache(); private: - std::mutex rdbMutex_; std::shared_ptr rdbStore_; AmsRdbConfig amsRdbConfig_; + std::mutex rdbMutex_; }; } // namespace AbilityRuntime } // namespace OHOS diff --git a/services/abilitymgr/include/start_ability_handler.h b/services/abilitymgr/include/start_ability_handler.h index 54c511f025..06ad749cdd 100644 --- a/services/abilitymgr/include/start_ability_handler.h +++ b/services/abilitymgr/include/start_ability_handler.h @@ -28,13 +28,13 @@ class IRemoteObject; namespace AAFwk { struct StartAbilityParams { StartAbilityParams(Want &reqWant) : want(reqWant) {} - Want &want; - sptr callerToken; - sptr asCallerSourceToken; + bool isStartAsCaller = false; int32_t userId = -1; int requestCode = 0; - bool isStartAsCaller = false; + sptr callerToken; + sptr asCallerSourceToken; const StartOptions* startOptions = nullptr; + Want &want; int32_t GetValidUserId() { @@ -64,8 +64,8 @@ private: #endif // WITH_DLP std::optional sandboxExternalAuth; std::optional isCallerSysApp; - std::optional> callerRecord; std::optional callerAppIndex; + std::optional> callerRecord; }; class StartAbilityHandler { diff --git a/services/abilitymgr/include/sub_managers_helper.h b/services/abilitymgr/include/sub_managers_helper.h index be1634b24f..0e00af9616 100644 --- a/services/abilitymgr/include/sub_managers_helper.h +++ b/services/abilitymgr/include/sub_managers_helper.h @@ -85,22 +85,22 @@ private: std::shared_ptr taskHandler_; std::shared_ptr eventHandler_; - - ffrt::mutex managersMutex_; - std::unordered_map> connectManagers_; std::shared_ptr currentConnectManager_; - std::unordered_map> dataAbilityManagers_; std::shared_ptr currentDataAbilityManager_; - std::unordered_map> pendingWantManagers_; std::shared_ptr currentPendingWantManager_; - std::unordered_map> missionListManagers_; std::shared_ptr currentMissionListManager_; - std::unordered_map> uiAbilityManagers_; std::shared_ptr currentUIAbilityManager_; + std::shared_ptr missionListWrap_; + std::unordered_map> connectManagers_; + std::unordered_map> dataAbilityManagers_; + std::unordered_map> pendingWantManagers_; + std::unordered_map> missionListManagers_; + std::unordered_map> uiAbilityManagers_; std::mutex missionListWrapMutex_; + ffrt::mutex managersMutex_; void* missionLibHandle_ = nullptr; - std::shared_ptr missionListWrap_; + }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/system_dialog_scheduler.h b/services/abilitymgr/include/system_dialog_scheduler.h index 28ff131d13..3e4f723534 100644 --- a/services/abilitymgr/include/system_dialog_scheduler.h +++ b/services/abilitymgr/include/system_dialog_scheduler.h @@ -52,16 +52,16 @@ struct DialogPosition { DialogAlign align = DialogAlign::CENTER; }; struct DialogAppInfo { + bool visible = true; + bool isAppLink = false; int32_t abilityIconId = 0; int32_t abilityLabelId = 0; int32_t bundleIconId = 0; int32_t bundleLabelId = 0; + int32_t appIndex = 0; std::string bundleName = {}; std::string abilityName = {}; std::string moduleName = {}; - bool visible = true; - bool isAppLink = false; - int32_t appIndex = 0; AppExecFwk::MultiAppModeData multiAppMode; }; /** diff --git a/services/abilitymgr/include/task_data_persistence_mgr.h b/services/abilitymgr/include/task_data_persistence_mgr.h index 0310ad30cb..dff26914c9 100644 --- a/services/abilitymgr/include/task_data_persistence_mgr.h +++ b/services/abilitymgr/include/task_data_persistence_mgr.h @@ -96,10 +96,10 @@ public: bool GetMissionSnapshot(int missionId, MissionSnapshot& missionSnapshot, bool isLowResolution); private: - std::unordered_map> missionDataStorageMgr_; + int32_t currentUserId_ = -1; std::shared_ptr currentMissionDataStorage_; std::shared_ptr handler_; - int32_t currentUserId_ = -1; + std::unordered_map> missionDataStorageMgr_; ffrt::mutex mutex_; }; } // namespace AAFwk diff --git a/services/abilitymgr/include/user_controller.h b/services/abilitymgr/include/user_controller.h index e20ecb02ca..6b19d8eb8a 100644 --- a/services/abilitymgr/include/user_controller.h +++ b/services/abilitymgr/include/user_controller.h @@ -139,11 +139,11 @@ private: void HandleUserSwitchDone(int32_t userId); private: - ffrt::mutex userLock_; int32_t currentUserId_ = USER_ID_NO_HEAD; - std::unordered_map> userItems_; - std::shared_ptr eventHandler_; int32_t freezingNewUserId_ = -1; + std::shared_ptr eventHandler_; + std::unordered_map> userItems_; + ffrt::mutex userLock_; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/utils/ability_permission_util.h b/services/abilitymgr/include/utils/ability_permission_util.h index 688794489d..02e1fe6243 100644 --- a/services/abilitymgr/include/utils/ability_permission_util.h +++ b/services/abilitymgr/include/utils/ability_permission_util.h @@ -183,8 +183,8 @@ private: int GetTokenIdByPid(pid_t pid); - ffrt::mutex startSelfUIAbilityRecordsMutex_; std::vector> startSelfUIAbilityRecords_; + ffrt::mutex startSelfUIAbilityRecordsMutex_; friend class StartSelfUIAbilityRecordGuard; diff --git a/services/abilitymgr/include/utils/start_ability_utils.h b/services/abilitymgr/include/utils/start_ability_utils.h index 72a0cd826f..47061e4475 100644 --- a/services/abilitymgr/include/utils/start_ability_utils.h +++ b/services/abilitymgr/include/utils/start_ability_utils.h @@ -42,9 +42,9 @@ struct StartAbilityInfo { return abilityInfo.applicationInfo.bundleName; } + int32_t status = ERR_OK; AppExecFwk::AbilityInfo abilityInfo; AppExecFwk::ExtensionProcessMode extensionProcessMode = AppExecFwk::ExtensionProcessMode::UNDEFINED; - int32_t status = ERR_OK; std::string customProcess; };