mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-25 12:23:20 -04:00
Merge branch 'master' into DuliBianYi_20241015
This commit is contained in:
@@ -22,12 +22,24 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
/**
|
||||
* @class IKiaInterceptor
|
||||
* IPC interface for KIA.
|
||||
*/
|
||||
class IKiaInterceptor : public OHOS::IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IKiaInterceptor");
|
||||
|
||||
/**
|
||||
* OnIntercept, processing method from KIA.
|
||||
*
|
||||
* @param want The param of openning the app.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
virtual int OnIntercept(AAFwk::Want &want) = 0;
|
||||
|
||||
enum {
|
||||
// ipc code for calling OnIntercept
|
||||
KIA_INTERCEPTOR_ON_INTERCEPT = 0,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -22,18 +22,43 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
/**
|
||||
* @class KiaInterceptorProxy
|
||||
* IPC proxy of IKiaInterceptor.
|
||||
*/
|
||||
class KiaInterceptorProxy : public IRemoteProxy<IKiaInterceptor> {
|
||||
public:
|
||||
/**
|
||||
* KiaInterceptorProxy, constructor.
|
||||
*
|
||||
* @param impl The implementation of IKiaInterceptor.
|
||||
*/
|
||||
explicit KiaInterceptorProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IKiaInterceptor>(impl)
|
||||
{}
|
||||
|
||||
/**
|
||||
* KiaInterceptorProxy, destructor.
|
||||
*
|
||||
*/
|
||||
virtual ~KiaInterceptorProxy()
|
||||
{}
|
||||
|
||||
/**
|
||||
* OnIntercept, processing method from KIA.
|
||||
*
|
||||
* @param want The param of openning the app.
|
||||
*/
|
||||
virtual int OnIntercept(AAFwk::Want &want) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* WriteInterfaceToken.
|
||||
*
|
||||
* @param data The message parcel data.
|
||||
* @return Flag whether write is successful.
|
||||
*/
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
|
||||
static inline BrokerDelegator<KiaInterceptorProxy> delegator_;
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
|
||||
@@ -23,15 +23,44 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
/**
|
||||
* @class KiaInterceptorStub
|
||||
* IPC stub of IKiaInterceptor.
|
||||
*/
|
||||
class KiaInterceptorStub : public IRemoteStub<IKiaInterceptor> {
|
||||
public:
|
||||
/**
|
||||
* KiaInterceptorStub, constructor.
|
||||
*
|
||||
*/
|
||||
KiaInterceptorStub();
|
||||
|
||||
/**
|
||||
* KiaInterceptorStub, destructor.
|
||||
*
|
||||
*/
|
||||
virtual ~KiaInterceptorStub();
|
||||
|
||||
/**
|
||||
* OnRemoteRequest, IPC method.
|
||||
*
|
||||
* @param code The IPC code.
|
||||
* @param data The message parcel data.
|
||||
* @param reply The message parcel reply.
|
||||
* @param option The message parcel option.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
virtual int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* OnInterceptInner, inner processing method from KIA.
|
||||
*
|
||||
* @param data The message parcel data.
|
||||
* @param reply The message parcel reply.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
int OnInterceptInner(MessageParcel &data, MessageParcel &reply);
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
|
||||
@@ -21,9 +21,22 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
/**
|
||||
* @class FreeInstallObserverProxy
|
||||
* IPC stub of IFreeInstallObserver.
|
||||
*/
|
||||
class FreeInstallObserverProxy : public IRemoteProxy<IFreeInstallObserver> {
|
||||
public:
|
||||
/**
|
||||
* FreeInstallObserverProxy, constructor.
|
||||
*
|
||||
*/
|
||||
explicit FreeInstallObserverProxy(const sptr<IRemoteObject> &impl);
|
||||
|
||||
/**
|
||||
* FreeInstallObserverProxy, destructor.
|
||||
*
|
||||
*/
|
||||
virtual ~FreeInstallObserverProxy() = default;
|
||||
|
||||
/**
|
||||
@@ -48,7 +61,14 @@ public:
|
||||
const int &resultCode) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* WriteInterfaceToken.
|
||||
*
|
||||
* @param data The message parcel data.
|
||||
* @return Flag whether write is successful.
|
||||
*/
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
|
||||
static inline BrokerDelegator<FreeInstallObserverProxy> delegator_;
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
|
||||
@@ -24,17 +24,55 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
/**
|
||||
* @class FreeInstallObserverStub
|
||||
* IPC proxy of IFreeInstallObserver.
|
||||
*/
|
||||
class FreeInstallObserverStub : public IRemoteStub<IFreeInstallObserver> {
|
||||
public:
|
||||
/**
|
||||
* FreeInstallObserverStub, constructor.
|
||||
*
|
||||
*/
|
||||
FreeInstallObserverStub();
|
||||
|
||||
/**
|
||||
* FreeInstallObserverStub, destructor.
|
||||
*
|
||||
*/
|
||||
virtual ~FreeInstallObserverStub();
|
||||
|
||||
/**
|
||||
* OnRemoteRequest, IPC method.
|
||||
*
|
||||
* @param code The IPC code.
|
||||
* @param data The message parcel data.
|
||||
* @param reply The message parcel reply.
|
||||
* @param option The message parcel option.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
virtual int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_MOVE(FreeInstallObserverStub);
|
||||
|
||||
/**
|
||||
* OnInstallFinishedInner, inner processing method for OnInstallFinished.
|
||||
*
|
||||
* @param data The message parcel data.
|
||||
* @param reply The message parcel reply.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
int OnInstallFinishedInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
/**
|
||||
* OnInstallFinishedByUrlInner, inner processing method for OnInstallFinishedByUrl.
|
||||
*
|
||||
* @param data The message parcel data.
|
||||
* @param reply The message parcel reply.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
int OnInstallFinishedByUrlInner(MessageParcel &data, MessageParcel &reply);
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
|
||||
@@ -38,7 +38,16 @@ struct JsFreeInstallObserverObject {
|
||||
|
||||
class JsFreeInstallObserver : public FreeInstallObserverStub {
|
||||
public:
|
||||
/**
|
||||
* JsFreeInstallObserver, constructor.
|
||||
*
|
||||
*/
|
||||
explicit JsFreeInstallObserver(napi_env env);
|
||||
|
||||
/**
|
||||
* JsFreeInstallObserver, destructor.
|
||||
*
|
||||
*/
|
||||
~JsFreeInstallObserver();
|
||||
|
||||
/**
|
||||
@@ -97,14 +106,67 @@ public:
|
||||
napi_value jsObserverObject, napi_value* result, bool isAbilityResult = false);
|
||||
|
||||
private:
|
||||
/**
|
||||
* CallPromise, resolve promise.
|
||||
*
|
||||
* @param deferred The promise that is to be resolved.
|
||||
* @param resultCode The result code of the promise.
|
||||
*/
|
||||
void CallPromise(napi_deferred deferred, int32_t resultCode);
|
||||
|
||||
/**
|
||||
* CallPromise, resolve promise.
|
||||
*
|
||||
* @param deferred The promise that is to be resolved.
|
||||
* @param abilityResult The ability result of the promise.
|
||||
*/
|
||||
void CallPromise(napi_deferred deferred, napi_value abilityResult);
|
||||
|
||||
/**
|
||||
* CallCallback, call callback.
|
||||
*
|
||||
* @param callback The callback that is to be called.
|
||||
* @param resultCode The result code of the promise.
|
||||
*/
|
||||
void CallCallback(napi_ref callback, int32_t resultCode);
|
||||
|
||||
/**
|
||||
* CallCallback, call callback.
|
||||
*
|
||||
* @param callback The callback that is to be called.
|
||||
* @param abilityResult The ability result of the promise.
|
||||
*/
|
||||
void CallCallback(napi_ref callback, napi_value abilityResult);
|
||||
|
||||
/**
|
||||
* HandleOnInstallFinished, handle the event of free install upon finished.
|
||||
*
|
||||
* @param bundleName The bundle name of the app.
|
||||
* @param abilityName The ability name of the app.
|
||||
* @param startTime The start time.
|
||||
* @param resultCode The result code.
|
||||
*/
|
||||
void HandleOnInstallFinished(const std::string &bundleName, const std::string &abilityName,
|
||||
const std::string &startTime, const int &resultCode);
|
||||
|
||||
/**
|
||||
* HandleOnInstallFinishedByUrl, handle the event of free install upon finished.
|
||||
*
|
||||
* @param startTime The start time.
|
||||
* @param url The url of the app.
|
||||
* @param resultCode The result code.
|
||||
*/
|
||||
void HandleOnInstallFinishedByUrl(const std::string &startTime, const std::string &url,
|
||||
const int &resultCode);
|
||||
|
||||
/**
|
||||
* AddJsObserverCommon, helper of AddJsObserverObject.
|
||||
*
|
||||
* @param object The free install observer object.
|
||||
* @param jsObserverObject The js observer object.
|
||||
* @param result The resultant object.
|
||||
* @param isAbilityResult The flag of whether it is to return ability result.
|
||||
*/
|
||||
void AddJsObserverCommon(JsFreeInstallObserverObject &object,
|
||||
napi_value jsObserverObject, napi_value* result, bool isAbilityResult);
|
||||
napi_env env_;
|
||||
|
||||
@@ -27,29 +27,99 @@ struct RunningProcessInfo;
|
||||
}
|
||||
namespace AAFwk {
|
||||
struct AbilityRequest;
|
||||
|
||||
/**
|
||||
* @class Want
|
||||
* the struct to open abilities.
|
||||
*/
|
||||
class Want;
|
||||
|
||||
/**
|
||||
* @class AbilityPermissionUtil
|
||||
* provides ability permission utilities.
|
||||
*/
|
||||
class AbilityPermissionUtil {
|
||||
public:
|
||||
/**
|
||||
* GetInstance, get an instance of AbilityPermissionUtil.
|
||||
*
|
||||
* @return An instance of AbilityPermissionUtil.
|
||||
*/
|
||||
static AbilityPermissionUtil &GetInstance();
|
||||
|
||||
// check caller is delegator
|
||||
/**
|
||||
* IsDelegatorCall, check caller is delegator.
|
||||
*
|
||||
* @param processInfo The process information.
|
||||
* @param abilityRequest The ability request.
|
||||
* @return Whether the caller is delegator.
|
||||
*/
|
||||
bool IsDelegatorCall(const AppExecFwk::RunningProcessInfo &processInfo, const AbilityRequest &abilityRequest) const;
|
||||
|
||||
// check dominate screen
|
||||
/**
|
||||
* IsDominateScreen, check dominate screen.
|
||||
*
|
||||
* @param want The want.
|
||||
* @param isPendingWantCaller Flag of whether it is the pending want caller.
|
||||
* @return Whether it is dominate screen.
|
||||
*/
|
||||
bool IsDominateScreen(const Want &want, bool isPendingWantCaller);
|
||||
|
||||
/**
|
||||
* CheckMultiInstanceAndAppClone, check if the app is either multi-instance or app-clone.
|
||||
*
|
||||
* @param want The want.
|
||||
* @param userId The user id.
|
||||
* @param appIndex The app index.
|
||||
* @param callerToken The caller token.
|
||||
* @return Whether the app is either multi-instance or app-clone.
|
||||
*/
|
||||
int32_t CheckMultiInstanceAndAppClone(Want &want, int32_t userId, int32_t appIndex,
|
||||
sptr<IRemoteObject> callerToken);
|
||||
|
||||
/**
|
||||
* CheckMultiInstanceKeyForExtension, check multi-instance key for extension.
|
||||
*
|
||||
* @param abilityRequest The ability request.
|
||||
* @return Whether the key is multi-instance key.
|
||||
*/
|
||||
int32_t CheckMultiInstanceKeyForExtension(const AbilityRequest &abilityRequest);
|
||||
|
||||
private:
|
||||
/**
|
||||
* AbilityPermissionUtil, the private constructor.
|
||||
*
|
||||
*/
|
||||
AbilityPermissionUtil() = default;
|
||||
|
||||
/**
|
||||
* AbilityPermissionUtil, the private destructor.
|
||||
*
|
||||
*/
|
||||
~AbilityPermissionUtil() = default;
|
||||
|
||||
/**
|
||||
* CheckMultiInstance, check multi-instance.
|
||||
*
|
||||
* @param want The want.
|
||||
* @param callerToken The caller token.
|
||||
* @param isCreating Whether the app is being created.
|
||||
* @param instanceKey The instance key.
|
||||
* @param maxCount The max number of instances.
|
||||
* @return Whether it is a valid multi-instance instance.
|
||||
*/
|
||||
int32_t CheckMultiInstance(Want &want, sptr<IRemoteObject> callerToken, bool isCreating,
|
||||
const std::string &instanceKey, int32_t maxCount);
|
||||
|
||||
/**
|
||||
* UpdateInstanceKey, update instance key.
|
||||
*
|
||||
* @param want The want.
|
||||
* @param originInstanceKey The original instance key.
|
||||
* @param instanceKeyArray Candidate instance keys.
|
||||
* @param instanceKey The new instance key.
|
||||
* @return Whether the update is successful.
|
||||
*/
|
||||
int32_t UpdateInstanceKey(Want &want, const std::string &originInstanceKey,
|
||||
const std::vector<std::string> &instanceKeyArray, const std::string &instanceKey);
|
||||
|
||||
|
||||
@@ -20,8 +20,17 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class AppMgrUtil
|
||||
* provides appmgr utilities.
|
||||
*/
|
||||
class AppMgrUtil final {
|
||||
public:
|
||||
/**
|
||||
* GetAppMgr, get app mgr.
|
||||
*
|
||||
* @return AppMgr.
|
||||
*/
|
||||
static sptr<OHOS::AppExecFwk::IAppMgr> GetAppMgr();
|
||||
|
||||
private:
|
||||
|
||||
@@ -20,36 +20,103 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class DumpUtils
|
||||
* provides dump utilities.
|
||||
*/
|
||||
class DumpUtils final {
|
||||
public:
|
||||
enum DumpKey {
|
||||
// dump all
|
||||
KEY_DUMP_ALL = 0,
|
||||
|
||||
// dump stack list
|
||||
KEY_DUMP_STACK_LIST,
|
||||
|
||||
// dump stack
|
||||
KEY_DUMP_STACK,
|
||||
|
||||
// dump mission
|
||||
KEY_DUMP_MISSION,
|
||||
|
||||
// dump top ability
|
||||
KEY_DUMP_TOP_ABILITY,
|
||||
|
||||
// dump wait queue
|
||||
KEY_DUMP_WAIT_QUEUE,
|
||||
|
||||
// dump service
|
||||
KEY_DUMP_SERVICE,
|
||||
|
||||
// dump data
|
||||
KEY_DUMP_DATA,
|
||||
|
||||
// dump focus ability
|
||||
KEY_DUMP_FOCUS_ABILITY,
|
||||
|
||||
// dump window mode
|
||||
KEY_DUMP_WINDOW_MODE,
|
||||
|
||||
// dump mission list
|
||||
KEY_DUMP_MISSION_LIST,
|
||||
|
||||
// dump mission info
|
||||
KEY_DUMP_MISSION_INFOS,
|
||||
};
|
||||
|
||||
enum DumpsysKey {
|
||||
// dump system all
|
||||
KEY_DUMP_SYS_ALL = 0,
|
||||
|
||||
// dump system mission list
|
||||
KEY_DUMP_SYS_MISSION_LIST,
|
||||
|
||||
// dump system ability
|
||||
KEY_DUMP_SYS_ABILITY,
|
||||
|
||||
// dump system service
|
||||
KEY_DUMP_SYS_SERVICE,
|
||||
|
||||
// dump system pending
|
||||
KEY_DUMP_SYS_PENDING,
|
||||
|
||||
// dump system process
|
||||
KEY_DUMP_SYS_PROCESS,
|
||||
|
||||
// dump system data
|
||||
KEY_DUMP_SYS_DATA,
|
||||
};
|
||||
|
||||
/**
|
||||
* DumpMapOne, dump map first function.
|
||||
*
|
||||
* @param argString The argument string.
|
||||
* @return The pair of the dump result and the dump key.
|
||||
*/
|
||||
static std::pair<bool, DumpUtils::DumpKey> DumpMapOne(std::string argString);
|
||||
|
||||
/**
|
||||
* DumpMapTwo, dump map second function.
|
||||
*
|
||||
* @param argString The argument string.
|
||||
* @return The pair of the dump result and the dump key.
|
||||
*/
|
||||
static std::pair<bool, DumpUtils::DumpKey> DumpMapTwo(std::string argString);
|
||||
|
||||
/**
|
||||
* DumpMap, dump map function.
|
||||
*
|
||||
* @param argString The argument string.
|
||||
* @return The pair of the dump result and the dump key.
|
||||
*/
|
||||
static std::pair<bool, DumpUtils::DumpKey> DumpMap(std::string argString);
|
||||
|
||||
/**
|
||||
* DumpsysMap, dump system map function.
|
||||
*
|
||||
* @param argString The argument string.
|
||||
* @return The pair of the dump result and the dump key.
|
||||
*/
|
||||
static std::pair<bool, DumpUtils::DumpsysKey> DumpsysMap(std::string argString);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
|
||||
@@ -20,9 +20,26 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class ExtensionPermissionsUtil
|
||||
* provides extension permission utilities.
|
||||
*/
|
||||
class ExtensionPermissionsUtil final {
|
||||
public:
|
||||
/**
|
||||
* CheckSAPermission, check if it has SA permissions.
|
||||
*
|
||||
* @param extensionType The extension type.
|
||||
* @return Whether it has SA permissions.
|
||||
*/
|
||||
static bool CheckSAPermission(const AppExecFwk::ExtensionAbilityType &extensionType);
|
||||
|
||||
/**
|
||||
* CheckSAPermissionMore, check if it has SA permissions or more.
|
||||
*
|
||||
* @param extensionType The extension type.
|
||||
* @return Whether it has SA permissions or more.
|
||||
*/
|
||||
static bool CheckSAPermissionMore(const AppExecFwk::ExtensionAbilityType &extensionType);
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
/**
|
||||
* @class ModalSystemDialogUtil
|
||||
* provides modal system dialog utilities.
|
||||
*/
|
||||
class ModalSystemDialogUtil final {
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -20,8 +20,19 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class MultiAppUtils
|
||||
* provides multi-app utilities.
|
||||
*/
|
||||
class MultiAppUtils {
|
||||
public:
|
||||
/**
|
||||
* GetRunningMultiAppIndex, get multi-app running application index.
|
||||
*
|
||||
* @param bundleName The bundle name of the app.
|
||||
* @param uid The calling uid.
|
||||
* @param appIndex The resultant application index.
|
||||
*/
|
||||
static void GetRunningMultiAppIndex(const std::string &bundleName, int32_t uid, int32_t &appIndex);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
|
||||
@@ -25,14 +25,67 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class MultiInstanceUtils
|
||||
* provides multi-instance utilities.
|
||||
*/
|
||||
class MultiInstanceUtils {
|
||||
public:
|
||||
/**
|
||||
* GetInstanceKey, get instance key of the given want.
|
||||
*
|
||||
* @param want The want param.
|
||||
* @return The instance key.
|
||||
*/
|
||||
static std::string GetInstanceKey(const Want& want);
|
||||
|
||||
/**
|
||||
* GetValidExtensionInstanceKey, get valid extension instance key.
|
||||
*
|
||||
* @param abilityRequest The ability request.
|
||||
* @return The instance key.
|
||||
*/
|
||||
static std::string GetValidExtensionInstanceKey(const AbilityRequest &abilityRequest);
|
||||
|
||||
/**
|
||||
* GetValidExtensionInstanceKey, get valid extension instance key.
|
||||
*
|
||||
* @param abilityRequest The ability request.
|
||||
* @return The instance key.
|
||||
*/
|
||||
static std::string GetSelfCallerInstanceKey(const AbilityRequest &abilityRequest);
|
||||
|
||||
/**
|
||||
* IsDefaultInstanceKey, check if the key is the default instance key.
|
||||
*
|
||||
* @param key The key to be queried.
|
||||
* @return Whether the instance key is the default.
|
||||
*/
|
||||
static bool IsDefaultInstanceKey(const std::string& key);
|
||||
|
||||
/**
|
||||
* IsMultiInstanceApp, check if the app is the default multi-instance app.
|
||||
*
|
||||
* @param appInfo The app info to be queried.
|
||||
* @return Whether the app is the default multi-instance app.
|
||||
*/
|
||||
static bool IsMultiInstanceApp(AppExecFwk::ApplicationInfo appInfo);
|
||||
|
||||
/**
|
||||
* IsSupportedExtensionType, check if the type supports extension type.
|
||||
*
|
||||
* @param type The extension ability type.
|
||||
* @return Whether the type supports extension type.
|
||||
*/
|
||||
static bool IsSupportedExtensionType(AppExecFwk::ExtensionAbilityType type);
|
||||
|
||||
/**
|
||||
* IsInstanceKeyExist, check if the instance key exists.
|
||||
*
|
||||
* @param bundleName The bundle name.
|
||||
* @param key The instance key to be queried.
|
||||
* @return Whether the instance key exists.
|
||||
*/
|
||||
static bool IsInstanceKeyExist(const std::string& bundleName, const std::string& key);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
|
||||
@@ -23,10 +23,34 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class StateUtils
|
||||
* provides state utilities.
|
||||
*/
|
||||
class StateUtils final {
|
||||
public:
|
||||
/**
|
||||
* StateToStrMap, convert ability state to string.
|
||||
*
|
||||
* @param state The ability state.
|
||||
* @return The string ability state.
|
||||
*/
|
||||
static std::string StateToStrMap(const AbilityState &state);
|
||||
|
||||
/**
|
||||
* AppStateToStrMap, convert app state to string.
|
||||
*
|
||||
* @param state The app state.
|
||||
* @return The string app state.
|
||||
*/
|
||||
static std::string AppStateToStrMap(const AppState &state);
|
||||
|
||||
/**
|
||||
* ConvertStateMap, convert ability lifecycle state to string.
|
||||
*
|
||||
* @param state The ability lifecycle state.
|
||||
* @return The string ability lifecycle state.
|
||||
*/
|
||||
static int ConvertStateMap(const AbilityLifeCycleState &state);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
|
||||
@@ -25,10 +25,34 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class WantUtils
|
||||
* provides want utilities.
|
||||
*/
|
||||
class WantUtils final {
|
||||
public:
|
||||
/**
|
||||
* ConvertToExplicitWant, convert implicit want to explicit want.
|
||||
*
|
||||
* @param want The implicit want.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
static int32_t ConvertToExplicitWant(Want& want);
|
||||
|
||||
/**
|
||||
* GetCallerBundleName, get caller bundle name.
|
||||
*
|
||||
* @param callerBundleName The caller bundle name.
|
||||
* @return Error code of calling the function.
|
||||
*/
|
||||
static int32_t GetCallerBundleName(std::string &callerBundleName);
|
||||
|
||||
/**
|
||||
* IsAtomicServiceUrl, check if the want contains atomic service url.
|
||||
*
|
||||
* @param want The implicit want.
|
||||
* @return Flag if the want contains atomic service url.
|
||||
*/
|
||||
static bool IsAtomicServiceUrl(const Want& want);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
|
||||
@@ -25,12 +25,44 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @class WindowOptionsUtils
|
||||
* provides window options utilities.
|
||||
*/
|
||||
class WindowOptionsUtils final {
|
||||
public:
|
||||
/**
|
||||
* SetWindowPositionAndSize, set window position and size.
|
||||
*
|
||||
* @param want The want param.
|
||||
* @param callerToken The caller token.
|
||||
* @param startOptions The start options.
|
||||
*/
|
||||
static void SetWindowPositionAndSize(Want& want,
|
||||
const sptr<IRemoteObject>& callerToken, const StartOptions& startOptions);
|
||||
|
||||
/**
|
||||
* WindowModeMap, get window mode map.
|
||||
*
|
||||
* @param windowMode The window mode.
|
||||
* @return The pair of the window mode result and the supported window mode.
|
||||
*/
|
||||
static std::pair<bool, AppExecFwk::SupportWindowMode> WindowModeMap(int32_t windowMode);
|
||||
|
||||
/**
|
||||
* UpdateWantToSetDisplayID, update want to set display id.
|
||||
*
|
||||
* @param want The want param.
|
||||
* @param callerToken The caller token.
|
||||
*/
|
||||
static void UpdateWantToSetDisplayID(Want &want, const sptr<IRemoteObject> &callerToken);
|
||||
|
||||
/**
|
||||
* UpdateStartOptionsToSetDisplayID, update start options to set display id.
|
||||
*
|
||||
* @param startOptions The start options.
|
||||
* @param callerToken The caller token.
|
||||
*/
|
||||
static void UpdateStartOptionsToSetDisplayID(StartOptions &startOptions,
|
||||
const sptr<IRemoteObject> &callerToken);
|
||||
};
|
||||
|
||||
@@ -1666,7 +1666,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
// prevent the app from dominating the screen
|
||||
if (callerToken == nullptr && !IsCallerSceneBoard() &&
|
||||
if (callerToken == nullptr && !IsCallerSceneBoard() && !isCallByShortcut &&
|
||||
AbilityPermissionUtil::GetInstance().IsDominateScreen(want, isPendingWantCaller)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "caller invalid");
|
||||
return ERR_INVALID_CALLER;
|
||||
|
||||
@@ -33,44 +33,253 @@ public:
|
||||
T value;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class AppUtils
|
||||
* provides app utils.
|
||||
*/
|
||||
class AppUtils {
|
||||
public:
|
||||
/**
|
||||
* GetInstance, get an instance of AppUtils.
|
||||
*
|
||||
* @return An instance of AppUtils.
|
||||
*/
|
||||
static AppUtils &GetInstance();
|
||||
|
||||
/**
|
||||
* AppUtils, destructor.
|
||||
*
|
||||
*/
|
||||
~AppUtils();
|
||||
|
||||
/**
|
||||
* IsLauncher, check if it is a launcher.
|
||||
*
|
||||
* @param bundleName The bundle name.
|
||||
* @return Whether it is a launcher.
|
||||
*/
|
||||
bool IsLauncher(const std::string &bundleName) const;
|
||||
|
||||
/**
|
||||
* IsLauncherAbility, check if it is a launcher ability.
|
||||
*
|
||||
* @param abilityName The ability name.
|
||||
* @return Whether it is a launcher ability.
|
||||
*/
|
||||
bool IsLauncherAbility(const std::string &abilityName) const;
|
||||
|
||||
/**
|
||||
* IsInheritWindowSplitScreenMode, check if it is inherit window split screen mode.
|
||||
*
|
||||
* @return Whether it is inherit window split screen mode.
|
||||
*/
|
||||
bool IsInheritWindowSplitScreenMode();
|
||||
|
||||
/**
|
||||
* IsSupportAncoApp, check if it supports anco app.
|
||||
*
|
||||
* @return Whether it supports anco app.
|
||||
*/
|
||||
bool IsSupportAncoApp();
|
||||
|
||||
/**
|
||||
* GetTimeoutUnitTimeRatio, get timeout unit time ratio.
|
||||
*
|
||||
* @return Timeout unit time ratio.
|
||||
*/
|
||||
int32_t GetTimeoutUnitTimeRatio();
|
||||
|
||||
/**
|
||||
* IsSelectorDialogDefaultPossion, check if selector dialog is on the default position.
|
||||
*
|
||||
* @return Whether selector dialog is on the default position.
|
||||
*/
|
||||
bool IsSelectorDialogDefaultPossion();
|
||||
|
||||
/**
|
||||
* IsStartSpecifiedProcess, check whether or not to start specified process.
|
||||
*
|
||||
* @return Whether or not to start specified process.
|
||||
*/
|
||||
bool IsStartSpecifiedProcess();
|
||||
|
||||
/**
|
||||
* IsUseMultiRenderProcess, check whether uses multi-render process.
|
||||
*
|
||||
* @return Whether uses multi-render process.
|
||||
*/
|
||||
bool IsUseMultiRenderProcess();
|
||||
|
||||
/**
|
||||
* IsLimitMaximumOfRenderProcess, check limit maximum of render process.
|
||||
*
|
||||
* @return Whether limit maximum of render process.
|
||||
*/
|
||||
bool IsLimitMaximumOfRenderProcess();
|
||||
|
||||
/**
|
||||
* IsGrantPersistUriPermission, check whether to grant persist uri permission.
|
||||
*
|
||||
* @return Whether to grant persist uri permission.
|
||||
*/
|
||||
bool IsGrantPersistUriPermission();
|
||||
|
||||
/**
|
||||
* IsStartOptionsWithAnimation, check whether the start options have animation.
|
||||
*
|
||||
* @return Whether the start options have animation.
|
||||
*/
|
||||
bool IsStartOptionsWithAnimation();
|
||||
|
||||
/**
|
||||
* IsStartOptionsWithAnimation, check whether it is a multi-process model.
|
||||
*
|
||||
* @return Whether it is a multi-process model.
|
||||
*/
|
||||
bool IsMultiProcessModel();
|
||||
|
||||
/**
|
||||
* IsStartOptionsWithProcessOptions, check whether the start options have process options.
|
||||
*
|
||||
* @return Whether the start options have process options.
|
||||
*/
|
||||
bool IsStartOptionsWithProcessOptions();
|
||||
|
||||
/**
|
||||
* EnableMoveUIAbilityToBackgroundApi, enable move ui-ability to background api.
|
||||
*
|
||||
* @return Whether the enable move ui-ability to background api is successful.
|
||||
*/
|
||||
bool EnableMoveUIAbilityToBackgroundApi();
|
||||
|
||||
/**
|
||||
* IsLaunchEmbededUIAbility, check if it is to launch embedded ui-ability.
|
||||
*
|
||||
* @return Whether it is to launch embedded ui-ability.
|
||||
*/
|
||||
bool IsLaunchEmbededUIAbility();
|
||||
|
||||
/**
|
||||
* IsSupportNativeChildProcess, check if it supports native child process.
|
||||
*
|
||||
* @return Whether it supports native child process.
|
||||
*/
|
||||
bool IsSupportNativeChildProcess();
|
||||
|
||||
/**
|
||||
* IsSupportMultiInstance, check if it supports multi-instance.
|
||||
*
|
||||
* @return Whether it supports multi-instance.
|
||||
*/
|
||||
bool IsSupportMultiInstance();
|
||||
|
||||
/**
|
||||
* IsAllowResidentInExtremeMemory, check if it allows resident in extrem low memory.
|
||||
*
|
||||
* @param bundleName The bundle name.
|
||||
* @param abilityName The ability name.
|
||||
* @return Whether it allows resident in extrem low memory.
|
||||
*/
|
||||
bool IsAllowResidentInExtremeMemory(const std::string& bundleName, const std::string& abilityName = "");
|
||||
|
||||
/**
|
||||
* IsAllowNativeChildProcess, check if it allows native child process.
|
||||
*
|
||||
* @param appIdentifier The app identifier.
|
||||
* @return Whether it allows native child process.
|
||||
*/
|
||||
bool IsAllowNativeChildProcess(const std::string &appIdentifier);
|
||||
|
||||
/**
|
||||
* GetLimitMaximumExtensionsPerProc, get limit max extensions per proc.
|
||||
*
|
||||
* @return Limit max extensions per proc.
|
||||
*/
|
||||
int32_t GetLimitMaximumExtensionsPerProc();
|
||||
|
||||
/**
|
||||
* GetLimitMaximumExtensionsPerDevice, get limit max extensions per device.
|
||||
*
|
||||
* @return Limit max extensions per device.
|
||||
*/
|
||||
int32_t GetLimitMaximumExtensionsPerDevice();
|
||||
|
||||
/**
|
||||
* GetCacheExtensionTypeList, get cache extension type list.
|
||||
*
|
||||
* @return Cache extension type list.
|
||||
*/
|
||||
std::string GetCacheExtensionTypeList();
|
||||
|
||||
/**
|
||||
* IsAllowStartAbilityWithoutCallerToken, check if it allows start ability without caller token.
|
||||
*
|
||||
* @param bundleName The bundle name.
|
||||
* @param abilityName The ability name.
|
||||
* @return Whether it allows start ability without caller token.
|
||||
*/
|
||||
bool IsAllowStartAbilityWithoutCallerToken(const std::string& bundleName, const std::string& abilityName);
|
||||
|
||||
/**
|
||||
* GetBrokerDelegateBundleName, get broker delegate bundle name.
|
||||
*
|
||||
* @return Broker delegate bundle name.
|
||||
*/
|
||||
std::string GetBrokerDelegateBundleName();
|
||||
|
||||
/**
|
||||
* GetCollaboratorBrokerUID, get collaborator broker id.
|
||||
*
|
||||
* @return Collaborator broker id.
|
||||
*/
|
||||
int32_t GetCollaboratorBrokerUID();
|
||||
|
||||
/**
|
||||
* GetCollaboratorBrokerReserveUID, get collaborator broker reserve uid.
|
||||
*
|
||||
* @return Collaborator broker reserve uid.
|
||||
*/
|
||||
int32_t GetCollaboratorBrokerReserveUID();
|
||||
|
||||
/**
|
||||
* MaxChildProcess, get max child process.
|
||||
*
|
||||
* @return Max child process.
|
||||
*/
|
||||
int32_t MaxChildProcess();
|
||||
|
||||
/**
|
||||
* GetMigrateClientBundleName, get migrate client bundle name.
|
||||
*
|
||||
* @return Migrate client bundle name.
|
||||
*/
|
||||
std::string GetMigrateClientBundleName();
|
||||
|
||||
private:
|
||||
/**
|
||||
* LoadResidentProcessInExtremeMemory, load resident process in extreme low memory.
|
||||
*
|
||||
*/
|
||||
void LoadResidentProcessInExtremeMemory();
|
||||
|
||||
/**
|
||||
* LoadAllowNativeChildProcessApps, load allow native child process apps.
|
||||
*
|
||||
*/
|
||||
void LoadAllowNativeChildProcessApps();
|
||||
|
||||
/**
|
||||
* LoadStartAbilityWithoutCallerToken, load start ability without caller token.
|
||||
*
|
||||
*/
|
||||
void LoadStartAbilityWithoutCallerToken();
|
||||
|
||||
/**
|
||||
* AppUtils, private constructor.
|
||||
*
|
||||
*/
|
||||
AppUtils();
|
||||
|
||||
volatile bool isSceneBoard_ = false;
|
||||
volatile DeviceConfiguration<bool> isInheritWindowSplitScreenMode_ = {false, true};
|
||||
volatile DeviceConfiguration<bool> isSupportAncoApp_ = {false, false};
|
||||
|
||||
Reference in New Issue
Block a user