diff --git a/frameworks/kits/ability/native/src/ability.cpp b/frameworks/kits/ability/native/src/ability.cpp index d2ae59a1d5fa830963c9fd819967049a8b23217e..78460c2a762a7ff72804db83da2cf4ac913d3b4e 100755 --- a/frameworks/kits/ability/native/src/ability.cpp +++ b/frameworks/kits/ability/native/src/ability.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#include #include #include "ability.h" @@ -1682,7 +1683,7 @@ bool Ability::CastTempForm(const int64_t formId) return false; } - //APP_LOGI("%{public}s, castTempForm begin of temp form %{public}lld", __func__, formId); + APP_LOGI("%{public}s, castTempForm begin of temp form %{public}" PRId64 "", __func__, formId); bool result = FormMgr::GetInstance().CastTempForm(formId, FormHostClient::GetInstance()); @@ -1725,7 +1726,7 @@ bool Ability::AcquireForm(const int64_t formId, const Want &want, const std::sha } // check form id - //APP_LOGD("%{public}s, param of formId %{public}lld.", __func__, formId); + APP_LOGD("%{public}s, param of formId %{public}" PRId64 ".", __func__, formId); if (formId < 0) { APP_LOGE("%{public}s error, form id should not be negative.", __func__); return false; @@ -1740,7 +1741,7 @@ bool Ability::AcquireForm(const int64_t formId, const Want &want, const std::sha ElementName elementName = want.GetElement(); std::string bundleName = elementName.GetBundleName(); std::string abilityName = elementName.GetAbilityName(); - //APP_LOGI("%{public}s, begin to acquire form, bundleName is %{public}s, abilityName is %{public}s, formId is %{public}lld.",__func__, bundleName.c_str(), abilityName.c_str(), formId); + APP_LOGI("%{public}s, begin to acquire form, bundleName is %{public}s, abilityName is %{public}s, formId is %{public}" PRId64 ".",__func__, bundleName.c_str(), abilityName.c_str(), formId); // hostClient init sptr formHostClient = FormHostClient::GetInstance(); @@ -1755,8 +1756,8 @@ bool Ability::AcquireForm(const int64_t formId, const Want &want, const std::sha APP_LOGE("%{public}s error, acquire form for fms failed.", __func__); return false; } - // APP_LOGI("%{public}s, end to acquire form, the formId returned from the fms is %{public}lld.", - // __func__, formJsInfo.formId); + APP_LOGI("%{public}s, end to acquire form, the formId returned from the fms is %{public}" PRId64 ".", + __func__, formJsInfo.formId); // check for form presence in hostForms if (formHostClient->ContainsForm(formJsInfo.formId)) { @@ -1927,7 +1928,7 @@ void Ability::ProcessFormUninstall(const int64_t formId) { // call the callback function when you need to be notified if (appCallbackIterator == appCallbacks_.end()) { - //APP_LOGE("%{public}s failed, callback not find, formId: %{public}lld.", __func__, formId); + APP_LOGE("%{public}s failed, callback not find, formId: %{public}" PRId64 ".", __func__, formId); return; } formCallback = appCallbackIterator->second; @@ -2036,8 +2037,8 @@ bool Ability::DeleteForm(const int64_t formId, const int32_t deleteType) return false; } - // APP_LOGI("%{public}s, delete form begin, formId is %{public}lld and deleteType is %{public}d.", - // __func__, formId, deleteType); + APP_LOGI("%{public}s, delete form begin, formId is %{public}" PRId64 " and deleteType is %{public}d.", + __func__, formId, deleteType); { // form lock std::lock_guard lock(formLock); @@ -2098,7 +2099,7 @@ void Ability::CleanFormResource(const int64_t formId) return; } - //APP_LOGD("%{public}s. clean id is %{public}lld.", __func__, cleanId); + APP_LOGD("%{public}s. clean id is %{public}" PRId64 ".", __func__, cleanId); // remove wantParam, callback and lostedByReconnectTempForms appCallbacks_.erase(cleanId); userReqParams_.erase(cleanId); @@ -2177,7 +2178,7 @@ void Ability::HandleFormMessage(const int32_t msgCode, const FormJsInfo &formJsI // call the callback function when you need to be notified if (appCallbackIterator == appCallbacks_.end()) { - // APP_LOGE("%{public}s failed, callback not find, formId: %{public}lld.", __func__, formJsInfo.formId); + APP_LOGE("%{public}s failed, callback not find, formId: %{public}" PRId64 ".", __func__, formJsInfo.formId); return; } formCallback = appCallbackIterator->second; @@ -2187,7 +2188,7 @@ void Ability::HandleFormMessage(const int32_t msgCode, const FormJsInfo &formJsI return; } - //APP_LOGI("%{public}s, call user implement of form %{public}lld.", __func__, formJsInfo.formId); + APP_LOGI("%{public}s, call user implement of form %{public}" PRId64 ".", __func__, formJsInfo.formId); if (msgCode == OHOS_FORM_ACQUIRE_FORM) { formCallback->OnAcquired(FormCallback::OHOS_FORM_ACQUIRE_SUCCESS, formJsInfo); @@ -2384,7 +2385,7 @@ void Ability::OnDeathReceived() bool result = ReAcquireForm(formId, want); if (!result) { - // APP_LOGI("%{public}s error, reacquire form failed, formId:%{public}lld.", __func__, formId); + APP_LOGI("%{public}s error, reacquire form failed, formId:%{public}" PRId64 ".", __func__, formId); std::shared_ptr formCallback = nullptr; { std::lock_guard lock(formLock); @@ -2392,7 +2393,7 @@ void Ability::OnDeathReceived() std::map>::iterator appCallbackIterator = appCallbacks_.find(formId); if (appCallbackIterator == appCallbacks_.end()) { - //APP_LOGW("%{public}s error, lack of form callback for form, formId:%{public}lld.", __func__, formId); + APP_LOGW("%{public}s error, lack of form callback for form, formId:%{public}" PRId64 ".", __func__, formId); continue; } formCallback = appCallbackIterator->second; @@ -2423,7 +2424,7 @@ bool Ability::ReAcquireForm(const int64_t formId, const Want &want) // get the form host client sptr formHostClient = FormHostClient::GetInstance(); if (formHostClient == nullptr) { - //APP_LOGE("%{public}s error, formHostClient is nullptr, formId:%{public}lld.", __func__, formId); + APP_LOGE("%{public}s error, formHostClient is nullptr, formId:%{public}" PRId64 ".", __func__, formId); return false; } @@ -2431,7 +2432,7 @@ bool Ability::ReAcquireForm(const int64_t formId, const Want &want) FormJsInfo formJsInfo; if (FormMgr::GetInstance().AddForm(formId, want, formHostClient, formJsInfo) != ERR_OK || formJsInfo.formId <= 0 || formJsInfo.formId != formId) { - //APP_LOGE("%{public}s error, fms reacquire form failed, formId:%{public}lld.", __func__, formId); + APP_LOGE("%{public}s error, fms reacquire form failed, formId:%{public}" PRId64 ".", __func__, formId); return false; } diff --git a/frameworks/kits/ability/native/src/form_provider_client.cpp b/frameworks/kits/ability/native/src/form_provider_client.cpp index 03805526ccb896d80f478928b5087490b8802b28..a94857d5bcf46d33f32a4df448f94bfae495c569 100755 --- a/frameworks/kits/ability/native/src/form_provider_client.cpp +++ b/frameworks/kits/ability/native/src/form_provider_client.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "form_provider_client.h" #include "appexecfwk_errors.h" #include "app_log_wrapper.h" @@ -67,8 +70,8 @@ int FormProviderClient::AcquireProviderFormInfo( FormProviderInfo formProviderInfo = ownerAbility->OnCreate(cloneWant); formProviderInfo.SetFormId(formId); newWant.SetParam(Constants::PROVIDER_FLAG, ERR_OK); - // APP_LOGD("%{public}s, formId: %{public}lld, data: %{public}s", - // __func__, formProviderInfo.GetFormId(), formProviderInfo.GetFormDataString().c_str()); + APP_LOGD("%{public}s, formId: %{public}" PRId64 ", data: %{public}s", + __func__, formProviderInfo.GetFormId(), formProviderInfo.GetFormDataString().c_str()); return HandleAcquire(formProviderInfo, newWant, callerToken); } @@ -145,8 +148,8 @@ int FormProviderClient::NotifyFormsDelete( break; } - // APP_LOGI("%{public}s come,formIds size=%{public}d, abilityName:%{public}s", - // __func__, formIds.size(), ownerAbility->GetAbilityName().c_str()); + APP_LOGI("%{public}s come,formIds size=%{public}zu, abilityName:%{public}s", + __func__, formIds.size(), ownerAbility->GetAbilityName().c_str()); for (int64_t formId : formIds) { ownerAbility->OnDelete(formId); } diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/pac_map.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/pac_map.cpp index f55ad05f863e0c2f7ccceb8ad7b8baca2ce050e1..0d8467f30e73113335a1c59bc31765b8502dfb66 100755 --- a/frameworks/kits/content/cpp/src/ohos/aafwk/content/pac_map.cpp +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/pac_map.cpp @@ -99,7 +99,7 @@ const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$"); std::size_t size = value.size(); \ sptr ao = new Array(size, g_IID_##I##id); \ for (std::size_t i = 0; i < size; i++) { \ - ao->Set(i, id::Box(value[i])); \ + ao->Set(i, id::Box((value)[i])); \ } \ (mapList).emplace(key, sptr(static_cast(ao.GetRefPtr()))); \ } while (0); @@ -112,7 +112,7 @@ const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$"); if (Array::Is##id##Array(IArray::Query(it->second.GetRefPtr()))) { \ auto func = [&](IInterface *object) { \ if (I##id::Query(object) != nullptr) { \ - value.push_back(id::Unbox(I##id::Query(object))); \ + (value).push_back(id::Unbox(I##id::Query(object))); \ } \ }; \ Array::ForEach(IArray::Query(it->second.GetRefPtr()), func); \ @@ -121,6 +121,15 @@ const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$"); } \ } while (0); +template +static void GetBaseDataValue(OHOS::AAFwk::IInterface *baseObj, Json::Value &json, int type) +{ + IClassName *data = IClassName::Query(baseObj); + baseValue val = 0; + data->GetValue(val); + json["data"] = val; + json["type"] = type; +} #define GET_BASE_DATA_VALUE(id, it, value, json, type) \ do { \ I##id *data = I##id::Query((it)->second.GetRefPtr()); \ @@ -130,6 +139,19 @@ const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$"); (json)["type"] = type; \ } while (0); +template +static std::string RawTypeToString(const RawType value, unsigned int precisionAfterPoint); + +template +static void GetBaseFloatDoubleDataValue(OHOS::AAFwk::IInterface *baseObj, Json::Value &json, int type, int precision) +{ + IClassName *data = IClassName::Query(baseObj); + if (data != nullptr) { + baseValue val = ClassName::Unbox(data); + json["data"] = RawTypeToString(val, precision); + json["type"] = type; + } +} #define GET_BASE_FLOAT_DOUBLE_DATA_VALUE(iid, id, it, value, precision, json, type) \ do { \ iid *data = iid::Query((it)->second); \ @@ -158,6 +180,24 @@ const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$"); (json)["type"] = type; \ } while (0); +template +static void PacmapGetArrayVal(OHOS::AAFwk::IInterface *ao, std::vector &array) +{ + if (ao == nullptr) { + return; + } + if (IArray::Query(ao) != nullptr) { + auto func = [&](AAFwk::IInterface *object) { + if (object != nullptr) { + IClassName *value = IClassName::Query(object); + if (value != nullptr) { + array.emplace_back(ClassName::Unbox(value)); + } + } + }; + Array::ForEach(IArray::Query(ao), func); + } +} #define PAC_MAP_GET_ARRAY_VAL(idInterface, id, ao, array) \ do { \ if ((ao) == nullptr) { \ @@ -1204,26 +1244,28 @@ static std::string RawTypeToString(const RawType value, unsigned int precisionAf bool PacMap::GetBaseJsonValue(PacMapList::const_iterator &it, Json::Value &json) const { - // base data : long =>string + // base data : short if (IShort::Query(it->second.GetRefPtr()) != nullptr) { - GET_BASE_DATA_VALUE(Short, it, short, json, PACMAP_DATA_SHORT) + GetBaseDataValue(it->second.GetRefPtr(), json, PACMAP_DATA_SHORT); } else if (IInteger::Query(it->second.GetRefPtr()) != nullptr) { - GET_BASE_DATA_VALUE(Integer, it, int, json, PACMAP_DATA_INTEGER) + GetBaseDataValue(it->second.GetRefPtr(), json, PACMAP_DATA_INTEGER); } else if (ILong::Query(it->second.GetRefPtr()) != nullptr) { // long:string GET_BASE_LONG_DATA_VALUE(Long, it, long, json, PACMAP_DATA_LONG) } else if (IChar::Query(it->second.GetRefPtr()) != nullptr) { - GET_BASE_DATA_VALUE(Char, it, zchar, json, PACMAP_DATA_CHAR) + GetBaseDataValue(it->second.GetRefPtr(), json, PACMAP_DATA_CHAR); } else if (IByte::Query(it->second.GetRefPtr()) != nullptr) { - GET_BASE_DATA_VALUE(Byte, it, byte, json, PACMAP_DATA_BYTE) + GetBaseDataValue(it->second.GetRefPtr(), json, PACMAP_DATA_BYTE); } else if (IBoolean::Query(it->second.GetRefPtr()) != nullptr) { - GET_BASE_DATA_VALUE(Boolean, it, bool, json, PACMAP_DATA_BOOLEAN) + GetBaseDataValue(it->second.GetRefPtr(), json, PACMAP_DATA_BOOLEAN); } else if (IFloat::Query(it->second.GetRefPtr()) != nullptr) { // base long:string - GET_BASE_FLOAT_DOUBLE_DATA_VALUE(IFloat, Float, it, float, FLOAT_PRECISION, json, PACMAP_DATA_FLOAT) + GetBaseFloatDoubleDataValue( + it->second.GetRefPtr(), json, PACMAP_DATA_FLOAT, FLOAT_PRECISION); } else if (IDouble::Query(it->second.GetRefPtr()) != nullptr) { // base :double to string - GET_BASE_FLOAT_DOUBLE_DATA_VALUE(IDouble, Double, it, double, DOUBLE_PRECISION, json, PACMAP_DATA_DOUBLE) + GetBaseFloatDoubleDataValue( + it->second.GetRefPtr(), json, PACMAP_DATA_DOUBLE, DOUBLE_PRECISION); } else if (IString::Query(it->second.GetRefPtr()) != nullptr) { GET_BASE_STRING_DATA_VALUE(String, it, std::string, json, PACMAP_DATA_STRING) } else if (IArray::Query(it->second.GetRefPtr()) != nullptr) { @@ -1347,39 +1389,39 @@ bool PacMap::GetArrayJsonValue(PacMapList::const_iterator &it, Json::Value &json return false; } if (Array::IsShortArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::IShort, AAFwk::Short, it->second.GetRefPtr(), array) - return ToJsonArrayShort(array, json, PACMAP_DATA_ARRAY_SHORT); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayShort(arrayData, json, PACMAP_DATA_ARRAY_SHORT); } else if (Array::IsIntegerArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::IInteger, AAFwk::Integer, it->second.GetRefPtr(), array) - return ToJsonArrayInt(array, json, PACMAP_DATA_ARRAY_INTEGER); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayInt(arrayData, json, PACMAP_DATA_ARRAY_INTEGER); } else if (Array::IsLongArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::ILong, AAFwk::Long, it->second.GetRefPtr(), array); - return ToJsonArrayLong(array, json, PACMAP_DATA_ARRAY_LONG); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayLong(arrayData, json, PACMAP_DATA_ARRAY_LONG); } else if (Array::IsCharArray(array)) { return false; } else if (Array::IsByteArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::IByte, AAFwk::Byte, it->second.GetRefPtr(), array); - return ToJsonArrayByte(array, json, PACMAP_DATA_ARRAY_BYTE); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayByte(arrayData, json, PACMAP_DATA_ARRAY_BYTE); } else if (Array::IsBooleanArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::IBoolean, AAFwk::Boolean, it->second.GetRefPtr(), array); - return ToJsonArrayBoolean(array, json, PACMAP_DATA_ARRAY_BOOLEAN); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayBoolean(arrayData, json, PACMAP_DATA_ARRAY_BOOLEAN); } else if (Array::IsFloatArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::IFloat, AAFwk::Float, it->second.GetRefPtr(), array); - return ToJsonArrayFloat(array, json, PACMAP_DATA_ARRAY_FLOAT); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayFloat(arrayData, json, PACMAP_DATA_ARRAY_FLOAT); } else if (Array::IsDoubleArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::IDouble, AAFwk::Double, it->second.GetRefPtr(), array); - return ToJsonArrayDouble(array, json, PACMAP_DATA_ARRAY_DOUBLE); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayDouble(arrayData, json, PACMAP_DATA_ARRAY_DOUBLE); } else if (Array::IsStringArray(array)) { - std::vector array; - PAC_MAP_GET_ARRAY_VAL(AAFwk::IString, AAFwk::String, it->second.GetRefPtr(), array); - return ToJsonArrayString(array, json, PACMAP_DATA_ARRAY_STRING); + std::vector arrayData; + PacmapGetArrayVal(it->second.GetRefPtr(), arrayData); + return ToJsonArrayString(arrayData, json, PACMAP_DATA_ARRAY_STRING); } else { return false; } diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp index a222e15114539fb353233646b40d7b021a22dcfa..cf50fa11dbe9d122516d494af0ac42f783ba9c42 100755 --- a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp @@ -244,21 +244,6 @@ bool WantParams::operator==(const WantParams &other) return true; } -// #define GETWRAPDATATYPE(id, value, ret) \ -// do { \ -// if (value != nullptr && id::Query(value) != nullptr) { \ -// return ret; \ -// } else { \ -// break; \ -// } \ -// } while (0) -// #define GETSPTRBYTYPE(type, typeid, typeClass, str) \ -// do { \ -// if (type == typeid) { \ -// return typeClass::Parse(str); \ -// } \ -// } while (0) - int WantParams::GetDataType(const sptr iIt) { if (iIt != nullptr && IBoolean::Query(iIt) != nullptr) { diff --git a/interfaces/kits/js/@ohos.ability.featureAbility.d.ts b/interfaces/kits/js/@ohos.ability.featureAbility.d.ts index de9a10b563ec87bcaf89086cd8a9d526e1bf69a2..e0c406e16fdef1248cebc52123c1bf370ac5cb82 100755 --- a/interfaces/kits/js/@ohos.ability.featureAbility.d.ts +++ b/interfaces/kits/js/@ohos.ability.featureAbility.d.ts @@ -101,27 +101,6 @@ declare namespace featureAbility { function hasWindowFocus(callback: AsyncCallback): void; function hasWindowFocus(): Promise; - /** - * Connects an ability to a Service ability. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param request Indicates the Service ability to connect. - * @param options Indicates the callback object when the Service ability is connected. - * @return Returns true if the connection is successful; returns false otherwise. - */ - function connectAbility(request: Want, options:ConnectOptions): number; - - /** - * Disconnects an ability from a Service ability. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param connection Indicates the Service ability to disconnect. - */ - function disconnectAbility(connection: number, callback:AsyncCallback): void; - function disconnectAbility(connection: number): Promise; - /** * Obtains the type of this application. * @devices phone, tablet diff --git a/interfaces/kits/js/@ohos.ability.particleAbility.d.ts b/interfaces/kits/js/@ohos.ability.particleAbility.d.ts index f276af1c0c90194dbbde3e184db691f311eef4da..ba62b6f6bd0c0010af6f123889b9b922161ec6df 100644 --- a/interfaces/kits/js/@ohos.ability.particleAbility.d.ts +++ b/interfaces/kits/js/@ohos.ability.particleAbility.d.ts @@ -47,26 +47,5 @@ declare namespace particleAbility { */ function stopAbility(request: Want, callback:AsyncCallback): void; function stopAbility(request: Want): Promise; - - /** - * Connects an ability to a Service ability. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param request Indicates the Service ability to connect. - * @param options Indicates the callback object when the Service ability is connected. - * @return Returns true if the connection is successful; returns false otherwise. - */ - function connectAbility(request: Want, options:ConnectOptions): number; - - /** - * Disconnects an ability from a Service ability. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param connection Indicates the Service ability to disconnect. - */ - function disconnectAbility(connection: number, callback:AsyncCallback): void; - function disconnectAbility(connection: number): Promise; } export default particleAbility; diff --git a/interfaces/kits/js/@ohos.bundle.d.ts b/interfaces/kits/js/@ohos.bundle.d.ts index 08c015fea981efd5c6c713dd75f9a30e283bab64..096175baf7459bc1d5b186d9aa481d0cd559eb80 100644 --- a/interfaces/kits/js/@ohos.bundle.d.ts +++ b/interfaces/kits/js/@ohos.bundle.d.ts @@ -1,235 +1,374 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AsyncCallback } from './basic'; -import { ApplicationInfo } from './bundle/applicationInfo'; -import { BundleInfo } from './bundle/bundleInfo'; -import { AbilityInfo } from './bundle/abilityInfo'; -import { Want } from './ability/want'; -import { BundleInstaller } from './bundle/bundleInstaller'; -import { ElementName } from './bundle/elementName'; -import { ShortcutInfo } from './bundle/shortcutInfo'; -import { ModuleUsageRecord } from './bundle/moduleUsageRecord'; -import permission from './@ohos.security.permission'; - -/** - * @name BundleFlag - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -type PermissionEvent = 'permissionChange' | 'anyPermissionChange'; - -/** - * bundle. - * @name bundle - * @since 3 - * @sysCap appexecfwk - * @devices phone, tablet - * @permission N/A - */ -declare namespace bundle { - - enum BundleFlag { - GET_BUNDLE_DEFAULT = 0x00000000, - GET_BUNDLE_WITH_ABILITIES = 0x00000001, - GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008, - } - - export enum GrantStatus { - PERMISSION_DENIED = -1, - PERMISSION_GRANTED = 0, - } - - /** - * @name AbilityType - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ - export enum AbilityType { - UNKNOWN, - PAGE, - SERVICE, - DATA, - } - - /** - * @name AbilitySubType - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ - export enum AbilitySubType { - UNSPECIFIED = 0, - CA = 1, - } - - /** - * @name DisplayOrientation - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ - export enum DisplayOrientation { - UNSPECIFIED, - LANDSCAPE, - PORTRAIT, - FOLLOWRECENT, - } - - /** - * @name LaunchMode - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ - export enum LaunchMode { - SINGLETON = 0, - STANDARD = 1, - } - - export enum InstallErrorCode{ - SUCCESS = 0, - STATUS_INSTALL_FAILURE = 1, - STATUS_INSTALL_FAILURE_ABORTED = 2, - STATUS_INSTALL_FAILURE_INVALID = 3, - STATUS_INSTALL_FAILURE_CONFLICT = 4, - STATUS_INSTALL_FAILURE_STORAGE = 5, - STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6, - STATUS_UNINSTALL_FAILURE = 7, - STATUS_UNINSTALL_FAILURE_BLOCKED = 8, - STATUS_UNINSTALL_FAILURE_ABORTED = 9, - STATUS_UNINSTALL_FAILURE_CONFLICT = 10, - STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B, - STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C, - STATUS_ABILITY_NOT_FOUND = 0x40, - STATUS_BMS_SERVICE_ERROR = 0x41 - } - - /** - * Obtains BundleInfo based on a given bundle name. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param bundleName Indicates the bundle name. - * @param callback Specified callback method. - */ - function getBundleInfo(bundleName: string, bundelFlags: number, callback: AsyncCallback): void; - - /** - * Obtains Bundle installer to install or uninstall hap. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @return BundleInstaller. - */ - function getBundleInstaller(callback: AsyncCallback): void; - function getBundleInstaller(): Promise; - - /** - * Obtains the ApplicationInfo based on a given application name. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param bundleName Indicates the application name. - * @param callback Specified callback method. - */ - function getApplicationInfo(bundleName: string, bundelFlags: number, userId: number, callback: AsyncCallback) : void; - function getApplicationInfo(bundleName: string, bundelFlags: number, userId?: number) : Promise; - - function checkPermission(bundleName: string, permission: string, callback: AsyncCallback): void; - function checkPermission(bundleName: string, permission: string): Promise; - - /** - * Obtains BundleInfo of all bundles available in the system. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param callback Specified callback method. - */ - function getBundleInfos(bundelFlag: BundleFlag, callback: AsyncCallback>) : void; - function getBundleInfos(bundelFlag: BundleFlag) : Promise>; - - // void registerAllPermissionsChanged(IRemoteObject callback) throws RemoteException; - function on(type: PermissionEvent, callback: AsyncCallback): void; - function on(type: PermissionEvent, uids: Array, callback: AsyncCallback): void; - - // void unregisterPermissionsChanged(IRemoteObject callback) throws RemoteException; - function off(type: PermissionEvent, callback: AsyncCallback):void; - function off(type: PermissionEvent, uids: Array, callback: AsyncCallback): void; - - /** - * Obtains information about all installed applications. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param callback Specified callback method. - */ - function getApplicationInfos(bundelFlags: number, userId: number, callback: AsyncCallback>) : void; - function getApplicationInfos(bundelFlags: number, callback: AsyncCallback>) : void; - function getApplicationInfos(bundelFlags: number, userId?: number) : Promise>; - - /** - * Obtains information about a bundle contained in a HAP. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param hapFilePath Indicates the path of the HAP. - * @param callback Specified callback method. - */ - function getBundleArchiveInfo(hapFilePath: string, bundelFlags: number, callback: AsyncCallback) : void - function getBundleArchiveInfo(hapFilePath: string, bundelFlags: number) : Promise; - - // List getShortcutInfos(String bundleName) throws RemoteException; - function getShortcutInfos(bundleName: string, callback: AsyncCallback>): void; - function getShortcutInfos(bundleName: string): Promise>; - - /** - * Obtains detailed information about a specified permission. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param permissionName Indicates the name of the permission. - * @param callback Specified callback method. - */ - function getPermissionDef(permissionName: string, callback: AsyncCallback) : void; - function getPermissionDef(permissionName: string) : Promise; - - function getHomeShortcutInfos(callback: AsyncCallback>): void; - function getHomeShortcutInfos(): Promise; - - // List getModuleUsageRecords(int maxNum) throws RemoteException, IllegalArgumentException; - function getModuleUsageRecords(maxNum: number, callback: AsyncCallback>): void; - function getModuleUsageRecords(maxNum: number): Promise>; -} - -export default bundle; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { AsyncCallback, Callback } from './basic'; +import { ApplicationInfo } from './bundle/applicationInfo'; +import { BundleInfo } from './bundle/bundleInfo'; +import { AbilityInfo } from './bundle/abilityInfo'; +import { Want } from './ability/want'; +import { BundleInstaller } from './bundle/bundleInstaller'; +import { ElementName } from './bundle/elementName'; +import { ShortcutInfo } from './bundle/shortcutInfo'; +import { ModuleUsageRecord } from './bundle/moduleUsageRecord'; +import permission from './@ohos.security.permission'; + +/** + * @default Indicates the permission event + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ +type PermissionEvent = 'permissionChange' | 'anyPermissionChange'; + +/** + * bundle. + * @name bundle + * @since 7 + * @sysCap SystemCapability.Appexecfwk + * @devices phone, tablet, tv, wearable + * @permission NA + */ +declare namespace bundle { + + /** + * @name BundleFlag + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @import NA + * @permission NA + * @devices phone, tablet, tv, wearable + */ + enum BundleFlag { + GET_BUNDLE_DEFAULT = 0x00000000, + GET_BUNDLE_WITH_ABILITIES = 0x00000001, + GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008, + } + + /** + * @name GrantStatus + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @import NA + * @permission NA + * @devices phone, tablet, tv, wearable + */ + export enum GrantStatus { + PERMISSION_DENIED = -1, + PERMISSION_GRANTED = 0, + } + + /** + * @name AbilityType + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @import NA + * @permission NA + * @devices phone, tablet, tv, wearable + */ + export enum AbilityType { + /** + * @default Indicates an unknown ability type + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + UNKNOWN, + + /** + * @default Indicates that the ability has a UI + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + PAGE, + + /** + * @default Indicates that the ability does not have a UI + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + SERVICE, + + /** + * @default Indicates that the ability is used to provide data access services + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + DATA, + } + + /** + * @name AbilitySubType + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @import NA + * @permission NA + * @devices phone, tablet, tv, wearable + */ + export enum AbilitySubType { + UNSPECIFIED = 0, + CA = 1, + } + + /** + * @name DisplayOrientation + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @import NA + * @permission NA + * @devices phone, tablet, tv, wearable + */ + export enum DisplayOrientation { + /** + * @default Indicates that the system automatically determines the display orientation + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + UNSPECIFIED, + + /** + * @default Indicates the landscape orientation + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + LANDSCAPE, + + /** + * @default Indicates the portrait orientation + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + PORTRAIT, + + /** + * @default Indicates the page ability orientation is the same as that of the nearest ability in the stack + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + FOLLOW_RECENT, + } + + /** + * @name LaunchMode + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @import NA + * @permission NA + * @devices phone, tablet, tv, wearable + */ + export enum LaunchMode { + /** + * @default Indicates that the ability has only one instance + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + SINGLETON = 0, + + /** + * @default Indicates that the ability can have multiple instances + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + STANDARD = 1, + } + + /** + * @name InstallErrorCode + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @import NA + * @permission NA + * @devices phone, tablet, tv, wearable + */ + export enum InstallErrorCode{ + SUCCESS = 0, + STATUS_INSTALL_FAILURE = 1, + STATUS_INSTALL_FAILURE_ABORTED = 2, + STATUS_INSTALL_FAILURE_INVALID = 3, + STATUS_INSTALL_FAILURE_CONFLICT = 4, + STATUS_INSTALL_FAILURE_STORAGE = 5, + STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6, + STATUS_UNINSTALL_FAILURE = 7, + STATUS_UNINSTALL_FAILURE_BLOCKED = 8, + STATUS_UNINSTALL_FAILURE_ABORTED = 9, + STATUS_UNINSTALL_FAILURE_CONFLICT = 10, + STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B, + STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C, + STATUS_ABILITY_NOT_FOUND = 0x40, + STATUS_BMS_SERVICE_ERROR = 0x41 + } + + /** + * Obtains based on a given networkId and bundle name. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param networkId Indicates the device networkId in area network. + * @param bundleName Indicates the application bundle name to be queried. + * @param flags Indicates the flag used to specify information contained in that will be + * returned. + * @return Returns the BundleInfo object. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED,ohos.permission.GET_BUNDLE_INFO + */ + function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; + + /** + * Obtains the interface used to install bundles. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @return Returns the IBundleInstaller interface. + * @permission ohos.permission.INSTALL_BUNDLE + */ + function getBundleInstaller(callback: AsyncCallback): void; + function getBundleInstaller(): Promise; + + /** + * Obtains based on a given bundle name. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param bundleName Indicates the application bundle name to be queried. + * @param flags Indicates the flag used to specify information contained in the ApplicationInfo object + * that will be returned. + * @param userId Indicates the user ID. + * @return Returns the ApplicationInfo object. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO + */ + function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback) : void; + function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number) : Promise; + + /** + * Checks whether a specified bundle has been granted a specific permission. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param bundleName Indicates the name of the bundle to check. + * @param permission Indicates the permission to check. + * @return Returns 0 if the bundle has the permission; returns -1 otherwise. + */ + function checkPermission(bundleName: string, permission: string, callback: AsyncCallback): void; + function checkPermission(bundleName: string, permission: string): Promise; + + /** + * Obtains BundleInfo of all bundles available in the system. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be + * returned. + * @return Returns a list of BundleInfo objects. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getAllBundleInfo(bundlelFlag: BundleFlag, callback: AsyncCallback>) : void; + function getAllBundleInfo(bundlelFlag: BundleFlag) : Promise>; + + /** + * Registers a callback for listening for permission changes of all UIDs. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param + * @return + * @permission ohos.permission.LISTEN_PERMISSION_CHANGE + */ + function on(type: PermissionEvent, callback: Callback): void; + function on(type: PermissionEvent, uids: Array, callback: Callback): void; + + /** + * Unregister a specified callback for listening for permission changes. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param + * @return + * @permission ohos.permission.LISTEN_PERMISSION_CHANGE + */ + function off(type: PermissionEvent, callback?: Callback):void; + function off(type: PermissionEvent, uids: Array, callback?: Callback): void; + + /** + * Obtains information about all installed applications of a specified user. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param flags Indicates the flag used to specify information contained in the ApplicationInfo objects + * that will be returned. + * @param userId Indicates the user ID. + * @return Returns a list of ApplicationInfo objects. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>) : void; + function getAllApplicationInfo(bundleFlags: number, userId?: number) : Promise>; + + /** + * Obtains information about an application bundle contained in an ohos Ability Package (HAP). + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param hapFilePath Indicates the path storing the HAP. The path should be the relative path to the data + * directory of the current application. + * @param flags Indicates the flag used to specify information contained in the BundleInfo object to be + * returned. + * @return Returns the BundleInfo object. + */ + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback) : void + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise; + + /** + * Obtains information about the shortcuts of the application. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param bundleName Indicates the bundle name of the application. + * @return Returns a list of ShortcutInfo objects containing shortcut information about the application. + * @permission ohos.permission.MANAGE_SHORTCUTS + */ + function getAllShortcutInfo(bundleName: string, callback: AsyncCallback>): void; + function getAllShortcutInfo(bundleName: string): Promise>; + + /** + * get module usage record list in descending order of lastLaunchTime. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param maxNum the return size of the records, must be in range of 1 to 1000. + * @return Returns ability usage record list. + * @systemapi hide this for inner system use + */ + function getModuleUsageRecords(maxNum: number, callback: AsyncCallback>): void; + function getModuleUsageRecords(maxNum: number): Promise>; + + /** + * Obtains detailed information about a specified permission. + * + * @devices phone, tablet, tv, wearable + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @param permissionName Indicates the name of the permission. + * @return Returns PermissionDef. + */ + function getPermissionDef(permissionName: string, callback: AsyncCallback) : void; + function getPermissionDef(permissionName: string) : Promise; +} + +export default bundle; diff --git a/interfaces/kits/js/ability/connectOptions.d.ts b/interfaces/kits/js/ability/connectOptions.d.ts deleted file mode 100644 index 9247001a4d2682851e5faff5dc9fd5073e5dac96..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/ability/connectOptions.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import rpc from './../@ohos.rpc'; -import { ElementName } from '../bundle/elementName'; - -/** - * Provides callback methods that are called when a remote ability using the Service template is connected or - * disconnected. - * - *

You must override the methods of this interface to implement your processing logic for the connection and - * disconnection of an ability using the Service template (Service ability for short).

- * - * @Syscap {@link SystemCapability.Aafwk#ABILITY} - * @since 1 - */ -declare interface ConnectOptions { - onConnect: (elementName: ElementName, iRemoteObject: IRemoteObject) => void; - onDisconnect: (elementName: ElementName) => void; - onFailed: (code: number) => void; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/abilityInfo.d.ts b/interfaces/kits/js/bundle/abilityInfo.d.ts index 08ccc709df02f4ef5b3d79417b3ead3832df6134..7e6904ab2e9b5334be520f325e11a744210dd70b 100644 --- a/interfaces/kits/js/bundle/abilityInfo.d.ts +++ b/interfaces/kits/js/bundle/abilityInfo.d.ts @@ -1,59 +1,244 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ApplicationInfo } from './applicationInfo'; -import { CustomizeData } from './customizeData' -import bundle from './../@ohos.bundle'; - -/** - * @name AbilityInfo - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface AbilityInfo { - readonly bundleName: string; - readonly name: string; - readonly label: string; - readonly description: string; - readonly icon: string; - readonly labelId: number; - readonly descriptionId: number; - readonly iconId: number; - readonly moduleName: string; - readonly process: string; - readonly targetAbility: string; - readonly backgroundModes: number; - readonly isVisible: boolean; - readonly formEnabled: boolean; - readonly type: bundle.AbilityType; - readonly subType: bundle.AbilitySubType; - readonly orientation: bundle.DisplayOrientation; - readonly launchMode: bundle.LaunchMode; - readonly permissions: Array; - readonly deviceTypes: Array; - readonly deviceCapabilities: Array; - readonly readPermission: string; - readonly writePermission: string; - readonly applicationInfo: ApplicationInfo; - readonly formEntity: number; - readonly minFormHeight: number; - readonly defaultFormHeight: number; - readonly minFormWidth: number; - readonly defaultFormWidth: number; - readonly uri: string; - customizeData: Map>; -} +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ApplicationInfo } from './applicationInfo'; +import { CustomizeData } from './customizeData' +import bundle from './../@ohos.bundle'; + +/** + * @name Obtains configuration information about an ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface AbilityInfo { + /** + * @default Indicates the name of the bundle containing the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly bundleName: string; + + /** + * @default Ability simplified class name + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly name: string; + + /** + * @default Indicates the label of the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly label: string; + + /** + * @default Describes the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly description: string; + + /** + * @default Indicates the icon of the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly icon: string; + + /** + * @default Indicates the label id of the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly labelId: number; + + /** + * @default Indicates the description id of the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly descriptionId: number; + + /** + * @default Indicates the icon id of the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly iconId: number; + + /** + * @default Indicates the name of the .hap package to which the capability belongs + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly moduleName: string; + + /** + * @default Process of ability, if user do not set it ,the value equal application process + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly process: string; + + /** + * @default Info about which ability is this nick point to + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly targetAbility: string; + + /** + * @default Indicates the background service addressing a specific usage scenario + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly backgroundModes: number; + + /** + * @default Indicates whether an ability can be called by other abilities + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly isVisible: boolean; + + /** + * @default Indicates whether the ability provides the embedded card capability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly formEnabled: boolean; + + /** + * @default Enumerates types of templates that can be used by an ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly type: bundle.AbilityType; + + /** + * @default Enumerates the subType of templates used by an ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly subType: bundle.AbilitySubType; + + /** + * @default Enumerates ability display orientations + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly orientation: bundle.DisplayOrientation; + + /** + * @default Enumerates ability launch modes + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly launchMode: bundle.LaunchMode; + + /** + * @default The permissions that others need to launch this ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly permissions: Array; + + /** + * @default The device types that this ability can run on + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly deviceTypes: Array; + + /** + * @default The device capability that this ability needs + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly deviceCapabilities: Array; + + /** + * @default Indicates the permission required for reading ability data + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly readPermission: string; + + /** + * @default Indicates the permission required for writing data to the ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly writePermission: string; + + /** + * @default Obtains configuration information about an application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly applicationInfo: ApplicationInfo; + + /** + * @default Where form can be displayed + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly formEntity: number; + + /** + * @default Minimum height of ability. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly minFormHeight: number; + + /** + * @default Default height of ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly defaultFormHeight: number; + + /** + * @default Minimum width of ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly minFormWidth: number; + + /** + * @default Default width of ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly defaultFormWidth: number; + + /** + * @default Uri of ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly uri: string; + + /** + * @default Indicates the custom metadata of ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + customizeData: Map>; +} diff --git a/interfaces/kits/js/bundle/applicationInfo.d.ts b/interfaces/kits/js/bundle/applicationInfo.d.ts index 86f76f69cbf624096e850e9538dc6df1a5798109..4820474ef88f0c61f354a0d1d1d1c1cd6068d7bc 100644 --- a/interfaces/kits/js/bundle/applicationInfo.d.ts +++ b/interfaces/kits/js/bundle/applicationInfo.d.ts @@ -1,43 +1,138 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ModuleInfo } from './moduleInfo'; -import { CustomizeData } from './customizeData' - -/** - * @name ApplicationInfo - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface ApplicationInfo { - readonly name: string; - readonly description: string; - readonly descriptionId: number; - readonly systemApp: boolean; - readonly enabled: boolean; - readonly label: string; - readonly labelId: string; - readonly icon: string; - readonly iconId: string; - readonly process: string; - readonly supportedModes: number; - readonly moduleSourceDirs: Array; - readonly permissions: Array; - readonly moduleInfos: Array; - readonly entryDir: string; - customizeData: Map; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ModuleInfo } from './moduleInfo'; +import { CustomizeData } from './customizeData' + +/** + * @name Obtains configuration information about an application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface ApplicationInfo { + /** + * @default Indicates the application name, which is the same as {@code bundleName} + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly name: string; + + /** + * @default Description of application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly description: string; + + /** + * @default Indicates the description id of the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly descriptionId: number; + + /** + * @default Indicates whether the application is a system application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly systemApp: boolean; + + /** + * @default Indicates whether or not this application may be instantiated + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly enabled: boolean; + + /** + * @default Indicates the label of the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly label: string; + + /** + * @default Indicates the label id of the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly labelId: string; + + /** + * @default Indicates the icon of the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly icon: string; + + /** + * @default Indicates the icon id of the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly iconId: string; + + /** + * @default Process of application, if user do not set it ,the value equal bundleName + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly process: string; + + /** + * @default Indicates the running mode supported by the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly supportedModes: number; + + /** + * @default Indicates the path storing the module resources of the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly moduleSourceDirs: Array; + + /** + * @default Indicates the permissions required for accessing the application. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly permissions: Array; + + /** + * @default Indicates module information about an application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly moduleInfo: Array; + + /** + * @default Indicates the path where the {@code Entry.hap} file of the application is saved + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly entryDir: string; + + /** + * @default Indicates the custom metadata of the application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + customizeData: Map; } \ No newline at end of file diff --git a/interfaces/kits/js/bundle/bundleInfo.d.ts b/interfaces/kits/js/bundle/bundleInfo.d.ts index 58c69d4616cc435c07b26754829d6505f523a846..6353eaef993782219ad6861054cf73d4e256c9e2 100644 --- a/interfaces/kits/js/bundle/bundleInfo.d.ts +++ b/interfaces/kits/js/bundle/bundleInfo.d.ts @@ -1,74 +1,237 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AbilityInfo } from './abilityInfo'; -import { ApplicationInfo } from './applicationInfo'; - -/** - * @name UsedScene - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface UsedScene { - abilities: Array; - when: string; -} - -/** - * @name ReqPermissionDetail - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface ReqPermissionDetail { - name: string; - reason: string; - usedScene: UsedScene; -} - -/** - * @name BundleInfo - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface BundleInfo { - readonly name: string; - readonly type: string; - readonly appId: string; - readonly uid: number; - readonly installTime: number; - readonly updateTime: number; - readonly appInfo: ApplicationInfo; - readonly abilityInfos: Array; - readonly reqPermissions: Array; - readonly vendor: string; - readonly versionCode: number; - readonly versionName: string; - readonly compatibleVersion: number; - readonly targetVersion: number; - readonly isCompressNativeLibs: boolean; - readonly entryModuleName: string; - readonly cpuAbi: string; - readonly isSilentInstallation: string; - readonly minCompatibleVersionCode: number; - readonly entryInstallationFree: boolean; -} +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityInfo } from './abilityInfo'; +import { ApplicationInfo } from './applicationInfo'; +import { HapModuleInfo } from './hapModuleInfo'; + +/** + * @name The scene which is used + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface UsedScene { + /** + * @default Indicates the abilities that need the permission + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + abilities: Array; + + /** + * @default Indicates the time when the permission is used + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + when: string; +} + +/** + * @name Indicates the required permissions details defined in file config.json + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface ReqPermissionDetail { + /** + * @default Indicates the name of this required permissions + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + name: string; + + /** + * @default Indicates the reason of this required permissions + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + reason: string; + + /** + * @default Indicates the used scene of this required permissions + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + usedScene: UsedScene; +} + +/** + * @name Obtains configuration information about a bundle + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface BundleInfo { + /** + * @default Indicates the name of this bundle + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly name: string; + + /** + * @default Indicates the name of this original bundle + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly type: string; + + /** + * @default Indicates the ID of the application to which this bundle belongs + * The application ID uniquely identifies an application. It is determined by the bundle name and signature + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly appId: string; + + /** + * @default Indicates the UID of the application to which this bundle belongs + * The UID uniquely identifies an application. It is determined by the process and user IDs of the application + * After an application is installed, its UID remains unchanged unless it is uninstalled and then reinstalled + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly uid: number; + + /** + * @default Indicates the hap install time + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly installTime: number; + + /** + * @default Indicates the hap update time + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly updateTime: number; + + /** + * @default Obtains configuration information about an application + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly appInfo: ApplicationInfo; + + /** + * @default Obtains configuration information about an ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly abilityInfo: Array; + + /** + * @default Indicates the required permissions name defined in file config.json + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly reqPermissions: Array; + + /** + * @default Indicates the required permissions details defined in file config.json + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly reqPermissionDetails: Array; + + /** + * @default Describes the bundle vendor + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly vendor: string; + + /** + * @default Indicates the version number of the bundle + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly versionCode: number; + + /** + * @default Indicates the text description of the bundle version + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly versionName: string; + + /** + * @default Indicates the compatible version number of the bundle + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly compatibleVersion: number; + + /** + * @default Indicates the target version number of the bundle + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly targetVersion: number; + + /** + * @default Indicates is compress native libs + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly isCompressNativeLibs: boolean; + + /** + * @default Obtains configuration information about an module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly hapModuleInfo: Array; + + /** + * @default Indicates entry module name + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly entryModuleName: string; + + /** + * @default Indicates the cpuAbi information of this bundle. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly cpuAbi: string; + + /** + * @default Indicates is silent installation + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly isSilentInstallation: string; + + /** + * @default Indicates the earliest historical version compatible with the bundle + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly minCompatibleVersionCode: number; + + /** + * @default Indicates whether free installation of the entry is supported + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly entryInstallationFree: boolean; +} diff --git a/interfaces/kits/js/bundle/bundleInstaller.d.ts b/interfaces/kits/js/bundle/bundleInstaller.d.ts index 8e4a49e076830e7eada5c084465aed5e920fe01c..5cdfc48f780c946ee46ceef7d3c1c80c08aab26f 100644 --- a/interfaces/kits/js/bundle/bundleInstaller.d.ts +++ b/interfaces/kits/js/bundle/bundleInstaller.d.ts @@ -1,86 +1,107 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback } from './../basic'; -import bundle from './../@ohos.bundle'; - -/** - * @name InstallParam - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface InstallParam { - userId: number; - installFlag: number; - isKeepData: boolean; -} - -/** - * @name InstallStatus - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface InstallStatus { - status: bundle.InstallErrorCode; - /** - * The install result string message. - * - * @default - - * @devices phone, tablet - * @since 3 - * @SysCap BMS - */ - statusMessage: string; -} - -/** - * @name BundleInstaller - * @since 3 - * @SysCap BMS - * @import NA - * @permission NA - * @devices phone, tablet - */ -export interface BundleInstaller { - /** - * Install an application in a HAP. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param bundleFilePaths Indicates the paths of the HAP. - * @param InstallParam Indicates the userId and whether keep data. - * @return InstallStatus - */ - install(bundleFilePaths: Array, param: InstallParam, callback: AsyncCallback): void; - - /** - * Uninstall an application. - * - * @devices phone, tablet - * @since 3 - * @SysCap BMS - * @param bundleName Indicates the bundle name. - * @param InstallParam Indicates the userId and whether keep data. - * @return InstallStatus - */ - uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback): void; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from './../basic'; +import bundle from './../@ohos.bundle'; + +/** + * @name Provides parameters required for installing or uninstalling an application. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface InstallParam { + /** + * @default Indicates the user id + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + userId: number; + + /** + * @default Indicates the install flag + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + installFlag: number; + + /** + * @default Indicates whether the param has data + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + isKeepData: boolean; +} + +/** + * @name Indicates the install or uninstall status + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface InstallStatus { + + /** + * @default Indicates the install or uninstall error code + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + status: bundle.InstallErrorCode; + + /** + * @default Indicates the install or uninstall result string message + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + statusMessage: string; +} + +/** + * @name Offers install, upgrade, and remove bundles on the devices. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface BundleInstaller { + /** + * Install an application in a HAP. + * + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @devices phone, tablet, tv, wearable, car + * @param bundleFilePaths Indicates the path where the bundle of the application is stored. The path should be the + * relative path to the data directory of the current application. + * @param installParam Indicates other parameters required for the installation. + * @return InstallStatus + * @permission ohos.permission.INSTALL_BUNDLE + */ + install(bundleFilePaths: Array, param: InstallParam, callback: AsyncCallback): void; + + /** + * Uninstall an application. + * + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @devices phone, tablet, tv, wearable, car + * @param bundleName Indicates the bundle name of the application to be uninstalled. + * @param installParam Indicates other parameters required for the uninstallation. + * @return InstallStatus + * @permission ohos.permission.INSTALL_BUNDLE + */ + uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback): void; } \ No newline at end of file diff --git a/interfaces/kits/js/bundle/customizeData.d.ts b/interfaces/kits/js/bundle/customizeData.d.ts index 68258099d6e4dec6021fa7070566f877cbc7fb76..17393229f1f5d422e1f3414d622b81f5ed62f950 100644 --- a/interfaces/kits/js/bundle/customizeData.d.ts +++ b/interfaces/kits/js/bundle/customizeData.d.ts @@ -13,7 +13,25 @@ * limitations under the License. */ + /** + * @name Indicates the custom metadata + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ export interface CustomizeData { + /** + * @default Indicates the custom metadata name + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ name: string; + + /** + * @default Indicates the custom metadata value + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ value: string; } \ No newline at end of file diff --git a/interfaces/kits/js/bundle/elementName.d.ts b/interfaces/kits/js/bundle/elementName.d.ts index fa0552f70496e774aad1720f453da050d9d13c26..68fe8ddda30ce97a540b5385085f530008f6cba2 100644 --- a/interfaces/kits/js/bundle/elementName.d.ts +++ b/interfaces/kits/js/bundle/elementName.d.ts @@ -17,55 +17,55 @@ * Contains basic Ability information, which uniquely identifies an ability. * You can use this class to obtain values of the fields set in an element, * such as the device ID, bundle name, and ability name. - * @name ElementName - * @since 3 - * @sysCap AAFwk - * @devices phone, tablet + * @name Contains basic Ability information, which uniquely identifies an ability + * @since 7 + * @sysCap SystemCapability.Appexecfwk + * @devices phone, tablet, tv, wearable, car * @permission N/A */ export interface ElementName { /** * device id * @default - - * @devices phone, tablet - * @since 3 - * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @since 7 + * @sysCap SystemCapability.Appexecfwk */ deviceId?: string; /** * bundle name * @default - - * @devices phone, tablet - * @since 3 - * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @since 7 + * @sysCap SystemCapability.Appexecfwk */ bundleName: string; /** * ability name - * @default - - * @devices phone, tablet - * @since 3 - * @sysCap AAFwk + * @default ability class name. + * @devices phone, tablet, tv, wearable, car + * @since 7 + * @sysCap SystemCapability.Appexecfwk */ abilityName: string; /** - * shortName name + * uri * @default - - * @devices phone, tablet - * @since 3 - * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @since 7 + * @sysCap SystemCapability.Appexecfwk */ uri?: string; /** - * shortName name + * shortName * @default - - * @devices phone, tablet - * @since 3 - * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @since 7 + * @sysCap SystemCapability.Appexecfwk */ shortName?: string; } diff --git a/interfaces/kits/js/bundle/moduleInfo.d.ts b/interfaces/kits/js/bundle/moduleInfo.d.ts index b856a0042b9f10d4cef082b49d9a68280bcf3b1d..437ca90fa900b5a314335a58234452900d3a78d8 100644 --- a/interfaces/kits/js/bundle/moduleInfo.d.ts +++ b/interfaces/kits/js/bundle/moduleInfo.d.ts @@ -14,31 +14,30 @@ */ /** - * @name ModuleInfo - * @since 3 - * @SysCap BMS - * @import NA + * @name Stores module information about an application. + * @since 7 + * @SysCap SystemCapability.Appexecfwk * @permission NA - * @devices phone, tablet + * @devices phone, tablet, tv, wearable, car */ export interface ModuleInfo { /** * The module name. * - * @default - - * @devices phone, tablet - * @since 3 - * @SysCap BMS + * @default Indicates the name of the .hap package to which the capability belongs + * @devices phone, tablet, tv, wearable, car + * @since 7 + * @SysCap SystemCapability.Appexecfwk */ readonly moduleName: string; /** * The module source path. * - * @default - - * @devices phone, tablet - * @since 3 - * @SysCap BMS + * @default Indicates the module source dir of this module + * @devices phone, tablet, tv, wearable, car + * @since 7 + * @SysCap SystemCapability.Appexecfwk */ readonly moduleSourceDir: string; } \ No newline at end of file diff --git a/interfaces/kits/js/bundle/moduleUsageRecord.d.ts b/interfaces/kits/js/bundle/moduleUsageRecord.d.ts index 8cc84046b05a740750de79773155d49bf2e72da0..0bc3620102c1ad500749f468d6c1fc0b8aeec85b 100644 --- a/interfaces/kits/js/bundle/moduleUsageRecord.d.ts +++ b/interfaces/kits/js/bundle/moduleUsageRecord.d.ts @@ -13,18 +13,91 @@ * limitations under the License. */ +/** + * @name Stores FA usage information. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + * @systemapi hide this for inner system use + */ export interface ModuleUsageRecord { + /** + * @default Indicates the name of the bundle containing the module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly bundleName: string; + /** + * @default Indicates the app label id of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly appLabelId: number; + /** + * @default Indicates the name of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly name: string; + /** + * @default Indicates the label id of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly labelId: number; + /** + * @default Indicates the description id of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly descriptionId: number; + /** + * @default Indicates the ability name of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly abilityName: string; + /** + * @default Indicates the ability label id of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly abilityLabelId: number; + /** + * @default Indicates the ability description id of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly abilityDescriptionId: number; + /** + * @default Indicates the ability icon id of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly abilityIconId: number; + /** + * @default Indicates the launched count of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly launchedCount: number; + /** + * @default Indicates the last launch time of this module + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly lastLaunchTime: number; + /** + * @default Indicates whether the module is removed + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly isRemoved: boolean; + /** + * @default Indicates whether free installation of the module is supported + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly installationFreeSupported: boolean; } \ No newline at end of file diff --git a/interfaces/kits/js/bundle/shortcutInfo.d.ts b/interfaces/kits/js/bundle/shortcutInfo.d.ts index 1e6ce78bf9df84fa496e9faa5397d1b52ad1961e..0caaa904588090744952185e131400367a56fdac 100644 --- a/interfaces/kits/js/bundle/shortcutInfo.d.ts +++ b/interfaces/kits/js/bundle/shortcutInfo.d.ts @@ -12,20 +12,96 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export interface ShortcutIntent{ + + /** + * @name Provides methods for obtaining information about the ability that a shortcut will start, including the target + * bundle name and ability class name. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface ShortcutWant{ + /** + * @default Indicates the target bundle of the shortcut want + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly targetBundle: string; + /** + * @default Indicates the target class of the shortcut want + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly targetClass: string; } + /** + * @name Provides information about a shortcut, including the shortcut ID and label. + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ export interface ShortcutInfo { + /** + * @default Indicates the ID of the application to which this shortcut belongs + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly id: string; + /** + * @default Indicates the name of the bundle containing the shortcut + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly bundleName: string; + /** + * @default Indicates the host ability of the shortcut + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly hostAbility: string; + /** + * @default Indicates the icon of the shortcut + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly icon: string; + /** + * @default Indicates the label of the shortcut + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly label: string; + /** + * @default Indicates the disableMessage of the shortcut + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly disableMessage: string; - readonly intents: Array; + /** + * @default Indicates the wants of the shortcut + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly wants: Array; + /** + * @default Indicates whether the shortcut is static + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly isStatic?: boolean + /** + * @default Indicates whether the shortcut is homeshortcut + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly isHomeShortcut?: boolean; + /** + * @default Indicates whether the shortcut is enabled + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ readonly isEnabled?: boolean; } \ No newline at end of file diff --git a/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp b/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp index 6ea5d5ba39b25b6e00d82765ffc1cd09fa6351c9..7922ce8adbc16b8abac2fbf003a4cc338153f4e2 100755 --- a/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp +++ b/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp @@ -355,6 +355,7 @@ napi_value SetResultAsync( if (asyncCallbackInfo->ability != nullptr) { asyncCallbackInfo->ability->SetResult( asyncCallbackInfo->param.requestCode, asyncCallbackInfo->param.want); + asyncCallbackInfo->ability->TerminateAbility(); } else { HILOG_ERROR("NAPI_SetResult, ability == nullptr"); } @@ -413,6 +414,7 @@ napi_value SetResultPromise(napi_env env, AsyncCallbackInfo *asyncCallbackInfo) if (asyncCallbackInfo->ability != nullptr) { asyncCallbackInfo->ability->SetResult( asyncCallbackInfo->param.requestCode, asyncCallbackInfo->param.want); + asyncCallbackInfo->ability->TerminateAbility(); } else { HILOG_ERROR("NAPI_SetResult, ability == nullptr"); } diff --git a/interfaces/kits/napi/aafwk/formAbility/napi_form_ability.cpp b/interfaces/kits/napi/aafwk/formAbility/napi_form_ability.cpp index 59126008c200c424265acf46f0f162accf4081c1..cddee9b697d9e8672f168cc3f596c5f8b531b8c9 100644 --- a/interfaces/kits/napi/aafwk/formAbility/napi_form_ability.cpp +++ b/interfaces/kits/napi/aafwk/formAbility/napi_form_ability.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "napi_form_ability.h" #include "napi/native_api.h" #include "napi/native_node_api.h" @@ -168,7 +171,7 @@ static napi_value ParseNapiIntoFormInfo(napi_env env, } else { formReqInfo.formId = 0; } - //HILOG_DEBUG("%{public}s, acquireForm formId=%{public}lld.", __func__, formReqInfo.formId); + HILOG_DEBUG("%{public}s, acquireForm formId=%{public}" PRId64 ".", __func__, formReqInfo.formId); // formReqInfo:formName property prop = nullptr; @@ -320,7 +323,7 @@ static void ParseFormJsInfoIntoNapi(napi_env env, const FormJsInfo &formInfo, na napi_value formId; std::string strFormId = std::to_string(formInfo.formId); napi_create_string_utf8(env, strFormId.c_str(), NAPI_AUTO_LENGTH, &formId); - //HILOG_DEBUG("%{public}s, formId=%{public}lld.", __func__, formInfo.formId); + HILOG_DEBUG("%{public}s, formId=%{public}" PRId64 ".", __func__, formInfo.formId); napi_set_named_property(env, result, "formId", formId); // formName @@ -487,7 +490,7 @@ static void ParseFormInfoIntoNapi(napi_env env, const FormInfo &formInfo, napi_v napi_set_element(env, supportDimensions, iDimensionsCount, dimensionInfo); ++iDimensionsCount; } - //HILOG_DEBUG("%{public}s, supportDimensions size=%{public}d.", __func__, formInfo.supportDimensions.size()); + HILOG_DEBUG("%{public}s, supportDimensions size=%{public}zu.", __func__, formInfo.supportDimensions.size()); napi_set_named_property(env, result, "supportDimensions", supportDimensions); // customizeDatas @@ -514,7 +517,7 @@ static void ParseFormInfoIntoNapi(napi_env env, const FormInfo &formInfo, napi_v napi_set_element(env, customizeDatas, iCustomizeDatasCount, customizeDataInfo); ++iDimensionsCount; } - //HILOG_DEBUG("%{public}s, customizeDatas size=%{public}d.", __func__, formInfo.customizeDatas.size()); + HILOG_DEBUG("%{public}s, customizeDatas size=%{public}zu.", __func__, formInfo.customizeDatas.size()); napi_set_named_property(env, result, "supportDimensions", customizeDatas); // relatedBundleName @@ -746,7 +749,7 @@ napi_value NAPI_AcquireForm(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, Wrong argument count.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Parse form info from JavaScript value FormReqInfo formReqInfo; @@ -926,7 +929,7 @@ napi_value NAPI_DeleteForm(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // get global value napi_value global = nullptr; @@ -1085,7 +1088,7 @@ napi_value NAPI_ReleaseForm(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Check the value type of the arguments napi_valuetype valueType; @@ -1252,7 +1255,7 @@ napi_value NAPI_RequestForm(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Check the value type of the arguments napi_valuetype valueType; @@ -1410,7 +1413,7 @@ napi_value NAPI_SetFormNextRefreshTime(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Check the value type of the arguments napi_valuetype valueType; @@ -1585,7 +1588,7 @@ napi_value NAPI_UpdateForm(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Check the value type of the arguments napi_valuetype valueType; @@ -1751,7 +1754,7 @@ napi_value NAPI_CastTempForm(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Check the value type of the arguments napi_valuetype valueType; @@ -1904,7 +1907,7 @@ napi_value NAPI_NotifyVisibleForms(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); uint32_t arrayLength = 0; NAPI_CALL(env, napi_get_array_length(env, argv[0], &arrayLength)); @@ -2082,7 +2085,7 @@ napi_value NAPI_NotifyInvisibleForms(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); uint32_t arrayLength = 0; NAPI_CALL(env, napi_get_array_length(env, argv[0], &arrayLength)); @@ -2265,7 +2268,7 @@ napi_value NAPI_EnableFormsUpdate(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); uint32_t arrayLength = 0; NAPI_CALL(env, napi_get_array_length(env, argv[0], &arrayLength)); @@ -2447,7 +2450,7 @@ napi_value NAPI_DisableFormsUpdate(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); uint32_t arrayLength = 0; NAPI_CALL(env, napi_get_array_length(env, argv[0], &arrayLength)); @@ -2625,7 +2628,7 @@ napi_value NAPI_CheckFMSReady(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - // HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // get global value napi_value global = nullptr; @@ -2780,7 +2783,7 @@ napi_value NAPI_GetAllFormsInfo(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - // HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); std::vector formInfos; formInfos.clear(); @@ -2965,7 +2968,7 @@ napi_value NAPI_GetFormsInfoByApp(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Check the value type of the arguments napi_valuetype valueType; @@ -3164,7 +3167,7 @@ napi_value NAPI_GetFormsInfoByModule(napi_env env, napi_callback_info info) HILOG_ERROR("%{public}s, wrong number of arguments.", __func__); return nullptr; } - //HILOG_INFO("%{public}s, argc = [%{public}d]", __func__, argc); + HILOG_INFO("%{public}s, argc = [%{public}zu]", __func__, argc); // Check the value type of the arguments napi_valuetype valueType; diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn b/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn index 92a622263811f94979aba2626f1b16856dfb52be..3787bd6e384d4cf03b1471ea7be006d2205aa09d 100755 --- a/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn +++ b/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn @@ -43,6 +43,8 @@ ohos_shared_library("napi_common") { "appexecfwk_standard:appexecfwk_core", "appexecfwk_standard:libeventhandler", "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "ipc_js:rpc", "samgr_L2:samgr_proxy", ] diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp index 8015bffda73c19880105336571e2557e1ce9d24d..ceaf1f2f6eeedc9ebe7884412883b091df4cd058 100755 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp @@ -19,15 +19,12 @@ #include "napi_common_util.h" #include "securec.h" #include "hilog_wrapper.h" - +#include "napi_remote_object.h" namespace OHOS { namespace AppExecFwk { napi_value g_classContext; -static void *g_handle = nullptr; -constexpr char SHARED_LIBRARY_RPC[] = "/system/lib/module/librpc.z.so"; -constexpr char FUNC_RPC_CREATE_JS_REMOTE_OBJECT[] = "NAPI_ohos_rpc_CreateJsRemoteObject"; using NAPICreateJsRemoteObject = napi_value (*)(napi_env env, const sptr target); @@ -4503,31 +4500,8 @@ void NAPIAbilityConnection::OnAbilityConnectDone( ConnectAbilityCB *event = (ConnectAbilityCB *)work->data; napi_value result[ARGS_TWO] = {0}; result[PARAM0] = WrapElementName(event->cbBase.cbInfo.env, event->abilityConnectionCB.elementName); - // start open rpc lib - if (g_handle == nullptr) { - g_handle = dlopen(SHARED_LIBRARY_RPC, RTLD_LAZY); - if (g_handle == nullptr) { - HILOG_ERROR( - "%{public}s, dlopen failed %{public}s. %{public}s", __func__, SHARED_LIBRARY_RPC, dlerror()); - return; - } - } - - // get function - auto func = reinterpret_cast(dlsym(g_handle, FUNC_RPC_CREATE_JS_REMOTE_OBJECT)); - if (func == nullptr) { - HILOG_ERROR("%{public}s, dlsym failed %{public}s. %{public}s", - __func__, - FUNC_RPC_CREATE_JS_REMOTE_OBJECT, - dlerror()); - dlclose(g_handle); - g_handle = nullptr; - return; - } - - // transform native remoteObject to js remoteObject - napi_value jsRemoteObject = func(event->cbBase.cbInfo.env, event->abilityConnectionCB.connection); - + napi_value jsRemoteObject = + NAPI_ohos_rpc_CreateJsRemoteObject(event->cbBase.cbInfo.env, event->abilityConnectionCB.connection); result[PARAM1] = jsRemoteObject; napi_value callback = 0; diff --git a/services/abilitymgr/test/unittest/phone/app_scheduler_test/app_scheduler_test.cpp b/services/abilitymgr/test/unittest/phone/app_scheduler_test/app_scheduler_test.cpp index 0606bff8072f3e07246802008fec9375ba21bf2b..0d46d6b69af8904e4ce2357d9cd51ff087d45797 100644 --- a/services/abilitymgr/test/unittest/phone/app_scheduler_test/app_scheduler_test.cpp +++ b/services/abilitymgr/test/unittest/phone/app_scheduler_test/app_scheduler_test.cpp @@ -242,31 +242,6 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_008, TestSize.Level0) DelayedSingleton::GetInstance()->MoveToForground(token); } -/* - * Feature: AppScheduler - * Function: MoveToForground - * SubFunction: NA - * FunctionPoints: AppScheduler MoveToForground - * EnvConditions:NA - * CaseDescription: Verify the normal process of movetoforground - */ -HWTEST_F(AppSchedulerTest, AppScheduler_oprator_009, TestSize.Level0) -{ - DelayedSingleton::GetInstance()->appMgrClient_ = std::make_unique(); - DelayedSingleton::GetInstance()->Init(appStateMock_); - EXPECT_CALL(*appStateMock_, OnAbilityRequestDone(::testing::_, ::testing::_)).Times(1); - - std::string deviceName = "device"; - std::string abilityName = "FirstAbility"; - std::string appName = "FirstApp"; - std::string bundleName = "com.ix.First"; - auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName); - auto record = AbilityRecord::CreateAbilityRecord(abilityReq); - auto token = record->GetToken(); - - DelayedSingleton::GetInstance()->MoveToForground(token); -} - /* * Feature: AppScheduler * Function: MoveToBackground @@ -290,34 +265,6 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_010, TestSize.Level0) DelayedSingleton::GetInstance()->MoveToBackground(token); } -/* - * Feature: AppScheduler - * Function: MoveToBackground GetAbilityState - * SubFunction: NA - * FunctionPoints: AppScheduler MoveToBackground and GetAbilityState - * EnvConditions:NA - * CaseDescription: Verify appmgrclient_ Is not nullptr causes onabilityrequestdone invoke - */ -HWTEST_F(AppSchedulerTest, AppScheduler_oprator_011, TestSize.Level0) -{ - DelayedSingleton::GetInstance()->appMgrClient_ = std::make_unique(); - DelayedSingleton::GetInstance()->Init(appStateMock_); - EXPECT_CALL(*appStateMock_, OnAbilityRequestDone(::testing::_, ::testing::_)).Times(1); - - std::string deviceName = "device"; - std::string abilityName = "FirstAbility"; - std::string appName = "FirstApp"; - std::string bundleName = "com.ix.First"; - auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName); - auto record = AbilityRecord::CreateAbilityRecord(abilityReq); - auto token = record->GetToken(); - - DelayedSingleton::GetInstance()->MoveToBackground(token); - - EXPECT_EQ( - AppAbilityState::ABILITY_STATE_BACKGROUND, DelayedSingleton::GetInstance()->GetAbilityState()); -} - /* * Feature: AppScheduler * Function: ConvertToAppAbilityState @@ -471,4 +418,4 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_017, TestSize.Level0) DelayedSingleton::GetInstance()->KillProcessByAbilityToken(token); } } // namespace AAFwk -} // namespace OHOS \ No newline at end of file +} // namespace OHOS