abilityms字节对齐

Signed-off-by: zhang_hao_zheng <zhanghaozheng2@h-partners.com>
Change-Id: I2fa1fef9905947bcaed396419ff325f4ce606c6e
This commit is contained in:
zhang_hao_zheng
2025-01-16 15:15:54 +08:00
parent 5a6d34d356
commit aa58faddcd
37 changed files with 253 additions and 271 deletions
@@ -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
@@ -121,12 +121,12 @@ public:
uint32_t devLruCapacity_ = 0;
uint32_t procLruCapacity_ = 0;
uint32_t devLruCnt_ = 0;
std::mutex mutex_;
std::map<uint32_t, ProcRecordsInfo> procLruMap_;
std::list<std::shared_ptr<AbilityRecord>> devRecLru_;
std::shared_ptr<AbilityRecord> AddToProcLru(std::shared_ptr<AbilityRecord> abilityRecord);
std::shared_ptr<AbilityRecord> AddToDevLru(std::shared_ptr<AbilityRecord> abilityRecord,
std::shared_ptr<AbilityRecord> rec);
std::mutex mutex_;
void RemoveAbilityRecInDevList(std::shared_ptr<AbilityRecord> abilityRecord);
void RemoveAbilityRecInProcList(std::shared_ptr<AbilityRecord> abilityRecord);
std::shared_ptr<AbilityRecord> GetAbilityRecInProcList(const AbilityRequest &abilityRequest);
@@ -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<std::shared_ptr<AbilityRecord>> terminatingExtensionList_;
std::mutex recipientMapMutex_;
RecipientMapType recipientMap_;
std::mutex uiExtRecipientMapMutex_;
RecipientMapType recipientMap_;
RecipientMapType uiExtRecipientMap_;
UIExtensionMapType uiExtensionMap_;
WindowExtensionMapType windowExtensionMap_;
std::list<std::shared_ptr<AbilityRecord>> terminatingExtensionList_;
std::shared_ptr<TaskHandlerWrap> taskHandler_;
std::shared_ptr<EventHandlerWrap> eventHandler_;
int userId_;
std::vector<AbilityRequest> restartResidentTaskList_;
std::mutex startServiceReqListLock_;
std::unordered_map<std::string, std::shared_ptr<std::list<AbilityRequest>>> startServiceReqList_;
std::mutex uiExtensionMapMutex_;
UIExtensionMapType uiExtensionMap_;
std::mutex windowExtensionMapMutex_;
WindowExtensionMapType windowExtensionMap_;
std::unique_ptr<UIExtensionAbilityConnectManager> 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);
};
@@ -43,10 +43,10 @@ protected:
void RemoveObserverDeathRecipient(const sptr<IRemoteBroker> &observer);
private:
ffrt::mutex observerLock_;
bool isNotifyAllBundles_;
AbilityFirstFrameStateObserverMap observerMap_;
std::map<sptr<IRemoteObject>, sptr<IRemoteObject::DeathRecipient>> recipientMap_;
bool isNotifyAllBundles_;
ffrt::mutex observerLock_;
};
class AbilityFirstFrameStateObserverManager {
@@ -2437,38 +2437,8 @@ private:
void StartKeepAliveAppsInner(int32_t userId);
sptr<WindowVisibilityChangedListener> windowVisibilityChangedListener_;
std::shared_ptr<TaskHandlerWrap> taskHandler_;
std::shared_ptr<AbilityEventHandler> eventHandler_;
ServiceRunningState state_;
std::shared_ptr<FreeInstallManager> freeInstallManager_;
std::shared_ptr<SubManagersHelper> subManagersHelper_;
std::shared_ptr<UserController> userController_;
sptr<AppExecFwk::IAbilityController> abilityController_ = nullptr;
bool controllerIsAStabilityTest_ = false;
std::unordered_set<int32_t> windowVisibleList_;
ffrt::mutex globalLock_;
ffrt::mutex bgtaskObserverMutex_;
ffrt::mutex abilityTokenLock_;
ffrt::mutex preStartSessionMapLock_;
ffrt::mutex windowVisibleListLock_;
std::multimap<std::string, std::string> timeoutMap_;
std::map<std::string, sptr<SessionInfo>> preStartSessionMap_;
static sptr<AbilityManagerService> instance_;
int32_t uniqueId_ = 0;
ffrt::mutex iAcquireShareDataMapLock_;
std::map<int32_t, std::pair<int64_t, const sptr<IAcquireShareDataCallback>>> iAcquireShareDataMap_;
// first is callstub, second is ability token
std::map<sptr<IRemoteObject>, sptr<IRemoteObject>> callStubTokenMap_;
#ifdef SUPPORT_GRAPHICS
sptr<WindowFocusChangedListener> 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<int32_t> windowVisibleList_;
sptr<WindowVisibilityChangedListener> windowVisibilityChangedListener_;
std::shared_ptr<TaskHandlerWrap> taskHandler_;
std::shared_ptr<AbilityEventHandler> eventHandler_;
ServiceRunningState state_;
std::shared_ptr<FreeInstallManager> freeInstallManager_;
std::shared_ptr<SubManagersHelper> subManagersHelper_;
std::shared_ptr<UserController> userController_;
sptr<AppExecFwk::IAbilityController> abilityController_ = nullptr;
std::multimap<std::string, std::string> timeoutMap_;
std::map<std::string, sptr<SessionInfo>> preStartSessionMap_;
static sptr<AbilityManagerService> instance_;
std::map<int32_t, std::pair<int64_t, const sptr<IAcquireShareDataCallback>>> iAcquireShareDataMap_;
// first is callstub, second is ability token
std::map<sptr<IRemoteObject>, sptr<IRemoteObject>> callStubTokenMap_;
#ifdef SUPPORT_GRAPHICS
sptr<WindowFocusChangedListener> focusListener_;
#endif // SUPPORT_GRAPHICS
std::shared_ptr<AbilityRuntime::AbilityManagerEventSubscriber> screenSubscriber_;
std::shared_ptr<AbilityAutoStartupService> abilityAutoStartupService_;
std::mutex whiteListMutex_;
std::map<std::string, std::list<std::string>> whiteListMap_;
std::list<std::string> 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> abilityBundleEventCallback_;
#ifdef SUPPORT_SCREEN
int32_t ShowPickerDialog(const Want& want, int32_t userId, const sptr<IRemoteObject> &token);
bool isAnimationEnabled_ = true; //only use on mission list
bool CheckWindowMode(int32_t windowMode, const std::vector<AppExecFwk::SupportWindowMode>& windowModes) const;
int32_t ShowPickerDialog(const Want& want, int32_t userId, const sptr<IRemoteObject> &token);
void InitFocusListener();
void RegisterFocusListener();
void InitPrepareTerminateConfig();
std::shared_ptr<ImplicitStartProcessor> implicitStartProcessor_;
sptr<IWindowManagerServiceHandler> wmsHandler_;
bool isAnimationEnabled_ = true; //only use on mission list
#endif
std::shared_ptr<AbilityInterceptorExecuter> interceptorExecuter_;
std::shared_ptr<AbilityInterceptorExecuter> afterCheckExecuter_;
std::unordered_map<int32_t, int64_t> appRecoveryHistory_; // uid:time
bool isPrepareTerminateEnable_ = false;
std::multimap<int, std::shared_ptr<StartAbilityHandler>, std::greater<int>> startAbilityChain_;
ffrt::mutex collaboratorMapLock_;
std::unordered_map<int32_t, sptr<IAbilityManagerCollaborator>> collaboratorMap_;
ffrt::mutex abilityDebugDealLock_;
std::shared_ptr<AbilityDebugDeal> abilityDebugDeal_;
std::shared_ptr<AppExitReasonHelper> 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
@@ -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;
};
}
}
+89 -99
View File
@@ -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<IRemoteObject> callerToken = nullptr;
int32_t callerTokenRecordId = -1;
sptr<IRemoteObject> 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<IRemoteObject> callerToken = nullptr; // call ability
sptr<IRemoteObject> asCallerSourceToken = nullptr; // call ability
sptr<IAbilityConnection> connect = nullptr;
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes;
sptr<IRemoteObject> abilityInfoCallback = nullptr;
sptr<SessionInfo> sessionInfo;
std::shared_ptr<AbilityStartSetting> startSetting = nullptr;
std::shared_ptr<ProcessOptions> processOptions = nullptr;
std::shared_ptr<StartWindowOption> startWindowOption = nullptr;
std::string specifiedFlag;
int32_t userId = -1;
bool callSpecifiedFlagTimeout = false;
sptr<IRemoteObject> abilityInfoCallback = nullptr;
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes;
AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED;
AppExecFwk::ExtensionProcessMode extensionProcessMode = AppExecFwk::ExtensionProcessMode::UNDEFINED;
std::pair<bool, LaunchReason> IsContinuation() const
std::string specifiedFlag;
std::string customProcess;
sptr<SessionInfo> 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<bool, LaunchReason> 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<AbilityRecord> preAbilityRecord_ = {}; // who starts this ability record
std::weak_ptr<AbilityRecord> 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<IAbilityScheduler> 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<IRemoteObject::DeathRecipient> schedulerDeathRecipient_ = {}; // scheduler binderDied Recipient
/**
@@ -1279,56 +1312,25 @@ private:
*/
std::shared_ptr<AbilityResult> 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<std::shared_ptr<ConnectionRecord>> connRecordList_ = {};
// service(ability) onConnect() return proxy of service ability
sptr<IRemoteObject> 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<std::shared_ptr<CallerRecord>> 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> 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> 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<Media::PixelMap> startingWindowBg_ = nullptr;
bool isCompleteFirstFrameDrawing_ = false;
bool coldStart_ = false;
uint32_t bgColor_ = 0;
std::shared_ptr<Media::PixelMap> startingWindowBg_ = nullptr;
#endif
uint32_t callerAccessTokenId_ = -1;
bool isNeedBackToOtherMissionStack_ = false;
std::weak_ptr<AbilityRecord> 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<Want> connectWant_ = nullptr;
std::shared_ptr<CallerAbilityInfo> 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
@@ -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<std::string> residentWhiteList_;
std::string orientation_ {""};
std::string bundleName_ {""};
std::string abilityName_ {""};
std::string pickerType_ {""};
nlohmann::json pickerJsonObject_ = nlohmann::json::object();
std::map<std::string, std::string> picker_;
int multiUserType_ {0};
bool supportBackToCaller_ {true};
bool supportSceneboardCrashReboot_{true};
std::vector<std::string> residentWhiteList_;
nlohmann::json pickerJsonObject_ = nlohmann::json::object();
};
} // namespace AAFwk
} // namespace OHOS
+2 -2
View File
@@ -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<AppStateCallback> callback_;
std::unique_ptr<AppExecFwk::AppMgrClient> appMgrClient_;
AppAbilityState appAbilityState_ = AppAbilityState::ABILITY_STATE_UNDEFINED;
sptr<StartSpecifiedAbilityResponse> startSpecifiedAbilityResponse_;
std::mutex lock_;
};
} // namespace AAFwk
} // namespace OHOS
@@ -57,11 +57,11 @@ private:
sptr<AppExecFwk::IAppMgr> GetAppManager();
private:
sptr<OHOS::AppExecFwk::IAppMgr> appManager_ = nullptr;
std::list<int> bgTaskUids_;
std::mutex bgTaskMutex_;
std::list<int> efficiencyUids_;
std::mutex efficiencyMutex_;
sptr<OHOS::AppExecFwk::IAppMgr> appManager_ = nullptr;
std::mutex bgTaskMutex_;
};
} // namespace AAFwk
} // namespace OHOS
+3 -3
View File
@@ -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<IRemoteObject> callRemoteObject_ = nullptr;
sptr<IRemoteObject::DeathRecipient> callDeathRecipient_ = nullptr;
std::weak_ptr<AbilityRecord> service_; // target:service need to be called
sptr<IAbilityConnection> connCallback_ = nullptr; // service connect callback
sptr<IRemoteObject> callerToken_ = nullptr; // caller token
int64_t startTime_ = 0; // records first time of ability start
DISALLOW_COPY_AND_MOVE(CallRecord);
};
@@ -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<IRemoteObject> callerToken_ = nullptr; // from:caller token
@@ -157,9 +160,6 @@ private:
mutable std::mutex callbackMutex_;
sptr<IAbilityConnection> 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_;
@@ -216,6 +216,7 @@ private:
void InitAppStateObserver();
private:
int32_t retry_ = 0;
std::shared_ptr<ConnectionObserverController> observerController_;
ffrt::mutex stateLock_;
@@ -229,7 +230,6 @@ private:
sptr<InnerAppStateObserver> appStateObserver_;
std::shared_ptr<TaskHandlerWrap> handler_;
int32_t retry_ = 0;
};
} // namespace AAFwk
} // namespace OHOS
@@ -65,12 +65,12 @@ private:
int32_t GetDiedCallerPid(const sptr<IRemoteObject> &remote);
private:
sptr<IAbilityScheduler> scheduler_ {};
sptr<IRemoteObject::DeathRecipient> callerDeathRecipient_; // caller binderDied Recipient
std::list<ClientInfo> clients_ {};
ffrt::condition_variable loadedCond_ {};
AbilityRequest request_ {};
AbilityRecordPtr ability_ {};
sptr<IAbilityScheduler> scheduler_ {};
std::list<ClientInfo> clients_ {};
sptr<IRemoteObject::DeathRecipient> callerDeathRecipient_; // caller binderDied Recipient
};
} // namespace AAFwk
} // namespace OHOS
@@ -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<IRemoteObject> token_ = nullptr;
std::shared_ptr<DisposedRuleInterceptor> interceptor_ = nullptr;
AppExecFwk::DisposedRule disposedRule_;
ffrt::mutex observerLock_;
};
} // namespace AAFwk
} // namespace OHOS
@@ -55,8 +55,8 @@ private:
std::unordered_map<std::string, bool> serviceEnableFlags_;
std::unordered_map<std::string, std::unordered_set<std::string>> serviceBlockedLists_;
std::unordered_map<std::string, bool> networkEnableFlags_;
std::mutex networkEnableMutex_;
std::unordered_map<std::string, bool> saEnableFlags_;
std::mutex networkEnableMutex_;
std::mutex saEnableMutex_;
};
} // OHOS
@@ -53,12 +53,12 @@ public:
int32_t RegisterStateObserver(const std::string &hostBundleName);
std::shared_ptr<AAFwk::AbilityRecord> 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<AAFwk::AbilityRecord> abilityRecord_ = nullptr;
std::string hostBundleName_;
private:
sptr<IRemoteObject> rootCallerToken_ = nullptr;
sptr<IRemoteObject> focusedCallerToken_ = nullptr;
@@ -131,11 +131,11 @@ private:
private:
int32_t userId_;
static std::atomic_int32_t extensionRecordId_;
std::mutex mutex_;
std::set<int32_t> extensionRecordIdSet_;
std::mutex mutex_;
std::mutex preloadUIExtensionMapMutex_;
ExtensionAbilityRecordMap extensionRecords_;
ExtensionAbilityRecordMap terminateRecords_;
std::mutex preloadUIExtensionMapMutex_;
PreLoadUIExtensionMapType preloadUIExtensionMap_;
void SetCachedFocusedCallerToken(int32_t extensionRecordId, sptr<IRemoteObject> &focusedCallerToken);
@@ -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<std::promise<int32_t>> promise;
bool isInstalled = false;
std::string identity;
sptr<IRemoteObject> callerToken = nullptr;
sptr<IRemoteObject> dmsCallback = nullptr;
bool isPreStartMissionCalled = false;
bool isStartUIAbilityBySCBCalled = false;
uint32_t specifyTokenId = 0;
bool isFreeInstallFinished = false;
int resultCode = 0;
bool isOpenAtomicServiceShortUrl = false;
std::shared_ptr<Want> originalWant = nullptr;
std::shared_ptr<StartOptions> startOptions = nullptr;
Want want;
};
struct FreeInstallParams {
bool isAsync = false;
uint32_t specifyTokenId = 0;
bool isOpenAtomicServiceShortUrl = false;
uint32_t specifyTokenId = 0;
std::shared_ptr<Want> originalWant = nullptr;
std::shared_ptr<StartOptions> startOptions = nullptr;
};
@@ -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<std::string> infoNames;
bool isExistDefaultApp = false;
AppExecFwk::AbilityInfo info;
};
struct GenerateRequestParam {
@@ -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<std::string> &info) const;
bool CheckJsonNode(nlohmann::json &value, const std::string &node, JsonType jsonType);
@@ -34,10 +34,10 @@ enum class InsightIntentExecuteState {
};
struct InsightIntentExecuteRecord {
InsightIntentExecuteState state = InsightIntentExecuteState::UNKNOWN;
uint64_t key = 0;
sptr<IRemoteObject> callerToken = nullptr;
sptr<IRemoteObject::DeathRecipient> deathRecipient = nullptr;
InsightIntentExecuteState state = InsightIntentExecuteState::UNKNOWN;
std::string bundleName;
std::string callerBundleName;
};
@@ -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 {
@@ -218,19 +218,19 @@ public:
}
private:
int32_t missionId_;
int32_t startMethod_;
std::shared_ptr<AbilityRecord> abilityRecord_;
std::string missionName_;
std::string specifiedFlag_;
std::weak_ptr<MissionList> 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<MissionList> ownerMissionList_;
std::shared_ptr<AbilityRecord> abilityRecord_;
std::string missionName_;
std::string specifiedFlag_;
std::string missionTime_ = "0";
};
} // namespace AAFwk
} // namespace OHOS
@@ -211,12 +211,12 @@ private:
private:
int32_t currentMissionId_ = MIN_MISSION_ID;
sptr<ISnapshotHandler> snapshotHandler_;
std::shared_ptr<TaskDataPersistenceMgr> taskDataPersistenceMgr_;
std::unordered_map<int32_t, bool> missionIdMap_; // key:distributed missionid, vaule: has been saved
std::list<InnerMissionInfo> missionInfoList_;
std::shared_ptr<TaskDataPersistenceMgr> taskDataPersistenceMgr_;
sptr<ISnapshotHandler> snapshotHandler_;
mutable ffrt::mutex mutex_;
std::unordered_map<int32_t, uint32_t> savingSnapshot_;
mutable ffrt::mutex mutex_;
ffrt::mutex savingSnapshotLock_;
ffrt::condition_variable waitSavingCondition_;
};
@@ -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<std::shared_ptr<MissionList>> currentMissionLists_;
// only manager the ability of standard in the default list
std::shared_ptr<MissionList> defaultStandardList_;
// only manager the ability of singleton in the default list for the fast search
std::shared_ptr<MissionList> defaultSingleList_;
std::shared_ptr<MissionList> launcherList_;
std::shared_ptr<MissionListenerController> listenerController_;
// launcher list is also in currentMissionLists_
std::list<std::shared_ptr<MissionList>> currentMissionLists_;
std::list<std::shared_ptr<AbilityRecord>> terminateAbilityList_;
std::queue<AbilityRequest> waitingAbilityQueue_;
std::shared_ptr<MissionListenerController> listenerController_;
bool isPrepareTerminateEnable_ = false;
mutable ffrt::mutex managerLock_;
};
} // namespace AAFwk
} // namespace OHOS
@@ -150,10 +150,10 @@ private:
};
private:
ffrt::mutex listenerLock_;
sptr<IRemoteObject::DeathRecipient> listenerDeathRecipient_;
std::shared_ptr<TaskHandlerWrap> handler_;
std::vector<sptr<IMissionListener>> missionListeners_;
sptr<IRemoteObject::DeathRecipient> listenerDeathRecipient_;
ffrt::mutex listenerLock_;
};
} // namespace AAFwk
} // namespace OHOS
@@ -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<WantsInfo> 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<WantsInfo> allWantsInfos_ = {};
Want requestWant_ = {};
std::mutex wantsInfosMutex_;
std::mutex requestWantMutex_;
};
@@ -59,12 +59,12 @@ private:
void CheckAppInstanceKey(const std::string& bundleName, WantParams &wantParams);
private:
std::weak_ptr<PendingWantManager> pendingWantManager_ = {};
bool canceled_ = false;
int32_t uid_ = 0;
int32_t callerUid_ = 0;
int32_t callerTokenId_ = 0;
sptr<IRemoteObject> callerToken_ = {};
bool canceled_ = false;
std::weak_ptr<PendingWantManager> pendingWantManager_ = {};
std::shared_ptr<PendingWantKey> key_ = {};
std::list<sptr<IWantReceiver>> mCancelCallbacks_ = {};
ffrt::mutex lock_ = {};
@@ -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<NativeRdb::RdbStore> rdbStore_;
AmsRdbConfig amsRdbConfig_;
std::mutex rdbMutex_;
};
} // namespace AbilityRuntime
} // namespace OHOS
@@ -28,13 +28,13 @@ class IRemoteObject;
namespace AAFwk {
struct StartAbilityParams {
StartAbilityParams(Want &reqWant) : want(reqWant) {}
Want &want;
sptr<IRemoteObject> callerToken;
sptr<IRemoteObject> asCallerSourceToken;
bool isStartAsCaller = false;
int32_t userId = -1;
int requestCode = 0;
bool isStartAsCaller = false;
sptr<IRemoteObject> callerToken;
sptr<IRemoteObject> asCallerSourceToken;
const StartOptions* startOptions = nullptr;
Want &want;
int32_t GetValidUserId()
{
@@ -64,8 +64,8 @@ private:
#endif // WITH_DLP
std::optional<bool> sandboxExternalAuth;
std::optional<bool> isCallerSysApp;
std::optional<std::shared_ptr<AbilityRecord>> callerRecord;
std::optional<int32_t> callerAppIndex;
std::optional<std::shared_ptr<AbilityRecord>> callerRecord;
};
class StartAbilityHandler {
@@ -85,22 +85,22 @@ private:
std::shared_ptr<TaskHandlerWrap> taskHandler_;
std::shared_ptr<AbilityEventHandler> eventHandler_;
ffrt::mutex managersMutex_;
std::unordered_map<int, std::shared_ptr<AbilityConnectManager>> connectManagers_;
std::shared_ptr<AbilityConnectManager> currentConnectManager_;
std::unordered_map<int, std::shared_ptr<DataAbilityManager>> dataAbilityManagers_;
std::shared_ptr<DataAbilityManager> currentDataAbilityManager_;
std::unordered_map<int, std::shared_ptr<PendingWantManager>> pendingWantManagers_;
std::shared_ptr<PendingWantManager> currentPendingWantManager_;
std::unordered_map<int, std::shared_ptr<MissionListManagerInterface>> missionListManagers_;
std::shared_ptr<MissionListManagerInterface> currentMissionListManager_;
std::unordered_map<int, std::shared_ptr<UIAbilityLifecycleManager>> uiAbilityManagers_;
std::shared_ptr<UIAbilityLifecycleManager> currentUIAbilityManager_;
std::shared_ptr<MissionListWrap> missionListWrap_;
std::unordered_map<int, std::shared_ptr<AbilityConnectManager>> connectManagers_;
std::unordered_map<int, std::shared_ptr<DataAbilityManager>> dataAbilityManagers_;
std::unordered_map<int, std::shared_ptr<PendingWantManager>> pendingWantManagers_;
std::unordered_map<int, std::shared_ptr<MissionListManagerInterface>> missionListManagers_;
std::unordered_map<int, std::shared_ptr<UIAbilityLifecycleManager>> uiAbilityManagers_;
std::mutex missionListWrapMutex_;
ffrt::mutex managersMutex_;
void* missionLibHandle_ = nullptr;
std::shared_ptr<MissionListWrap> missionListWrap_;
};
} // namespace AAFwk
} // namespace OHOS
@@ -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;
};
/**
@@ -96,10 +96,10 @@ public:
bool GetMissionSnapshot(int missionId, MissionSnapshot& missionSnapshot, bool isLowResolution);
private:
std::unordered_map<int, std::shared_ptr<MissionDataStorage>> missionDataStorageMgr_;
int32_t currentUserId_ = -1;
std::shared_ptr<MissionDataStorage> currentMissionDataStorage_;
std::shared_ptr<TaskHandlerWrap> handler_;
int32_t currentUserId_ = -1;
std::unordered_map<int, std::shared_ptr<MissionDataStorage>> missionDataStorageMgr_;
ffrt::mutex mutex_;
};
} // namespace AAFwk
@@ -139,11 +139,11 @@ private:
void HandleUserSwitchDone(int32_t userId);
private:
ffrt::mutex userLock_;
int32_t currentUserId_ = USER_ID_NO_HEAD;
std::unordered_map<int32_t, std::shared_ptr<UserItem>> userItems_;
std::shared_ptr<UserEventHandler> eventHandler_;
int32_t freezingNewUserId_ = -1;
std::shared_ptr<UserEventHandler> eventHandler_;
std::unordered_map<int32_t, std::shared_ptr<UserItem>> userItems_;
ffrt::mutex userLock_;
};
} // namespace AAFwk
} // namespace OHOS
@@ -183,8 +183,8 @@ private:
int GetTokenIdByPid(pid_t pid);
ffrt::mutex startSelfUIAbilityRecordsMutex_;
std::vector<std::vector<int32_t>> startSelfUIAbilityRecords_;
ffrt::mutex startSelfUIAbilityRecordsMutex_;
friend class StartSelfUIAbilityRecordGuard;
@@ -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;
};