mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
!38 aa代码合入master
Merge pull request !38 from blackleon/master_check_0913
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cinttypes>
|
||||
#include <thread>
|
||||
|
||||
#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 = 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<std::mutex> 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> formCallback = nullptr;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(formLock);
|
||||
@@ -2392,7 +2393,7 @@ void Ability::OnDeathReceived()
|
||||
std::map<int64_t, std::shared_ptr<FormCallback>>::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 = 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$");
|
||||
std::size_t size = value.size(); \
|
||||
sptr<IArray> 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<IInterface>(static_cast<IInterface *>(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 <typename IClassName, typename baseValue>
|
||||
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 <typename RawType>
|
||||
static std::string RawTypeToString(const RawType value, unsigned int precisionAfterPoint);
|
||||
|
||||
template <typename IClassName, typename ClassName, typename baseValue>
|
||||
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<baseValue>(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 <typename IClassName, typename ClassName, typename valueType>
|
||||
static void PacmapGetArrayVal(OHOS::AAFwk::IInterface *ao, std::vector<valueType> &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<IShort, short>(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<IInteger, int>(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<IChar, zchar>(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<IByte, byte>(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<IBoolean, bool>(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<IFloat, Float, float>(
|
||||
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<IDouble, Double, double>(
|
||||
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<short> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::IShort, AAFwk::Short, it->second.GetRefPtr(), array)
|
||||
return ToJsonArrayShort(array, json, PACMAP_DATA_ARRAY_SHORT);
|
||||
std::vector<short> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::IShort, AAFwk::Short, short>(it->second.GetRefPtr(), arrayData);
|
||||
return ToJsonArrayShort(arrayData, json, PACMAP_DATA_ARRAY_SHORT);
|
||||
} else if (Array::IsIntegerArray(array)) {
|
||||
std::vector<int> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::IInteger, AAFwk::Integer, it->second.GetRefPtr(), array)
|
||||
return ToJsonArrayInt(array, json, PACMAP_DATA_ARRAY_INTEGER);
|
||||
std::vector<int> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::IInteger, AAFwk::Integer, int>(it->second.GetRefPtr(), arrayData);
|
||||
return ToJsonArrayInt(arrayData, json, PACMAP_DATA_ARRAY_INTEGER);
|
||||
} else if (Array::IsLongArray(array)) {
|
||||
std::vector<long> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::ILong, AAFwk::Long, it->second.GetRefPtr(), array);
|
||||
return ToJsonArrayLong(array, json, PACMAP_DATA_ARRAY_LONG);
|
||||
std::vector<long> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::ILong, AAFwk::Long, long>(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<byte> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::IByte, AAFwk::Byte, it->second.GetRefPtr(), array);
|
||||
return ToJsonArrayByte(array, json, PACMAP_DATA_ARRAY_BYTE);
|
||||
std::vector<byte> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::IByte, AAFwk::Byte, byte>(it->second.GetRefPtr(), arrayData);
|
||||
return ToJsonArrayByte(arrayData, json, PACMAP_DATA_ARRAY_BYTE);
|
||||
} else if (Array::IsBooleanArray(array)) {
|
||||
std::vector<bool> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::IBoolean, AAFwk::Boolean, it->second.GetRefPtr(), array);
|
||||
return ToJsonArrayBoolean(array, json, PACMAP_DATA_ARRAY_BOOLEAN);
|
||||
std::vector<bool> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::IBoolean, AAFwk::Boolean, bool>(it->second.GetRefPtr(), arrayData);
|
||||
return ToJsonArrayBoolean(arrayData, json, PACMAP_DATA_ARRAY_BOOLEAN);
|
||||
} else if (Array::IsFloatArray(array)) {
|
||||
std::vector<float> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::IFloat, AAFwk::Float, it->second.GetRefPtr(), array);
|
||||
return ToJsonArrayFloat(array, json, PACMAP_DATA_ARRAY_FLOAT);
|
||||
std::vector<float> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::IFloat, AAFwk::Float, float>(it->second.GetRefPtr(), arrayData);
|
||||
return ToJsonArrayFloat(arrayData, json, PACMAP_DATA_ARRAY_FLOAT);
|
||||
} else if (Array::IsDoubleArray(array)) {
|
||||
std::vector<double> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::IDouble, AAFwk::Double, it->second.GetRefPtr(), array);
|
||||
return ToJsonArrayDouble(array, json, PACMAP_DATA_ARRAY_DOUBLE);
|
||||
std::vector<double> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::IDouble, AAFwk::Double, double>(it->second.GetRefPtr(), arrayData);
|
||||
return ToJsonArrayDouble(arrayData, json, PACMAP_DATA_ARRAY_DOUBLE);
|
||||
} else if (Array::IsStringArray(array)) {
|
||||
std::vector<std::string> array;
|
||||
PAC_MAP_GET_ARRAY_VAL(AAFwk::IString, AAFwk::String, it->second.GetRefPtr(), array);
|
||||
return ToJsonArrayString(array, json, PACMAP_DATA_ARRAY_STRING);
|
||||
std::vector<std::string> arrayData;
|
||||
PacmapGetArrayVal<AAFwk::IString, AAFwk::String, std::string>(it->second.GetRefPtr(), arrayData);
|
||||
return ToJsonArrayString(arrayData, json, PACMAP_DATA_ARRAY_STRING);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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<IInterface> iIt)
|
||||
{
|
||||
if (iIt != nullptr && IBoolean::Query(iIt) != nullptr) {
|
||||
|
||||
@@ -101,27 +101,6 @@ declare namespace featureAbility {
|
||||
function hasWindowFocus(callback: AsyncCallback<boolean>): void;
|
||||
function hasWindowFocus(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* 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>): void;
|
||||
function disconnectAbility(connection: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Obtains the type of this application.
|
||||
* @devices phone, tablet
|
||||
|
||||
@@ -47,26 +47,5 @@ declare namespace particleAbility {
|
||||
*/
|
||||
function stopAbility(request: Want, callback:AsyncCallback<boolean>): void;
|
||||
function stopAbility(request: Want): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* 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>): void;
|
||||
function disconnectAbility(connection: number): Promise<void>;
|
||||
}
|
||||
export default particleAbility;
|
||||
|
||||
Vendored
+374
-235
@@ -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<BundleInfo>): void;
|
||||
|
||||
/**
|
||||
* Obtains Bundle installer to install or uninstall hap.
|
||||
*
|
||||
* @devices phone, tablet
|
||||
* @since 3
|
||||
* @SysCap BMS
|
||||
* @return BundleInstaller.
|
||||
*/
|
||||
function getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void;
|
||||
function getBundleInstaller(): Promise<BundleInstaller>;
|
||||
|
||||
/**
|
||||
* 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<ApplicationInfo>) : void;
|
||||
function getApplicationInfo(bundleName: string, bundelFlags: number, userId?: number) : Promise<ApplicationInfo>;
|
||||
|
||||
function checkPermission(bundleName: string, permission: string, callback: AsyncCallback<GrantStatus>): void;
|
||||
function checkPermission(bundleName: string, permission: string): Promise<GrantStatus>;
|
||||
|
||||
/**
|
||||
* 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<Array<BundleInfo>>) : void;
|
||||
function getBundleInfos(bundelFlag: BundleFlag) : Promise<Array<BundleInfo>>;
|
||||
|
||||
// void registerAllPermissionsChanged(IRemoteObject callback) throws RemoteException;
|
||||
function on(type: PermissionEvent, callback: AsyncCallback<number>): void;
|
||||
function on(type: PermissionEvent, uids: Array<number>, callback: AsyncCallback<number>): void;
|
||||
|
||||
// void unregisterPermissionsChanged(IRemoteObject callback) throws RemoteException;
|
||||
function off(type: PermissionEvent, callback: AsyncCallback<number>):void;
|
||||
function off(type: PermissionEvent, uids: Array<number>, callback: AsyncCallback<number>): 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<Array<ApplicationInfo>>) : void;
|
||||
function getApplicationInfos(bundelFlags: number, callback: AsyncCallback<Array<ApplicationInfo>>) : void;
|
||||
function getApplicationInfos(bundelFlags: number, userId?: number) : Promise<Array<ApplicationInfo>>;
|
||||
|
||||
/**
|
||||
* 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<BundleInfo>) : void
|
||||
function getBundleArchiveInfo(hapFilePath: string, bundelFlags: number) : Promise<BundleInfo>;
|
||||
|
||||
// List<ShortcutInfo> getShortcutInfos(String bundleName) throws RemoteException;
|
||||
function getShortcutInfos(bundleName: string, callback: AsyncCallback<Array<ShortcutInfo>>): void;
|
||||
function getShortcutInfos(bundleName: string): Promise<Array<ShortcutInfo>>;
|
||||
|
||||
/**
|
||||
* 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<permission.PermissionDef>) : void;
|
||||
function getPermissionDef(permissionName: string) : Promise<permission.PermissionDef>;
|
||||
|
||||
function getHomeShortcutInfos(callback: AsyncCallback<Array<ShortcutInfo>>): void;
|
||||
function getHomeShortcutInfos(): Promise<void>;
|
||||
|
||||
// List<ModuleUsageRecord> getModuleUsageRecords(int maxNum) throws RemoteException, IllegalArgumentException;
|
||||
function getModuleUsageRecords(maxNum: number, callback: AsyncCallback<Array<ModuleUsageRecord>>): void;
|
||||
function getModuleUsageRecords(maxNum: number): Promise<Array<ModuleUsageRecord>>;
|
||||
}
|
||||
|
||||
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<BundleInfo>): 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<BundleInstaller>): void;
|
||||
function getBundleInstaller(): Promise<BundleInstaller>;
|
||||
|
||||
/**
|
||||
* 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<ApplicationInfo>) : void;
|
||||
function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number) : Promise<ApplicationInfo>;
|
||||
|
||||
/**
|
||||
* 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<GrantStatus>): void;
|
||||
function checkPermission(bundleName: string, permission: string): Promise<GrantStatus>;
|
||||
|
||||
/**
|
||||
* 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<Array<BundleInfo>>) : void;
|
||||
function getAllBundleInfo(bundlelFlag: BundleFlag) : Promise<Array<BundleInfo>>;
|
||||
|
||||
/**
|
||||
* 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<number>): void;
|
||||
function on(type: PermissionEvent, uids: Array<number>, callback: Callback<number>): 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<number>):void;
|
||||
function off(type: PermissionEvent, uids: Array<number>, callback?: Callback<number>): 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<Array<ApplicationInfo>>) : void;
|
||||
function getAllApplicationInfo(bundleFlags: number, userId?: number) : Promise<Array<ApplicationInfo>>;
|
||||
|
||||
/**
|
||||
* 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<BundleInfo>) : void
|
||||
function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise<BundleInfo>;
|
||||
|
||||
/**
|
||||
* 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<Array<ShortcutInfo>>): void;
|
||||
function getAllShortcutInfo(bundleName: string): Promise<Array<ShortcutInfo>>;
|
||||
|
||||
/**
|
||||
* 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<Array<ModuleUsageRecord>>): void;
|
||||
function getModuleUsageRecords(maxNum: number): Promise<Array<ModuleUsageRecord>>;
|
||||
|
||||
/**
|
||||
* 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<permission.PermissionDef>) : void;
|
||||
function getPermissionDef(permissionName: string) : Promise<permission.PermissionDef>;
|
||||
}
|
||||
|
||||
export default bundle;
|
||||
|
||||
-32
@@ -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.
|
||||
*
|
||||
* <p>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).</p>
|
||||
*
|
||||
* @Syscap {@link SystemCapability.Aafwk#ABILITY}
|
||||
* @since 1
|
||||
*/
|
||||
declare interface ConnectOptions {
|
||||
onConnect: (elementName: ElementName, iRemoteObject: IRemoteObject) => void;
|
||||
onDisconnect: (elementName: ElementName) => void;
|
||||
onFailed: (code: number) => void;
|
||||
}
|
||||
+244
-59
@@ -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<String>;
|
||||
readonly deviceTypes: Array<String>;
|
||||
readonly deviceCapabilities: Array<string>;
|
||||
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<string, Array<CustomizeData>>;
|
||||
}
|
||||
/*
|
||||
* 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<string>;
|
||||
|
||||
/**
|
||||
* @default The device types that this ability can run on
|
||||
* @since 7
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
*/
|
||||
readonly deviceTypes: Array<string>;
|
||||
|
||||
/**
|
||||
* @default The device capability that this ability needs
|
||||
* @since 7
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
*/
|
||||
readonly deviceCapabilities: Array<string>;
|
||||
|
||||
/**
|
||||
* @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<string, Array<CustomizeData>>;
|
||||
}
|
||||
|
||||
+137
-42
@@ -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<string>;
|
||||
readonly permissions: Array<string>;
|
||||
readonly moduleInfos: Array<ModuleInfo>;
|
||||
readonly entryDir: string;
|
||||
customizeData: Map<string, CustomizeData>;
|
||||
/*
|
||||
* 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<string>;
|
||||
|
||||
/**
|
||||
* @default Indicates the permissions required for accessing the application.
|
||||
* @since 7
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
*/
|
||||
readonly permissions: Array<string>;
|
||||
|
||||
/**
|
||||
* @default Indicates module information about an application
|
||||
* @since 7
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
*/
|
||||
readonly moduleInfo: Array<ModuleInfo>;
|
||||
|
||||
/**
|
||||
* @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<string, CustomizeData>;
|
||||
}
|
||||
+237
-74
@@ -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<string>;
|
||||
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<AbilityInfo>;
|
||||
readonly reqPermissions: Array<string>;
|
||||
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<string>;
|
||||
|
||||
/**
|
||||
* @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<AbilityInfo>;
|
||||
|
||||
/**
|
||||
* @default Indicates the required permissions name defined in file config.json
|
||||
* @since 7
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
*/
|
||||
readonly reqPermissions: Array<string>;
|
||||
|
||||
/**
|
||||
* @default Indicates the required permissions details defined in file config.json
|
||||
* @since 7
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
*/
|
||||
readonly reqPermissionDetails: Array<ReqPermissionDetail>;
|
||||
|
||||
/**
|
||||
* @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<HapModuleInfo>;
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
+106
-85
@@ -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<string>, param: InstallParam, callback: AsyncCallback<InstallStatus>): 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<InstallStatus>): 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<string>, param: InstallParam, callback: AsyncCallback<InstallStatus>): 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<InstallStatus>): void;
|
||||
}
|
||||
+18
@@ -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;
|
||||
}
|
||||
+22
-22
@@ -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;
|
||||
}
|
||||
|
||||
+12
-13
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
+78
-2
@@ -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<ShortcutIntent>;
|
||||
/**
|
||||
* @default Indicates the wants of the shortcut
|
||||
* @since 7
|
||||
* @SysCap SystemCapability.Appexecfwk
|
||||
*/
|
||||
readonly wants: Array<ShortcutWant>;
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
#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<OHOS::AppExecFwk::FormInfo> 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;
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -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<IRemoteObject> 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<NAPICreateJsRemoteObject>(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;
|
||||
|
||||
@@ -242,31 +242,6 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_008, TestSize.Level0)
|
||||
DelayedSingleton<AppScheduler>::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<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
|
||||
DelayedSingleton<AppScheduler>::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<AppScheduler>::GetInstance()->MoveToForground(token);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AppScheduler
|
||||
* Function: MoveToBackground
|
||||
@@ -290,34 +265,6 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_010, TestSize.Level0)
|
||||
DelayedSingleton<AppScheduler>::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<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
|
||||
DelayedSingleton<AppScheduler>::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<AppScheduler>::GetInstance()->MoveToBackground(token);
|
||||
|
||||
EXPECT_EQ(
|
||||
AppAbilityState::ABILITY_STATE_BACKGROUND, DelayedSingleton<AppScheduler>::GetInstance()->GetAbilityState());
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AppScheduler
|
||||
* Function: ConvertToAppAbilityState
|
||||
@@ -471,4 +418,4 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_017, TestSize.Level0)
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->KillProcessByAbilityToken(token);
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
||||
Reference in New Issue
Block a user