IRemoteBrokerpublic interface IBundleManager extends IRemoteBroker
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ERROR_CODE_DOWNLOAD_FAILED |
Indicates that download failed
|
static int |
ERROR_CODE_INSTALL_FAILED |
Indicates that install failed
|
static int |
ERROR_CODE_QUERY_FAILED |
Indicates that query failed
|
static int |
GET_ABILITY_INFO_WITH_APPLICATION |
Indicates that bundle information to return includes application information in the
AbilityInfo. |
static int |
GET_ABILITY_INFO_WITH_PERMISSION |
Indicates that bundle information to return includes permission information in the
AbilityInfo. |
static int |
GET_APPLICATION_INFO_WITH_PERMISSION |
Indicates that bundle information to return includes permission information in the
ApplicationInfo. |
static int |
GET_BUNDLE_DEFAULT |
Indicates that bundle information to return does not include ability information.
|
static int |
GET_BUNDLE_WITH_ABILITIES |
Indicates that bundle information to return includes ability information.
|
static int |
GET_BUNDLE_WITH_REQUESTED_PERMISSION |
Indicates that bundle information to return includes requested permission information.
|
static int |
PERMISSION_DENIED |
Indicates that the application does not have a particular permission.
|
static int |
PERMISSION_GRANTED |
Indicates that the application has been granted a particular permission.
|
static int |
QUERY_SHORTCUT_HOME |
Flag for query home shortcut.
|
static int |
SHORTCUT_EXISTENCE_EXISTS |
Indicates that shortcut exists.
|
static int |
SHORTCUT_EXISTENCE_NOT_EXISTS |
Indicates that shortcut not exists.
|
static int |
SHORTCUT_EXISTENCE_UNKNOW |
Indicates that unknow shortcut existence.
|
static int |
SIGNATURE_MATCHED |
Indicates that two bundles have the same signature.
|
static int |
SIGNATURE_NOT_MATCHED |
Indicates that two bundles have the different signatures.
|
static int |
SIGNATURE_UNKNOWN_BUNDLE |
Indicates that one of two bundles is not installed in system.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
addHomeShortcut(ShortcutInfo shortcutInfo) |
Adds a home-screen shortcut that will be fixed on the home screen.
|
int |
checkPermission(String bundleName,
String permission) |
Checks whether a specified bundle has been granted a specific permission.
|
int |
checkPublicKeys(String firstBundleName,
String secondBundleName) |
Checks whether the publickeys of two bundles are the same.
|
void |
cleanBundleCacheFiles(String bundleName,
ICleanCacheCallback callback) |
Clears cache data of a specified application.
|
void |
disableHomeShortcuts(List<String> shortcutIds) |
Disables specified home-screen shortcuts that are no longer used.
|
void |
enableHomeShortcuts(List<String> shortcutIds) |
Enables specified home-screen shortcuts.
|
int |
executeBackupTask(int sessionId,
String taskCmd) |
Executes a backup or restoration task.
|
int |
finishBackupSession(int sessionId) |
Finishes a backup or restoration session.
|
PixelMap |
getAbilityIcon(String bundleName,
String className) |
Obtains the icon of a specified ability.
|
String |
getAbilityLabel(String bundleName,
String className) |
Obtains the label of a specified ability.
|
default List<FormInfo> |
getAllForms() |
已过时。
Use
getAllFormsInfo() instead. |
List<FormInfo> |
getAllFormsInfo() |
Obtains the
FormInfo objects provided by all ohos applications on the device. |
Optional<List<PermissionGroupDef>> |
getAllPermissionGroupDefs() |
Obtains all known permission groups in the system.
|
ApplicationInfo |
getApplicationInfo(String bundleName,
int flags,
int userId) |
Obtains the
ApplicationInfo based on a given bundle name. |
List<ApplicationInfo> |
getApplicationInfos(int flags,
int userId) |
Obtains information about all installed applications of a specified user.
|
List<String> |
getAppsGrantedPermissions(String[] permissions) |
Obtains the list of applications that have the specified permissions.
|
String |
getAppType(String bundleName) |
Obtains the type of a specified application based on the given bundle name.
|
BundleInfo |
getBundleArchiveInfo(String hapFilePath,
int flags) |
Obtains information about an application bundle contained in an ohos Ability Package (HAP).
|
int[] |
getBundleGids(String bundleName) |
Obtains an array of all group IDs associated with a specified bundle.
|
BundleInfo |
getBundleInfo(String bundleName,
int flags) |
Obtains the
BundleInfo based on a given bundle name. |
BundleInfo |
getBundleInfo(String networkId,
String bundleName,
int flags) |
Obtains the
BundleInfo based on a given networkId and bundle name. |
List<BundleInfo> |
getBundleInfos(int flags) |
Obtains
BundleInfo of all bundles available in the system. |
IBundleInstaller |
getBundleInstaller() |
Obtains the interface used to install bundles.
|
List<String> |
getBundlesForUid(int uid) |
Obtains all bundle names of a specified application based on the given application UID.
|
boolean |
getClearUserDataFlag(String bundleName,
String moduleName) |
Obtains the type of a specified application based on the given bundle name.
|
default List<FormInfo> |
getFormsByApp(String bundleName) |
已过时。
Use
getFormsInfoByApp(java.lang.String) instead. |
default List<FormInfo> |
getFormsByModule(String bundleName,
String moduleName) |
已过时。
|
List<FormInfo> |
getFormsInfoByApp(String bundleName) |
Obtains the
FormInfo objects provided by a specified ohos application on the device. |
List<FormInfo> |
getFormsInfoByModule(String bundleName,
String moduleName) |
Obtains the
FormInfo objects provided by a specified application module on the device. |
List<ShortcutInfo> |
getHomeShortcutInfos() |
Obtains all home-screen shortcuts.
|
Intent |
getLaunchIntentForBundle(String bundleName) |
Obtains the
Intent for starting the main ability of an application based on the
given bundle name. |
AbilityInfo |
getModuleMainAbility(String bundleName,
String moduleName) |
get mainAbility info by bundleName and moduleName.
|
String |
getNameForUid(int uid) |
Obtains the formal name associated with the given UID.
|
PermissionDef |
getPermissionDef(String permissionName) |
Obtains detailed information about a specified permission.
|
Optional<List<PermissionDef>> |
getPermissionDefByGroup(String permissionGroupName) |
Obtains information about all permissions in a specified permission group.
|
Optional<PermissionGroupDef> |
getPermissionGroupDef(String permissionGroupName) |
Obtains information about a specified permission group.
|
List<ShortcutInfo> |
getShortcutInfos(String bundleName) |
Obtains information about the shortcuts of the application.
|
List<String> |
getSystemAvailableCapabilities() |
Obtains the capabilities that are available in the system.
|
int |
getUidByBundleName(String bundleName,
int userId) |
Obtains the application UID based on the given bundle name and user ID.
|
boolean |
hasSystemCapability(String name) |
Checks whether the system has a specified capability.
|
boolean |
isAbilityEnabled(AbilityInfo abilityInfo) |
Checks whether a specified ability is enabled.
|
boolean |
isApplicationEnabled(String bundleName) |
Checks whether a specified application is enabled.
|
boolean |
isHomeShortcutSupported() |
Checks whether a shortcut can be added to the home screen where the application is located.
|
boolean |
isSafeMode() |
Checks whether the current device has been started in safe mode.
|
boolean |
isShortcutExist(String shortcutId) |
Checks whether a specified shortcut is available.
|
int |
isShortcutExist(String shortcutId,
int flag) |
Checks whether a specified shortcut is available.
|
List<AbilityInfo> |
queryAbilityByIntent(Intent intent,
int flags,
int userId) |
Queries all
AbilityInfo information based on the given intent. |
void |
registerAllPermissionsChanged(IRemoteObject callback) |
Registers a callback for listening for permission changes of all UIDs.
|
void |
registerPermissionsChanged(int[] uids,
IRemoteObject callback) |
Registers a callback for listening for permission changes of specified UIDs.
|
void |
setAbilityEnabled(AbilityInfo abilityInfo,
boolean isEnabled) |
Sets whether to enable a specified ability.
|
void |
setApplicationEnabled(String bundleName,
boolean isEnabled) |
Sets whether to enable a specified application.
|
boolean |
setClearUserDataFlag(String packageName,
boolean flag) |
Obtains the type of a specified application based on the given bundle name.
|
boolean |
setFormEnabled(FormBaseInfo baseInfo,
boolean isEnabled) |
set form enable or disable.
|
int |
startBackupSession(IBackupSessionCallback callback) |
Starts a backup or restoration session.
|
void |
startShortcut(String shortcutId,
String bundleName) |
Starts a shortcut based on the given shortcut ID and bundle name.
|
void |
unregisterPermissionsChanged(IRemoteObject callback) |
Unregisters a specified callback for listening for permission changes.
|
boolean |
updateShortcuts(List<ShortcutInfo> shortcutInfos) |
Updates information about specified home-screen shortcuts that have been added.
|
asObjectstatic final int ERROR_CODE_DOWNLOAD_FAILED
static final int ERROR_CODE_INSTALL_FAILED
static final int ERROR_CODE_QUERY_FAILED
static final int GET_ABILITY_INFO_WITH_APPLICATION
AbilityInfo.
The value is 0x00000004.
static final int GET_ABILITY_INFO_WITH_PERMISSION
AbilityInfo.
The value is 0x00000002.
static final int GET_APPLICATION_INFO_WITH_PERMISSION
ApplicationInfo.
The value is 0x00000008.
static final int GET_BUNDLE_DEFAULT
The value is 0x00000000.
static final int GET_BUNDLE_WITH_ABILITIES
The value is 0x00000001.
static final int GET_BUNDLE_WITH_REQUESTED_PERMISSION
The value is 0x00000010.
getBundleInfo(String, int),
常量字段值static final int PERMISSION_DENIED
During permission check, this value is returned if the application does not have the specific permission or the check fails due to other reasons.
PERMISSION_GRANTED,
checkPermission(String, String),
常量字段值static final int PERMISSION_GRANTED
During permission check, this value is returned if the application already has the specific permission.
Otherwise, PERMISSION_DENIED is returned.
PERMISSION_DENIED,
checkPermission(String, String),
常量字段值static final int QUERY_SHORTCUT_HOME
static final int SHORTCUT_EXISTENCE_EXISTS
static final int SHORTCUT_EXISTENCE_NOT_EXISTS
static final int SHORTCUT_EXISTENCE_UNKNOW
static final int SIGNATURE_MATCHED
static final int SIGNATURE_NOT_MATCHED
static final int SIGNATURE_UNKNOWN_BUNDLE
BundleInfo getBundleInfo(String bundleName, int flags) throws RemoteException
BundleInfo based on a given bundle name.
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
or ohos.permission.GET_BUNDLE_INFO permission from the system.
The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the signature|privileged
level, and the ohos.permission.GET_BUNDLE_INFO permission is of the normal level.
Information contained in the BundleInfo object to be returned varies depending on the value of the
flags parameter.
0x00000000: Returns the basic BundleInfo object.0x00000001: Returns the BundleInfo object with abilityInfo specified.
0x00000000.bundleName - Indicates the application bundle name to be queried.flags - Indicates the flag used to specify information contained in the BundleInfo that will be
returned.BundleInfo object.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.BundleInfo getBundleInfo(String networkId, String bundleName, int flags) throws RemoteException
BundleInfo based on a given networkId and bundle name.
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
or ohos.permission.GET_BUNDLE_INFO permission from the system.
The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the signature|privileged
level, and the ohos.permission.GET_BUNDLE_INFO permission is of the normal level.
Information contained in the BundleInfo object to be returned varies depending on the value of the
flags parameter.
0x00000000: Returns the basic BundleInfo object.0x00000001: Returns the BundleInfo object with abilityInfo specified.
0x00000000.networkId - Indicates the device networkId in area network.bundleName - Indicates the application bundle name to be queried.flags - Indicates the flag used to specify information contained in the BundleInfo that will be
returned.BundleInfo object.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.IBundleInstaller getBundleInstaller() throws RemoteException
To use this method, you need to request the ohos.permission.INSTALL_BUNDLE
permission from the system.
IBundleInstaller interface.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.ApplicationInfo getApplicationInfo(String bundleName, int flags, int userId) throws RemoteException
ApplicationInfo based on a given bundle name.
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
or ohos.permission.GET_BUNDLE_INFO permission from the system.
The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the signature|privileged
level, and the ohos.permission.GET_BUNDLE_INFO permission is of the normal level.
Information contained in the ApplicationInfo object to be returned varies depending on the value of
the flags parameter.
0x00000000: Returns the basic ApplicationInfo object.0x00000008: Returns the ApplicationInfo object with permission specified.0x00000000.bundleName - Indicates the application bundle name to be queried.flags - Indicates the flag used to specify information contained in the ApplicationInfo object
that will be returned.userId - Indicates the user ID.ApplicationInfo object.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.int checkPermission(String bundleName, String permission)
bundleName - Indicates the name of the bundle to check.permission - Indicates the permission to check.0 if the bundle has the permission; returns -1 otherwise.List<AbilityInfo> queryAbilityByIntent(Intent intent, int flags, int userId) throws RemoteException
AbilityInfo information based on the given intent.
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
or ohos.permission.GET_BUNDLE_INFO permission from the system.
The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the signature|privileged
level, and the ohos.permission.GET_BUNDLE_INFO permission is of the normal level.
Information contained in the AbilityInfo objects to be returned varies depending on the value of
the flags parameter.
0x00000000: Returns basic AbilityInfo objects.0x00000002: Returns AbilityInfo objects with permission specified.0x00000004: Returns AbilityInfo objects with applicationInfo specified.0x00000000.intent - Indicates the Intent containing the application bundle name to
be queried.flags - Indicates the flag used to specify information contained in the AbilityInfo objects that
will be returned.userId - Indicates the user ID.AbilityInfo objects.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.List<BundleInfo> getBundleInfos(int flags) throws RemoteException
BundleInfo of all bundles available in the system.
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
permission from the system. The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of
the signature|privileged level.
Information contained in the BundleInfo objects to be returned varies depending on the value of the
flags parameter.
0x00000000: Returns basic BundleInfo objects.0x00000001: Returns BundleInfo objects with abilityInfo specified.
0x00000000.flags - Indicates the flag used to specify information contained in the BundleInfo that will be
returned.BundleInfo objects.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.int getUidByBundleName(String bundleName, int userId) throws RemoteException
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
or ohos.permission.GET_BUNDLE_INFO permission from the system.
The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the signature|privileged
level, and the ohos.permission.GET_BUNDLE_INFO permission is of the normal level.
bundleName - Indicates the bundle name of the application.userId - Indicates the user ID.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.List<String> getBundlesForUid(int uid) throws RemoteException
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
permission from the system. The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of
the signature|privileged level.
uid - Indicates the application UID.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.void registerAllPermissionsChanged(IRemoteObject callback) throws RemoteException
After this method is called, the caller will be notified when the permission of any UID changes. You can
call unregisterPermissionsChanged(ohos.rpc.IRemoteObject) to unregister the listener.
To use this method, you need to request the ohos.permission.LISTEN_PERMISSION_CHANGE
permission from the system. The ohos.permission.LISTEN_PERMISSION_CHANGE permission is of
the signature|privileged level.
callback - Indicates the callback method to register.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.registerPermissionsChanged(int[], IRemoteObject),
unregisterPermissionsChanged(IRemoteObject)void registerPermissionsChanged(int[] uids,
IRemoteObject callback)
throws RemoteException
After this method is called, the caller will be notified when the permission of a given UID changes. You
can call unregisterPermissionsChanged(ohos.rpc.IRemoteObject) to unregister the listener.
To use this method, you need to request the ohos.permission.LISTEN_PERMISSION_CHANGE
permission from the system. The ohos.permission.LISTEN_PERMISSION_CHANGE permission is of
the signature|privileged level.
uids - Indicates the list of UIDs whose permission changes will be monitored.callback - Indicates the callback method to register.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.registerAllPermissionsChanged(IRemoteObject),
unregisterPermissionsChanged(IRemoteObject)void unregisterPermissionsChanged(IRemoteObject callback) throws RemoteException
To use this method, you need to request the ohos.permission.LISTEN_PERMISSION_CHANGE
permission from the system. The ohos.permission.LISTEN_PERMISSION_CHANGE permission is of
the signature|privileged level.
callback - Indicates the callback method to unregister.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.registerAllPermissionsChanged(IRemoteObject),
registerPermissionsChanged(int[], IRemoteObject)List<ApplicationInfo> getApplicationInfos(int flags, int userId) throws RemoteException
To use this method, you need to request the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO or
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission from the system.
The ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level, and the
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the
signature|privileged level.
Information contained in the ApplicationInfo object to be returned varies depending on the value of
the flags parameter.
0x00000000: Returns the basic ApplicationInfo object.0x00000008: Returns the ApplicationInfo object with permission specified.0x00000000.flags - Indicates the flag used to specify information contained in the ApplicationInfo objects
that will be returned.userId - Indicates the user ID.ApplicationInfo objects.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.List<String> getSystemAvailableCapabilities()
boolean hasSystemCapability(String name)
name - Indicates the name of the system feature to check.true if the given feature specified by name is available in the system;
returns false otherwise.int[] getBundleGids(String bundleName)
bundleName - Indicates the bundle name of the application.int array containing the group IDs associated with the specified bundle.int checkPublicKeys(String firstBundleName, String secondBundleName) throws RemoteException
To use this method, you need to request the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission
from the system.
The ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level.
firstBundleName - Indicates the name of a bundle to compare.secondBundleName - Indicates the name of another bundle to compare.SIGNATURE_UNKNOWN_BUNDLE if at least one of the given bundles is not found;
returns SIGNATURE_NOT_MATCHED if their publickeys are different;
returns SIGNATURE_MATCHED if their publickeys are the same.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.String getNameForUid(int uid) throws RemoteException
uid - Indicates the UID of an application.<i>shared-userid</i>:<i>uid</i> format
if shared-userid has been configured in the config.json file;
returns the bundle name otherwise.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.BundleInfo getBundleArchiveInfo(String hapFilePath, int flags)
Information contained in the BundleInfo object to be returned varies depending on the value of
the flags parameter.
0x00000000: Returns the basic BundleInfo object.0x00000001: Returns the BundleInfo object with abilityInfo specified.
0x00000000.hapFilePath - Indicates the path storing the HAP. The path should be the relative path to the data
directory of the current application.flags - Indicates the flag used to specify information contained in the BundleInfo object to be
returned.BundleInfo object.boolean isSafeMode()
true if the device is in safe mode; returns false otherwise.Intent getLaunchIntentForBundle(String bundleName) throws RemoteException
Intent for starting the main ability of an application based on the
given bundle name. The main ability of an application is the ability that has the
Intent.ACTION_HOME and Intent.ENTITY_HOME intent
filters set in the application's config.json file.
To use this method, you need to request the ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
permission from the system. The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the
signature|privileged level.
bundleName - Indicates the bundle name of the application.Intent for starting the application's main ability if any; returns null if
the given bundle does not exist or does not contain any main ability.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.void setApplicationEnabled(String bundleName, boolean isEnabled) throws IllegalArgumentException
To use this method, you need to request the ohos.permission.CHANGE_ABILITY_ENABLED_STATE
permission from the system. The ohos.permission.CHANGE_ABILITY_ENABLED_STATE permission is of the
signature|privileged level.
bundleName - Indicates the bundle name of the application.isEnabled - Specifies whether to enable the application. The value true means to enable it, and the
value false means to disable it.IllegalArgumentException - Throws this exception if the given bundle does not exist.SecurityException - Throws this exception to indicate a security violation.void setAbilityEnabled(AbilityInfo abilityInfo, boolean isEnabled) throws IllegalArgumentException
To use this method, you need to request the ohos.permission.CHANGE_ABILITY_ENABLED_STATE
permission from the system. The ohos.permission.CHANGE_ABILITY_ENABLED_STATE permission is of the
signature|privileged level.
abilityInfo - Indicates information about the ability to set.isEnabled - Specifies whether to enable the ability. The value true means to enable it, and the
value false means to disable it.IllegalArgumentException - Throws this exception if the given ability does not exist.SecurityException - Throws this exception to indicate a security violation.boolean isApplicationEnabled(String bundleName) throws IllegalArgumentException
bundleName - Indicates the bundle name of the application.true if the application is enabled; returns false otherwise.IllegalArgumentException - Throws this exception if the given bundle does not exist.boolean isAbilityEnabled(AbilityInfo abilityInfo) throws IllegalArgumentException
abilityInfo - Indicates information about the ability to check.true if the ability is enabled; returns false otherwise.IllegalArgumentException - Throws this exception if the given ability does not exist.int startBackupSession(IBackupSessionCallback callback)
callback - Indicates the IBackupSessionCallback used to notify the application of the backup or
restoration task status.-1 if a common failure occurs;returns -2 if your
application does not have permission to call this method.int executeBackupTask(int sessionId,
String taskCmd)
sessionId - Indicates the session ID for the backup or restoration task.taskCmd - Indicates the task command to execute.0 if the task is successfully started; returns -1 if a common failure occurs;
returns -2 if your application does not have permission to call this method; returns -3
if the task command is not supported;returns -4 if the task command has been issued.int finishBackupSession(int sessionId)
sessionId - Indicates the ID of the session to finish.0 if the session is successfully finished; returns -1 if a common failure
occurs; returns -2 if your application does not have permission to call this method.List<ShortcutInfo> getShortcutInfos(String bundleName) throws RemoteException
To use this method, you need to request the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO and
ohos.permission.MANAGE_SHORTCUTS permission from the system.
The ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level,
and the ohos.permission.MANAGE_SHORTCUTS permission is of the signature level.
bundleName - Indicates the bundle name of the application.ShortcutInfo objects containing shortcut information about the application.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.PermissionDef getPermissionDef(String permissionName)
permissionName - Indicates the name of the ohos permission.PermissionDef object containing detailed information about the given
ohos permission.Optional<PermissionGroupDef> getPermissionGroupDef(String permissionGroupName)
permissionGroupName - Indicates the name of the permission group.PermissionGroupDef object containing detailed information about
the given permission group.Optional<List<PermissionDef>> getPermissionDefByGroup(String permissionGroupName)
permissionGroupName - Indicates the name of the permission group.PermissionDef objects containing detailed information about all
permissions in the given permission group.void cleanBundleCacheFiles(String bundleName, ICleanCacheCallback callback)
To use this method, your application must have gained the
ohos.permission.REMOVE_CACHE_FILES permission.
bundleName - Indicates the bundle name of the application whose cache data is to be cleared.callback - Indicates the callback to be invoked for returning the operation result.
For details, see ICleanCacheCallback.SecurityException - Throws this exception if your application does not have the required permission.void startShortcut(String shortcutId, String bundleName) throws RemoteException
To use this method, you need to request the ohos.permission.MANAGE_SHORTCUTS permission from the
system. The ohos.permission.MANAGE_SHORTCUTS permission is of the signature level.
shortcutId - Indicates the ID of the shortcut to start.bundleName - BundleName Indicates the bundle name of the application to which the shortcut belongs.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception if your application does not have required permissions.String getAppType(String bundleName) throws RemoteException
To use this method, you need to request the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission
from the system.
The ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level.
bundleName - Indicates the bundle name of the application.system if the application is a system application;
returns normal if it is released in Ohos AppGallery;
returns other if it is released by a third-party vendor;
returns an empty string if the query fails.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.int isShortcutExist(String shortcutId, int flag)
shortcutId - Indicates the ID of the shortcut to check.flag - Indicates the type of the shortcut to check. Currently, only the home-screen shortcut
IBundleManager#QUERY_SHORTCUT_HOME is available.IBundleManager#SHORTCUT_EXISTENCE_EXISTS if the specified shortcut is available;
returns IBundleManager#SHORTCUT_EXISTENCE_NOT_EXISTS if it is not available;
returns IBundleManager.SHORTCUT_EXISTENCE_UNKNOW if an error occurs.boolean isShortcutExist(String shortcutId)
shortcutId - Indicates the ID of the shortcut to check.true if the specified shortcut is available; returns false otherwise.boolean isHomeShortcutSupported()
true if a shortcut can be added to the home screen; returns false otherwise.boolean addHomeShortcut(ShortcutInfo shortcutInfo) throws IllegalArgumentException, IllegalStateException
shortcutInfo - Indicates the ShortcutInfo object containing information about the home-screen
shortcut to add. The id, label, and intent attributes of this
parameter must be specified.true if the shortcut is successfully added; returns false otherwise.IllegalArgumentException - Throws this exception if the id, label, or intents
attribute of the shortcutInfo parameter is null or if the shortcut
to be added already exists but is disabled.IllegalStateException - Throws this exception if the calling application is running in the background.boolean updateShortcuts(List<ShortcutInfo> shortcutInfos)
shortcutInfos - Indicates the list of shortcuts to be updated.true if the operation is successful; returns false otherwise.void disableHomeShortcuts(List<String> shortcutIds) throws IllegalArgumentException
shortcutIds - Indicates the list of shortcut IDs to be disabled.IllegalArgumentException - Throws this exception if a static shortcut is specified in shortcutIds.void enableHomeShortcuts(List<String> shortcutIds) throws IllegalArgumentException
shortcutIds - Indicates the list of shortcut IDs to be enabled.IllegalArgumentException - Throws this exception if a static shortcut is specified in shortcutIds.List<ShortcutInfo> getHomeShortcutInfos()
Optional<List<PermissionGroupDef>> getAllPermissionGroupDefs()
PermissionGroupDef objects containing the
permission group information.List<String> getAppsGrantedPermissions(String[] permissions) throws RemoteException
Permissions: SystemPermission.GET_BUNDLE_INFO_PRIVILEGED
permissions - Indicates the permission array.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.SecurityException - Throws this exception to indicate a security violation.PixelMap getAbilityIcon(String bundleName, String className) throws RemoteException
Permissions: SystemPermission.GET_BUNDLE_INFO,
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED
bundleName - Indicates the bundle name of the application to which the ability belongs.className - Indicates the class name of the ability.PixelMap object representing the icon of the specified ability.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.String getAbilityLabel(String bundleName, String className) throws RemoteException
Permissions: SystemPermission.GET_BUNDLE_INFO,
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED
bundleName - Indicates the bundle name of the application to which the ability belongs.className - Indicates the class name of the ability.RemoteException - Throws this exception if the system failed to obtain the bundle manager service.List<FormInfo> getAllFormsInfo() throws RemoteException
FormInfo objects provided by all ohos applications on the device.
Permission: SystemPermission.GET_BUNDLE_INFO_PRIVILEGED
FormInfo objects if obtained; returns an empty List if no
FormInfo is available on the device.RemoteException - Throws this exception if FormInfo fails to be obtained due to a connection
error between the application and bundle manager service.SecurityException - Throws this exception if the application is not granted with the
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED permission.@Deprecated default List<FormInfo> getAllForms() throws RemoteException
getAllFormsInfo() instead.FormInfo objects provided by all ohos applications on the device.
Permission: SystemPermission.GET_BUNDLE_INFO_PRIVILEGED
FormInfo objects if obtained; returns an empty List if no
FormInfo is available on the device.RemoteException - Throws this exception if FormInfo fails to be obtained due to a connection
error between the application and bundle manager service.SecurityException - Throws this exception if the application is not granted with the
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED permission.List<FormInfo> getFormsInfoByApp(String bundleName) throws RemoteException
FormInfo objects provided by a specified ohos application on the device.
The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the signature|privileged level,
the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level.bundleName - Indicates the bundle name of the ohos application. Specifically, it is the value of the
bundleName attribute defined in the app tag of the config.json file for the
Harmony application.FormInfo objects if obtained; returns an empty List if no
FormInfo is provided by the specified application.RemoteException - Throws this exception if FormInfo fails to be obtained due to a connection
error between the application and bundle manager service.SecurityException - Throws this exception if the application is not granted with the
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED permission.FormInfo@Deprecated default List<FormInfo> getFormsByApp(String bundleName) throws RemoteException
getFormsInfoByApp(java.lang.String) instead.FormInfo objects provided by a specified ohos application on the device.
Permission: SystemPermission.GET_BUNDLE_INFO_PRIVILEGED
bundleName - Indicates the bundle name of the ohos application. Specifically, it is the value of the
bundleName attribute defined in the app tag of the config.json file for the
Harmony application.FormInfo objects if obtained; returns an empty List if no
FormInfo is provided by the specified application.RemoteException - Throws this exception if FormInfo fails to be obtained due to a connection
error between the application and bundle manager service.SecurityException - Throws this exception if the application is not granted with the
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED permission.FormInfoList<FormInfo> getFormsInfoByModule(String bundleName, String moduleName) throws RemoteException
FormInfo objects provided by a specified application module on the device.
The ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission is of the signature|privileged level,
the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level.bundleName - Indicates the bundle name of the ohos application. Specifically, it is the value of the
bundleName attribute defined in the app tag of the config.json file for the Harmony
application.moduleName - Indicates the module name of the ohos application. Specifically, it is the value of the
moduleName sub-attribute of the distro attribute defined in the module tag of the
config.json file for the Harmony application.FormInfo objects if obtained; returns an empty List if no
FormInfo is provided by the specified application module.RemoteException - Throws this exception if FormInfo fails to be obtained due to a connection
error between the application and bundle manager service.SecurityException - Throws this exception if the application is not granted with the
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED permission.FormInfo@Deprecated default List<FormInfo> getFormsByModule(String bundleName, String moduleName) throws RemoteException
getFormsInfoByModule(java.lang.String,java.lang.String) instead.FormInfo objects provided by a specified application module on the device.
Permission: SystemPermission.GET_BUNDLE_INFO_PRIVILEGED
bundleName - Indicates the bundle name of the ohos application. Specifically, it is the value of the
bundleName attribute defined in the app tag of the config.json file for the Harmony
application.moduleName - Indicates the module name of the ohos application. Specifically, it is the value of the
moduleName sub-attribute of the distro attribute defined in the module tag of the
config.json file for the Harmony application.FormInfo objects if obtained; returns an empty List if no
FormInfo is provided by the specified application module.RemoteException - Throws this exception if FormInfo fails to be obtained due to a connection
error between the application and bundle manager service.SecurityException - Throws this exception if the application is not granted with the
SystemPermission.GET_BUNDLE_INFO_PRIVILEGED permission.FormInfoAbilityInfo getModuleMainAbility(String bundleName, String moduleName) throws RemoteException
bundleName - Indicates the bundle name of the ohos application.moduleName - Indicates the module name of the ohos application.RemoteException - function sendRequest may be throw RemoteException.boolean getClearUserDataFlag(String bundleName, String moduleName)
To use this method, you need to request the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission
from the system.
The ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level.
bundleName - Indicates the bundle name of the ohos application.moduleName - Indicates the module name of the ohos application.boolean setClearUserDataFlag(String packageName, boolean flag)
To use this method, you need to request the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission
from the system.
The ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level.
packageName - Indicates the package name of the application.flag - Indicates the flag to be cleared.boolean setFormEnabled(FormBaseInfo baseInfo, boolean isEnabled) throws IllegalArgumentException, RemoteException, SecurityException
To use this method, you need to request the ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission
from the system.
The ohos.permission.GET_OTHER_USERS_BUNDLE_INFO permission is of the normal level.
FormBaseInfo - form info.isEnabled - wheter the form is enabled.IllegalArgumentException - if the FormBaseInfo is invalid.RemoteException - if a connection error between the application and bundle manager service.SecurityException - if the form is not owned by caller.