Signed-off-by: huangshiwei <huangshiwei4@huawei.com>
This commit is contained in:
huangshiwei
2022-11-11 15:47:25 +08:00
parent 7ebb3bc27d
commit 69089f0d4e
25 changed files with 65 additions and 64 deletions
@@ -3219,7 +3219,7 @@ void NapiJsContext::JsGetSelfPermissionsState(PermissionRequestTask &&task,
permissionsState.emplace_back(permState.state);
}
HILOG_DEBUG("permissions size: %{public}zu. permissionsState size: %{public}zu",
permissionList.size(), permissionsState.size());
permissionList.size(), permissionsState.size());
if (ret != TypePermissionOper::DYNAMIC_OPER) {
HILOG_DEBUG("No dynamic popup required.");
@@ -209,12 +209,12 @@ napi_value RegisterWrap(napi_env env, napi_callback_info info, DAHelperOnOffCB *
* @param env The environment that the Node-API call is invoked under.
* @param args Indicates the arguments passed into the callback.
* @param argcPromise Asynchronous data processing.
* @param insertCB Process data asynchronously.
* @param onCB Process data asynchronously.
*
* @return Return JS data successfully, otherwise return nullptr.
*/
napi_value RegisterAsync(
napi_env env, napi_value *args, size_t argcAsync, const size_t argcPromise, DAHelperOnOffCB *insertCB);
napi_env env, napi_value *args, size_t argcAsync, const size_t argcPromise, DAHelperOnOffCB *onCB);
/**
* @brief On asynchronous processing function.
@@ -249,11 +249,11 @@ napi_value UnRegisterWrap(napi_env env, napi_callback_info info, DAHelperOnOffCB
* @brief Off Async.
*
* @param env The environment that the Node-API call is invoked under.
* @param insertCB Process data asynchronously.
* @param offCB Process data asynchronously.
*
* @return Return JS data successfully, otherwise return nullptr.
*/
napi_value UnRegisterSync(napi_env env, DAHelperOnOffCB *insertCB);
napi_value UnRegisterSync(napi_env env, DAHelperOnOffCB *offCB);
/**
* @brief Off asynchronous processing function.
@@ -4982,7 +4982,8 @@ void JsNapiCommon::ChangeAbilityConnection(napi_ref *callbackArray, const napi_e
napi_create_reference(env, jsMethod, 1, &callbackArray[PARAM2]);
}
NativeValue* JsNapiCommon::JsGetContext(NativeEngine &engine, const NativeCallbackInfo &info, const AbilityType abilityType)
NativeValue* JsNapiCommon::JsGetContext(
NativeEngine &engine, const NativeCallbackInfo &info, const AbilityType abilityType)
{
if (!CheckAbilityType(abilityType)) {
HILOG_ERROR("ability type error");
+3 -3
View File
@@ -508,14 +508,14 @@ void Ability::OnConfigurationUpdated(const Configuration &configuration)
HILOG_DEBUG("%{public}s called.", __func__);
}
void Ability::OnConfigurationUpdatedNotify(const Configuration &changeConfiguration)
void Ability::OnConfigurationUpdatedNotify(const Configuration &configuration)
{
HILOG_DEBUG("%{public}s begin.", __func__);
std::string language;
std::string colormode;
std::string hasPointerDevice;
InitConfigurationProperties(changeConfiguration, language, colormode, hasPointerDevice);
InitConfigurationProperties(configuration, language, colormode, hasPointerDevice);
// Notify ResourceManager
std::unique_ptr<Global::Resource::ResConfig> resConfig(Global::Resource::CreateResConfig());
if (resConfig == nullptr) {
@@ -550,7 +550,7 @@ void Ability::OnConfigurationUpdatedNotify(const Configuration &changeConfigurat
abilityContext_->SetConfiguration(application_->GetConfiguration());
}
// Notify Ability Subclass
OnConfigurationUpdated(changeConfiguration);
OnConfigurationUpdated(configuration);
HILOG_DEBUG("%{public}s Notify Ability Subclass.", __func__);
}
@@ -61,7 +61,7 @@ AbilityProcess::AbilityProcess()
AbilityProcess::~AbilityProcess()
{}
ErrCode AbilityProcess::StartAbility(Ability *ability, CallAbilityParam param, CallbackInfo callback)
ErrCode AbilityProcess::StartAbility(Ability *ability, CallAbilityParam param, CallbackInfo callbackInfo)
{
HILOG_INFO("AbilityProcess::StartAbility begin");
if (ability == nullptr) {
@@ -98,8 +98,8 @@ ErrCode AbilityProcess::StartAbility(Ability *ability, CallAbilityParam param, C
HILOG_INFO("AbilityProcess::StartAbility ability: is in the abilityResultMap_");
map = it->second;
}
callback.errCode = err;
map[param.requestCode] = callback;
callbackInfo.errCode = err;
map[param.requestCode] = callbackInfo;
abilityResultMap_[ability] = map;
} else {
if (param.setting == nullptr) {
@@ -377,8 +377,8 @@ FormState JsFormExtension::OnAcquireFormState(const Want &want)
}
HILOG_INFO("%{public}s, state: %{public}d", __func__, state);
if (state <= static_cast<int32_t>(AppExecFwk::FormState::UNKNOWN)
|| state > static_cast<int32_t>(AppExecFwk::FormState::READY)) {
if (state <= static_cast<int32_t>(AppExecFwk::FormState::UNKNOWN) ||
state > static_cast<int32_t>(AppExecFwk::FormState::READY)) {
return AppExecFwk::FormState::UNKNOWN;
} else {
return static_cast<AppExecFwk::FormState>(state);
@@ -805,15 +805,15 @@ private:
};
} // namespace
NativeValue* CreateJsMetadata(NativeEngine& engine, const AppExecFwk::Metadata &Info)
NativeValue* CreateJsMetadata(NativeEngine& engine, const AppExecFwk::Metadata &info)
{
HILOG_INFO("CreateJsMetadata");
NativeValue* objValue = engine.CreateObject();
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
object->SetProperty("name", CreateJsValue(engine, Info.name));
object->SetProperty("value", CreateJsValue(engine, Info.value));
object->SetProperty("resource", CreateJsValue(engine, Info.resource));
object->SetProperty("name", CreateJsValue(engine, info.name));
object->SetProperty("value", CreateJsValue(engine, info.value));
object->SetProperty("resource", CreateJsValue(engine, info.resource));
return objValue;
}
@@ -17,7 +17,7 @@
namespace OHOS {
namespace AppExecFwk {
ErrCode StaticSubscriberProxy::OnReceiveEvent(CommonEventData* inData)
ErrCode StaticSubscriberProxy::OnReceiveEvent(CommonEventData* data)
{
MessageParcel data;
MessageParcel reply;
@@ -27,7 +27,7 @@ ErrCode StaticSubscriberProxy::OnReceiveEvent(CommonEventData* inData)
return ERR_INVALID_VALUE;
}
data.WriteParcelable(inData);
data.WriteParcelable(data);
int32_t st = Remote()->SendRequest(COMMAND_ON_RECEIVE_EVENT, data, reply, option);
if (st != ERR_NONE) {
+1 -1
View File
@@ -454,7 +454,7 @@ std::string ModSourceMap::TranslateBySourceMap(const std::string& stackStr, ModS
break;
}
static SourceMapData curMapData;
if(!bindSourceMaps.isStageModel) {
if (!bindSourceMaps.isStageModel) {
if (i == 1) { // The non module scenario initializes curmapdata only at the first traversal
if (!bindSourceMaps.nonModularMap_) {
return NOT_FOUNDMAP + stackStr;
@@ -167,7 +167,7 @@ public:
* @param start Indicates the zip content location start position.
* @param length Indicates the zip content length.
*/
void SetContentLocation(ZipPos start, size_t length);
void SetContentLocation(const ZipPos start, const size_t length);
/**
* @brief Get all entries in the zip file.
* @param start Indicates the zip content location start position.
@@ -48,35 +48,35 @@ public:
*
* @param ApplicationInfo&, the current application info.
*/
void SetApplicationInfo(const ApplicationInfo &);
void SetApplicationInfo(const ApplicationInfo &info);
/**
* @brief Setting information for the profile.
*
* @param Profile&, the current profile.
*/
void SetProfile(const Profile &);
void SetProfile(const Profile &profile);
/**
* @brief Setting information for the process.
*
* @param Profile&, the current process info.
*/
void SetProcessInfo(const ProcessInfo &);
void SetProcessInfo(const ProcessInfo &info);
/**
* @brief Setting id for app record.
*
* @param int32_t, the current app record id.
*/
void SetRecordId(const int32_t);
void SetRecordId(const int32_t recordId);
/**
* @brief Setting id for User.
*
* @param int32_t, the current app User.
*/
void SetUId(const int32_t);
void SetUId(const int32_t uId);
/**
* @brief set user test info.
@@ -32,13 +32,13 @@ public:
virtual ~ConnectionObserverProxy() = default;
virtual void OnExtensionConnected(const ConnectionData &data) override;
virtual void OnExtensionConnected(const ConnectionData &connectionData) override;
virtual void OnExtensionDisconnected(const ConnectionData &data) override;
virtual void OnExtensionDisconnected(const ConnectionData &connectionData) override;
virtual void OnDlpAbilityOpened(const DlpStateData &data) override;
virtual void OnDlpAbilityOpened(const DlpStateData &dlpData) override;
virtual void OnDlpAbilityClosed(const DlpStateData &data) override;
virtual void OnDlpAbilityClosed(const DlpStateData &dlpData) override;
private:
static inline BrokerDelegator<ConnectionObserverProxy> delegator_;
@@ -32,16 +32,16 @@ struct DlpConnectionInfo : public Parcelable {
/**
* @brief Marshals this Sequenceable object into a Parcel.
*
* @param outParcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
* @param parcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
*/
virtual bool Marshalling(Parcel &outParcel) const override;
virtual bool Marshalling(Parcel &parcel) const override;
/**
* @brief Unmarshals this Sequenceable object from a Parcel.
*
* @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
* @param parcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
*/
static DlpConnectionInfo *Unmarshalling(Parcel &inParcel);
static DlpConnectionInfo *Unmarshalling(Parcel &parcel);
int32_t dlpUid = 0;
int32_t openedAbilityCount = 0;
@@ -32,16 +32,16 @@ struct DlpStateData : public Parcelable {
/**
* @brief Marshals this Sequenceable object into a Parcel.
*
* @param outParcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
* @param parcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
*/
virtual bool Marshalling(Parcel &outParcel) const override;
virtual bool Marshalling(Parcel &parcel) const override;
/**
* @brief Unmarshals this Sequenceable object from a Parcel.
*
* @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
* @param parcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
*/
static DlpStateData *Unmarshalling(Parcel &inParcel);
static DlpStateData *Unmarshalling(Parcel &parcel);
int32_t targetPid = 0;
int32_t targetUid = 0;
@@ -67,8 +67,8 @@ class ModSourceMap final {
public:
explicit ModSourceMap() = default;
explicit ModSourceMap(const bool isStageModel) : isStageModel(isStageModel) {};
explicit ModSourceMap(const std::string& bundleCodeDir, const bool isStageModel) :
isStageModel(isStageModel), bundleCodeDir_(bundleCodeDir) {};
explicit ModSourceMap(const std::string& bundleCodeDir, const bool isStageModel) : isStageModel(isStageModel),
bundleCodeDir_(bundleCodeDir) {};
~ModSourceMap() = default;
static std::string TranslateBySourceMap(const std::string& stackStr, ModSourceMap& targetMaps,
@@ -50,9 +50,9 @@ public:
ErrCode GetPendingWantType(const sptr<IWantSender> &target, int32_t &type);
void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &recevier);
void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver);
void UnregisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &recevier);
void UnregisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver);
ErrCode GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want);
@@ -362,13 +362,13 @@ public:
* code to identify the results returned by abilities. The value ranges from 0 to 65535.
* @param resultCode Indicates the result code returned after the ability is started. You can define the result code
* to identify an error.
* @param resultData Indicates the data returned after the ability is started. You can define the data returned. The
* @param want Indicates the data returned after the ability is started. You can define the data returned. The
* value can be null.
*
*/
virtual void OnAbilityResult(int requestCode, int resultCode, const Want &resultData);
virtual void OnAbilityResult(int requestCode, int resultCode, const Want &want);
virtual void OnFeatureAbilityResult(int requestCode, int resultCode, const Want &resultData);
virtual void OnFeatureAbilityResult(int requestCode, int resultCode, const Want &want);
/**
* @brief Called back when the Back key is pressed.
@@ -42,7 +42,7 @@ public:
void OnConfigurationUpdated(const AppExecFwk::Configuration& configuration) override;
void OnMemoryLevel(int level) override;
void OnMemoryLevel(int32_t level) override;
private:
NativeValue* CallObjectMethod(const char* name, NativeValue * const * argv = nullptr, size_t argc = 0);
@@ -150,7 +150,7 @@ public:
*
* @param level Indicates the memory trim level, which shows the current memory usage status.
*/
void ScheduleMemoryLevel(int level) override;
void ScheduleMemoryLevel(const int level) override;
/**
*
@@ -45,9 +45,9 @@ public:
* ScheduleAbilityTransaction, schedule ability to transform life state.
*
* @param Want, Special Want for service type's ability.
* @param targetState, The lifecycle state to be transformed
* @param stateInfo, The lifecycle state to be transformed
*/
void ScheduleAbilityTransaction(const Want &want, const LifeCycleStateInfo &targetState) override;
void ScheduleAbilityTransaction(const Want &want, const LifeCycleStateInfo &stateInfo) override;
/*
* SendResult, Send result to app when ability is terminated with result want.
+3 -3
View File
@@ -113,13 +113,13 @@ public:
*
* @param token, the token of ability.
* @param preToken, the token of ability's caller.
* @param abilityinfo, ability info.
* @param application, application info.
* @param abilityInfo, ability info.
* @param applicationInfo, application info.
* @param want ability want
* @return true on success ,false on failure.
*/
int LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const AppExecFwk::AbilityInfo &abilityinfo, const AppExecFwk::ApplicationInfo &application,
const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo,
const Want &want);
/**
@@ -21,26 +21,26 @@
namespace OHOS {
namespace AAFwk {
void StopUserCallbackProxy::OnStopUserDone(int accountId, int errcode)
void StopUserCallbackProxy::OnStopUserDone(int userId, int errcode)
{
SendRequestCommon(accountId, errcode, IStopUserCallback::StopUserCallbackCmd::ON_STOP_USER_DONE);
SendRequestCommon(userId, errcode, IStopUserCallback::StopUserCallbackCmd::ON_STOP_USER_DONE);
}
void StopUserCallbackProxy::SendRequestCommon(int accountId, int errcode, IStopUserCallback::StopUserCallbackCmd cmd)
void StopUserCallbackProxy::SendRequestCommon(int userId, int errcode, IStopUserCallback::StopUserCallbackCmd cmd)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
HILOG_INFO("StopUserCallbackProxy, sendrequest, cmd:%{public}d, accountId:%{public}d, errcode:%{public}d",
cmd, accountId, errcode);
HILOG_INFO("StopUserCallbackProxy, sendrequest, cmd:%{public}d, userId:%{public}d, errcode:%{public}d",
cmd, userId, errcode);
if (!data.WriteInterfaceToken(IStopUserCallback::GetDescriptor())) {
HILOG_ERROR("Write interface token failed.");
return;
}
if (!data.WriteInt32(accountId)) {
HILOG_ERROR("Write accountId error.");
if (!data.WriteInt32(userId)) {
HILOG_ERROR("Write userId error.");
return;
}
@@ -279,8 +279,8 @@ void SystemDialogScheduler::GetDialogPositionAndSize(DialogType type, DialogPosi
position.offsetX = (display->GetWidth() - position.width) / UI_HALF;
position.offsetY = (display->GetHeight() - position.height) / UI_HALF;
} else {
position.window_width = position.window_width/UI_HALF;
position.window_height = position.window_height/UI_HALF;
position.window_width = position.window_width / UI_HALF;
position.window_height = position.window_height / UI_HALF;
position.offsetX = LINE_NUMS_ZERO;
position.offsetY = LINE_NUMS_ZERO;
}
@@ -31,7 +31,7 @@ namespace OHOS {
namespace {
constexpr size_t FOO_MAX_LEN = 1024;
constexpr size_t U32_AT_SIZE = 4;
}
}
sptr<Token> GetFuzzAbilityToken()
{
@@ -28,7 +28,7 @@ namespace OHOS {
namespace {
constexpr size_t FOO_MAX_LEN = 1024;
constexpr size_t U32_AT_SIZE = 4;
}
}
const std::u16string ABILITYMGR_INTERFACE_TOKEN = u"ohos.abilityshell.DistributedConnection";
class AbilityConnectionStubFuzzTest : public AbilityConnectionStub {