From f362de1fc52c7aff1cb894b00e82c8bf5f353833 Mon Sep 17 00:00:00 2001 From: chenxinzhan Date: Fri, 13 Sep 2024 15:15:54 +0800 Subject: [PATCH] cr_modify Signed-off-by: chenxinzhan Change-Id: I9b209c2fa218c4d5add14d48445124b8f8443c3c --- .../native/ability/native/ability_impl.cpp | 5 ----- .../ability/native/new_ability_impl.cpp | 20 ++--------------- frameworks/native/appkit/app/main_thread.cpp | 4 ++-- .../kits/native/ability/native/ability_impl.h | 13 ----------- .../native/ability/native/new_ability_impl.h | 4 ---- .../kits/native/appkit/app/main_thread.h | 2 +- .../include/ability_manager_service.h | 2 -- .../src/ability_manager_service.cpp | 22 ++++++++----------- services/appmgr/include/app_running_record.h | 1 - services/appmgr/src/app_mgr_service.cpp | 2 -- .../uripermmgr/include/upms_policy_info.h | 3 --- .../main_thread_test/main_thread_test.cpp | 4 ++-- 12 files changed, 16 insertions(+), 66 deletions(-) diff --git a/frameworks/native/ability/native/ability_impl.cpp b/frameworks/native/ability/native/ability_impl.cpp index b79850193b..c0dd13ceb5 100644 --- a/frameworks/native/ability/native/ability_impl.cpp +++ b/frameworks/native/ability/native/ability_impl.cpp @@ -31,11 +31,6 @@ namespace OHOS { using AbilityRuntime::FreezeUtil; namespace AppExecFwk { -namespace { -const std::string PERMISSION_KEY = "ohos.user.grant.permission"; -const std::string GRANTED_RESULT_KEY = "ohos.user.grant.permission.result"; -} - void AbilityImpl::Init(const std::shared_ptr &application, const std::shared_ptr &record, std::shared_ptr &ability, diff --git a/frameworks/native/ability/native/new_ability_impl.cpp b/frameworks/native/ability/native/new_ability_impl.cpp index 5168b72937..d20e051da3 100644 --- a/frameworks/native/ability/native/new_ability_impl.cpp +++ b/frameworks/native/ability/native/new_ability_impl.cpp @@ -25,13 +25,6 @@ namespace OHOS { using AbilityRuntime::FreezeUtil; namespace AppExecFwk { using AbilityManagerClient = OHOS::AAFwk::AbilityManagerClient; -/** - * @brief Handling the life cycle switching of NewAbility. - * - * @param want Indicates the structure containing information about the ability. - * @param targetState The life cycle state to switch to. - * - */ void NewAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::LifeCycleStateInfo &targetState, sptr sessionInfo) @@ -72,10 +65,10 @@ void NewAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Lif void NewAbilityImpl::HandleShareData(const int32_t &uniqueId) { - TAG_LOGI(AAFwkTag::ABILITY, "begin sourceState:%{public}d", lifecycleState_); WantParams wantParam; int32_t resultCode = Share(wantParam); - TAG_LOGI(AAFwkTag::ABILITY, "wantParam size: %{public}d", wantParam.Size()); + TAG_LOGI(AAFwkTag::ABILITY, "begin sourceState:%{public}d, wantParam size:%{public}d", + lifecycleState_, wantParam.Size()); AbilityManagerClient::GetInstance()->ShareDataDone(token_, resultCode, uniqueId, wantParam); } @@ -89,15 +82,6 @@ void NewAbilityImpl::AbilityTransactionCallback(const AbilityLifeCycleState &sta } } -/** - * @brief Handling the life cycle switching of NewAbility in switch. - * - * @param want Indicates the structure containing information about the ability. - * @param targetState The life cycle state to switch to. - * - * @return return true if need notify ams, otherwise return false. - * - */ bool NewAbilityImpl::AbilityTransaction(const Want &want, const AAFwk::LifeCycleStateInfo &targetState) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 667bef9885..5ebb8c5a00 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -1371,7 +1371,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con std::vector localPaths; ChangeToLocalPath(bundleName, appInfo.moduleSourceDirs, localPaths); LoadAbilityLibrary(localPaths); - LoadNativeLiabrary(bundleInfo, appInfo.nativeLibraryPath); + LoadNativeLibrary(bundleInfo, appInfo.nativeLibraryPath); #ifdef SUPPORT_SCREEN } else if (Ace::AceForwardCompatibility::PipelineChanged()) { std::vector localPaths; @@ -1816,7 +1816,7 @@ void MainThread::CalcNativeLiabraryEntries(const BundleInfo &bundleInfo, std::st } } -void MainThread::LoadNativeLiabrary(const BundleInfo &bundleInfo, std::string &nativeLibraryPath) +void MainThread::LoadNativeLibrary(const BundleInfo &bundleInfo, std::string &nativeLibraryPath) { CalcNativeLiabraryEntries(bundleInfo, nativeLibraryPath); if (nativeFileEntries_.empty()) { diff --git a/interfaces/kits/native/ability/native/ability_impl.h b/interfaces/kits/native/ability/native/ability_impl.h index 77e3c07897..1a43b03b90 100644 --- a/interfaces/kits/native/ability/native/ability_impl.h +++ b/interfaces/kits/native/ability/native/ability_impl.h @@ -29,10 +29,6 @@ #endif namespace OHOS { namespace AppExecFwk { -class Ability; -class AbilityHandler; -class ApplicationImpl; -class AbilityLocalRecord; class AbilityLifecycleCallbacks; class OHOSApplication; class AbilityImpl : public std::enable_shared_from_this { @@ -491,15 +487,6 @@ protected: std::mutex notifyForegroundLock_; private: - typedef enum { - START, - INACTIVE, - ACTIVE, - BACKGROUND, - FOREGROUND, - STOP, - } Action; - std::shared_ptr applicationImpl_; std::shared_ptr contextDeal_; bool hasSaveData_ = false; diff --git a/interfaces/kits/native/ability/native/new_ability_impl.h b/interfaces/kits/native/ability/native/new_ability_impl.h index d445102f2a..50013b54dc 100644 --- a/interfaces/kits/native/ability/native/new_ability_impl.h +++ b/interfaces/kits/native/ability/native/new_ability_impl.h @@ -20,10 +20,6 @@ namespace OHOS { namespace AppExecFwk { -class Ability; -class AbilityHandler; -class AbilityLocalRecord; -class AbilityImpl; class NewAbilityImpl final : public AbilityImpl { public: /** diff --git a/interfaces/kits/native/appkit/app/main_thread.h b/interfaces/kits/native/appkit/app/main_thread.h index 996bc9af75..501ab3925d 100644 --- a/interfaces/kits/native/appkit/app/main_thread.h +++ b/interfaces/kits/native/appkit/app/main_thread.h @@ -675,7 +675,7 @@ private: void LoadAceAbilityLibrary(); void CalcNativeLiabraryEntries(const BundleInfo &bundleInfo, std::string &nativeLibraryPath); - void LoadNativeLiabrary(const BundleInfo &bundleInfo, std::string &nativeLibraryPath); + void LoadNativeLibrary(const BundleInfo &bundleInfo, std::string &nativeLibraryPath); void LoadAppDetailAbilityLibrary(std::string &nativeLibraryPath); diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index e3c5bbad75..30498f3dc6 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -85,7 +85,6 @@ constexpr int32_t U0_USER_ID = 0; constexpr int32_t INVALID_USER_ID = -1; constexpr const char* KEY_SESSION_ID = "com.ohos.param.sessionId"; using OHOS::AppExecFwk::IAbilityController; -class PendingWantManager; struct StartAbilityInfo; class WindowFocusChangedListener; @@ -2287,7 +2286,6 @@ private: const Want& want, uint32_t specifyTokenId); constexpr static int REPOLL_TIME_MICRO_SECONDS = 1000000; - constexpr static int WAITING_BOOT_ANIMATION_TIMER = 5; std::shared_ptr taskHandler_; std::shared_ptr eventHandler_; diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index c526c62c43..3901a5ecc5 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -125,12 +125,9 @@ constexpr const char* PREPARE_TERMINATE_ENABLE_PARAMETER = "persist.sys.prepare_ // UIExtension type constexpr const char* UIEXTENSION_TYPE_KEY = "ability.want.params.uiExtensionType"; constexpr const char* UIEXTENSION_TARGET_TYPE_KEY = "ability.want.params.uiExtensionTargetType"; -constexpr const char* SYSTEM_SHARE = "share"; -constexpr const char* SYSTEM_SHARE_TYPE = "sysPicker/share"; // Share picker params constexpr char SHARE_PICKER_DIALOG_BUNDLE_NAME_KEY[] = "const.system.sharePicker.bundleName"; constexpr char SHARE_PICKER_DIALOG_ABILITY_NAME_KEY[] = "const.system.sharePicker.abilityName"; -constexpr char SHARE_PICKER_UIEXTENSION_NAME_KEY[] = "const.system.sharePicker.UIExtensionAbilityName"; constexpr char SHARE_PICKER_DIALOG_DEFAULY_BUNDLE_NAME[] = "com.ohos.sharepickerdialog"; constexpr char SHARE_PICKER_DIALOG_DEFAULY_ABILITY_NAME[] = "PickerDialog"; constexpr char TOKEN_KEY[] = "ohos.ability.params.token"; @@ -150,8 +147,8 @@ constexpr const char* DMS_PERSISTENT_ID = "ohos.dms.persistentId"; constexpr const char* DEBUG_APP = "debugApp"; constexpr const char* NATIVE_DEBUG = "nativeDebug"; -constexpr const char* AUTO_FILL_PASSWORD_TPYE = "autoFill/password"; -constexpr const char* AUTO_FILL_SMART_TPYE = "autoFill/smart"; +constexpr const char* AUTO_FILL_PASSWORD_TYPE = "autoFill/password"; +constexpr const char* AUTO_FILL_SMART_TYPE = "autoFill/smart"; constexpr size_t INDEX_ZERO = 0; constexpr size_t INDEX_ONE = 1; constexpr size_t INDEX_TWO = 2; @@ -2911,9 +2908,9 @@ void AbilityManagerService::SetAutoFillElementName(const sptr &exte TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); CHECK_POINTER_IS_NULLPTR(extensionSessionInfo); std::vector argList; - if (extensionSessionInfo->want.GetStringParam(UIEXTENSION_TYPE_KEY) == AUTO_FILL_PASSWORD_TPYE) { + if (extensionSessionInfo->want.GetStringParam(UIEXTENSION_TYPE_KEY) == AUTO_FILL_PASSWORD_TYPE) { SplitStr(KEY_AUTO_FILL_ABILITY, "/", argList); - } else if (extensionSessionInfo->want.GetStringParam(UIEXTENSION_TYPE_KEY) == AUTO_FILL_SMART_TPYE) { + } else if (extensionSessionInfo->want.GetStringParam(UIEXTENSION_TYPE_KEY) == AUTO_FILL_SMART_TYPE) { SplitStr(KEY_SMART_AUTO_FILL_ABILITY, "/", argList); } else { TAG_LOGW(AAFwkTag::ABILITYMGR, "not autofill"); @@ -2999,6 +2996,8 @@ int AbilityManagerService::StartUIExtensionAbility(const sptr &exte int32_t result = DelayedSingleton::GetInstance()->CheckAndUpdateWant( extensionSessionInfo->want, AppExecFwk::ExecuteMode::UI_EXTENSION_ABILITY); if (result != ERR_OK) { + eventInfo.errCode = ERR_INVALID_VALUE; + EventReport::SendExtensionEvent(EventName::START_EXTENSION_ERROR, HiSysEventType::FAULT, eventInfo); return result; } } @@ -6172,11 +6171,9 @@ int32_t AbilityManagerService::InitialAbilityRequest(AbilityRequest &request, request.appInfo = request.abilityInfo.applicationInfo; request.uid = request.appInfo.uid; TAG_LOGD(AAFwkTag::ABILITYMGR, - "GenerateExtensionAbilityRequest end, app name: %{public}s, bundle name: %{public}s, uid: %{public}d.", - request.appInfo.name.c_str(), request.appInfo.bundleName.c_str(), request.uid); + "GenerateExtensionAbilityRequest end, app name:%{public}s, bundle name:%{public}s, uid:%{public}d, moduleName:%{public}s", + request.appInfo.name.c_str(), request.appInfo.bundleName.c_str(), request.uid, request.abilityInfo.moduleName.c_str()); - TAG_LOGD(AAFwkTag::ABILITYMGR, - "GenerateExtensionAbilityRequest, moduleName: %{public}s.", request.abilityInfo.moduleName.c_str()); request.want.SetModuleName(request.abilityInfo.moduleName); return ERR_OK; @@ -9416,9 +9413,8 @@ int AbilityManagerService::CheckCallOtherExtensionPermission(const AbilityReques return ERR_OK; } - const std::string fileAccessPermission = "ohos.permission.FILE_ACCESS_MANAGER"; if (extensionType == AppExecFwk::ExtensionAbilityType::FILEACCESS_EXTENSION && - AAFwk::PermissionVerification::GetInstance()->VerifyCallingPermission(fileAccessPermission)) { + AAFwk::PermissionVerification::GetInstance()->VerifyCallingPermission(PermissionConstants::PERMISSION_FILE_ACCESS_MANAGER)) { TAG_LOGD(AAFwkTag::ABILITYMGR, "Temporary, FILEACCESS_EXTENSION use serviceExtension start-up rule."); return CheckCallServiceExtensionPermission(abilityRequest); } diff --git a/services/appmgr/include/app_running_record.h b/services/appmgr/include/app_running_record.h index b40fd095bd..08cfc078b8 100644 --- a/services/appmgr/include/app_running_record.h +++ b/services/appmgr/include/app_running_record.h @@ -928,7 +928,6 @@ private: std::shared_ptr appInfo_ = nullptr; // the application's info of this process int32_t appRecordId_ = 0; - std::string appName_; std::string processName_; // the name of this process std::string specifiedProcessFlag_; // the flag of specified Process int64_t eventId_ = 0; diff --git a/services/appmgr/src/app_mgr_service.cpp b/services/appmgr/src/app_mgr_service.cpp index 400305fb0c..2210567d81 100644 --- a/services/appmgr/src/app_mgr_service.cpp +++ b/services/appmgr/src/app_mgr_service.cpp @@ -60,8 +60,6 @@ constexpr const char* TASK_APPLICATION_FOREGROUNDED = "ApplicationForegroundedTa constexpr const char* TASK_APPLICATION_BACKGROUNDED = "ApplicationBackgroundedTask"; constexpr const char* TASK_APPLICATION_TERMINATED = "ApplicationTerminatedTask"; constexpr const char* TASK_ABILITY_CLEANED = "AbilityCleanedTask"; -constexpr const char* TASK_ADD_APP_DEATH_RECIPIENT = "AddAppRecipientTask"; -constexpr const char* TASK_CLEAR_UP_APPLICATION_DATA = "ClearUpApplicationDataTask"; constexpr const char* TASK_STARTUP_RESIDENT_PROCESS = "StartupResidentProcess"; constexpr const char* TASK_ADD_ABILITY_STAGE_DONE = "AddAbilityStageDone"; constexpr const char* TASK_START_USER_TEST_PROCESS = "StartUserTestProcess"; diff --git a/services/uripermmgr/include/upms_policy_info.h b/services/uripermmgr/include/upms_policy_info.h index c5162682aa..ea4ae23e5e 100644 --- a/services/uripermmgr/include/upms_policy_info.h +++ b/services/uripermmgr/include/upms_policy_info.h @@ -16,9 +16,6 @@ #ifndef ABILITY_ABILITY_RUNTIME_UPMS_POLICY_INFO_H #define ABILITY_ABILITY_RUNTIME_UPMS_POLICY_INFO_H -#include -#include - namespace OHOS { namespace AAFwk { struct PolicyInfo final { diff --git a/test/unittest/appkit/main_thread_test/main_thread_test.cpp b/test/unittest/appkit/main_thread_test/main_thread_test.cpp index 0fe86c7ca0..95ff2e2d9f 100644 --- a/test/unittest/appkit/main_thread_test/main_thread_test.cpp +++ b/test/unittest/appkit/main_thread_test/main_thread_test.cpp @@ -1532,10 +1532,10 @@ HWTEST_F(MainThreadTest, LoadNativeLiabrary_0100, TestSize.Level1) std::string nativeLibraryPath = ""; ASSERT_NE(mainThread_, nullptr); BundleInfo bundleInfo; - mainThread_->LoadNativeLiabrary(bundleInfo, nativeLibraryPath); + mainThread_->LoadNativeLibrary(bundleInfo, nativeLibraryPath); nativeLibraryPath = "test/"; - mainThread_->LoadNativeLiabrary(bundleInfo, nativeLibraryPath); + mainThread_->LoadNativeLibrary(bundleInfo, nativeLibraryPath); TAG_LOGI(AAFwkTag::TEST, "%{public}s end.", __func__); } #endif