mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2025-01-02 05:09:34 +00:00
Description:check window modes
Sig:SIG_ApplicationFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: yuwenze <yuaqiang1@huawei.com> Change-Id: Iaff2db894f95759b073cba3039e6473c213c067c
This commit is contained in:
parent
ebc3ba48ea
commit
8e677106fb
@ -253,6 +253,7 @@ enum {
|
||||
* Result(2097198) for parcel fail.
|
||||
*/
|
||||
ERR_AAFWK_PARCEL_FAIL,
|
||||
|
||||
/**
|
||||
* Result(2097199) for for implicit start ability is failed.
|
||||
*/
|
||||
@ -262,6 +263,11 @@ enum {
|
||||
* Result(2097200) for instance reach to upper limit.
|
||||
*/
|
||||
ERR_REACH_UPPER_LIMIT,
|
||||
|
||||
/**
|
||||
* Result(2097201) for window mode.
|
||||
*/
|
||||
ERR_AAFWK_INVALID_WINDOW_MODE,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -1039,6 +1039,7 @@ private:
|
||||
std::shared_ptr<AmsConfigurationParameter> amsConfigResolver_;
|
||||
const static std::map<std::string, AbilityManagerService::DumpKey> dumpMap;
|
||||
const static std::map<std::string, AbilityManagerService::DumpsysKey> dumpsysMap;
|
||||
const static std::map<int32_t, AppExecFwk::SupportWindowMode> windowModeMap;
|
||||
|
||||
std::unordered_map<int, std::shared_ptr<MissionListManager>> missionListManagers_;
|
||||
std::shared_ptr<MissionListManager> currentMissionListManager_;
|
||||
@ -1061,6 +1062,7 @@ private:
|
||||
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
int32_t ShowPickerDialog(const Want& want, int32_t userId);
|
||||
bool CheckWindowMode(int32_t windowMode, const std::vector<AppExecFwk::SupportWindowMode>& windowModes) const;
|
||||
std::shared_ptr<ImplicitStartProcessor> implicitStartProcessor_;
|
||||
sptr<IWindowManagerServiceHandler> wmsHandler_;
|
||||
std::shared_ptr<ApplicationAnrListener> anrListener_;
|
||||
|
@ -167,6 +167,17 @@ const std::map<std::string, AbilityManagerService::DumpsysKey> AbilityManagerSer
|
||||
std::map<std::string, AbilityManagerService::DumpsysKey>::value_type("-d", KEY_DUMPSYS_DATA),
|
||||
};
|
||||
|
||||
const std::map<int32_t, AppExecFwk::SupportWindowMode> AbilityManagerService::windowModeMap = {
|
||||
std::map<int32_t, AppExecFwk::SupportWindowMode>::value_type(MULTI_WINDOW_DISPLAY_FULLSCREEN,
|
||||
AppExecFwk::SupportWindowMode::FULLSCREEN),
|
||||
std::map<int32_t, AppExecFwk::SupportWindowMode>::value_type(MULTI_WINDOW_DISPLAY_PRIMARY,
|
||||
AppExecFwk::SupportWindowMode::SPLIT),
|
||||
std::map<int32_t, AppExecFwk::SupportWindowMode>::value_type(MULTI_WINDOW_DISPLAY_SECONDARY,
|
||||
AppExecFwk::SupportWindowMode::SPLIT),
|
||||
std::map<int32_t, AppExecFwk::SupportWindowMode>::value_type(MULTI_WINDOW_DISPLAY_FLOATING,
|
||||
AppExecFwk::SupportWindowMode::FLOATING),
|
||||
};
|
||||
|
||||
const bool REGISTER_RESULT =
|
||||
SystemAbility::MakeAndRegisterAbility(DelayedSingleton<AbilityManagerService>::GetInstance().get());
|
||||
sptr<AbilityManagerService> AbilityManagerService::instance_;
|
||||
@ -792,6 +803,13 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st
|
||||
HiSysEventType::FAULT, eventInfo);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
if (!CheckWindowMode(startOptions.GetWindowMode(), abilityInfo.windowModes)) {
|
||||
return ERR_AAFWK_INVALID_WINDOW_MODE;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto ret = missionListManager->StartAbility(abilityRequest);
|
||||
if (ret != ERR_OK) {
|
||||
eventInfo.errCode = ret;
|
||||
@ -4985,5 +5003,24 @@ int AbilityManagerService::StartAppgallery(int requestCode, int32_t userId, std:
|
||||
want.SetAction(action);
|
||||
return StartAbilityInner(want, nullptr, requestCode, -1, userId);
|
||||
}
|
||||
|
||||
bool AbilityManagerService::CheckWindowMode(int32_t windowMode,
|
||||
const std::vector<AppExecFwk::SupportWindowMode>& windowModes) const
|
||||
{
|
||||
HILOG_INFO("Window mode is %{public}d.", windowMode);
|
||||
if (windowMode == AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_UNDEFINED) {
|
||||
return true;
|
||||
}
|
||||
auto it = windowModeMap.find(windowMode);
|
||||
if (it != windowModeMap.end()) {
|
||||
auto bmsWindowMode = it->second;
|
||||
for (auto mode : windowModes) {
|
||||
if (mode == bmsWindowMode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
Loading…
Reference in New Issue
Block a user