已合并
feat: add DeviceModeDistributionPolicy enum and filterBundleListByDeviceModeDistributionPolicies #35428
feat: add DeviceModeDistributionPolicy enum and filterBundleListByDeviceModeDistributionPolicies #35428
已合并
Luobniz21创建于 8月27日
共 4 个文件变更+258-1
@@ -1635,6 +1635,99 @@ declare namespace bundleManager {
1635 CLONE_APP = 21635 CLONE_APP = 2
1636 }1636 }
1637 1637 
1638+ /**
1639+ * Define the enumeration of device mode distribution policies, which is used to specify how an application
1640+ * is distributed on a device.
1641+ *
1642+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1643+ * @systemapi
1644+ * @stagemodelonly
1645+ * @since 26.1.0 dynamic&static
1646+ */
1647+ enum DeviceModeDistributionPolicy {
1648+ /**
1649+ * Unspecified device mode distribution policy.
1650+ *
1651+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1652+ * @systemapi
1653+ * @stagemodelonly
1654+ * @since 26.1.0 dynamic&static
1655+ */
1656+ UNSPECIFIED = 0,
1657+ /**
1658+ * The application is only available in primary mode.
1659+ *
1660+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1661+ * @systemapi
1662+ * @stagemodelonly
1663+ * @since 26.1.0 dynamic&static
1664+ */
1665+ MAIN_ONLY = 1,
1666+ /**
1667+ * The application is only available in secondary mode.
1668+ *
1669+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1670+ * @systemapi
1671+ * @stagemodelonly
1672+ * @since 26.1.0 dynamic&static
1673+ */
1674+ SUB_ONLY = 2,
1675+ /**
1676+ * The application is available in both modes with identical package body.
1677+ *
1678+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1679+ * @systemapi
1680+ * @stagemodelonly
1681+ * @since 26.1.0 dynamic&static
1682+ */
1683+ UNIVERSAL_IDENTICAL_PACKAGE = 3,
1684+ /**
1685+ * The application is available in both modes with different package body.
1686+ *
1687+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1688+ * @systemapi
1689+ * @stagemodelonly
1690+ * @since 26.1.0 dynamic&static
1691+ */
1692+ UNIVERSAL_DIFFERENT_PACKAGE = 4,
1693+ /**
1694+ * The application is partially compatible across modes with identical package body.
1695+ *
1696+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1697+ * @systemapi
1698+ * @stagemodelonly
1699+ * @since 26.1.0 dynamic&static
1700+ */
1701+ PARTIAL_COMPATIBLE_IDENTICAL_PACKAGE = 5,
1702+ /**
1703+ * The application is partially compatible across modes with different package body.
1704+ *
1705+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1706+ * @systemapi
1707+ * @stagemodelonly
1708+ * @since 26.1.0 dynamic&static
1709+ */
1710+ PARTIAL_COMPATIBLE_DIFFERENT_PACKAGE = 6,
1711+ /**
1712+ * The application is fully compatible across modes with identical package body.
1713+ *
1714+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1715+ * @systemapi
1716+ * @stagemodelonly
1717+ * @since 26.1.0 dynamic&static
1718+ */
1719+ FULL_COMPATIBLE_IDENTICAL_PACKAGE = 7,
1720+ /**
1721+ * The application is fully compatible across modes with different package body.
1722+ *
1723+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1724+ * @systemapi
1725+ * @stagemodelonly
1726+ * @since 26.1.0 dynamic&static
1727+ */
1728+ FULL_COMPATIBLE_DIFFERENT_PACKAGE = 8
1729+ }
1730+ 
1638 /**1731 /**
1639 * Obtains the bundle information of the current application based on the given bundle flags. This API uses a promise1732 * Obtains the bundle information of the current application based on the given bundle flags. This API uses a promise
1640 * to return the result.1733 * to return the result.
@@ -4593,6 +4686,38 @@ declare namespace bundleManager {
4593 */4686 */
4594 function getInstalledBundleList(bundleFlags: int): Promise<Array<BundleInfo>>;4687 function getInstalledBundleList(bundleFlags: int): Promise<Array<BundleInfo>>;
4595 4688 
4689+ /**
4690+ * Filters the bundle list by device mode distribution policies.
4691+ * This API uses a promise to return the result.
4692+ *
4693+ * > **NOTE**
4694+ * >
4695+ * > The input parameter cannot be empty. All values must be within the range of the enumerated values of
4696+ * > DeviceModeDistributionPolicy, and the policies for all different packages
4697+ * > (UNIVERSAL_DIFFERENT_PACKAGE, PARTIAL_COMPATIBLE_DIFFERENT_PACKAGE, and FULL_COMPATIBLE_DIFFERENT_PACKAGE)
4698+ * > must be included.
4699+ *
4700+ * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
H
Hhanfeng68月28日

权限?

likedislike
Luobniz21
Luobniz21
8月28日 评论:
4701+ * @param { Array<DeviceModeDistributionPolicy> } policies - Array of DeviceModeDistributionPolicy values.
4702+ * @returns { Promise<void> } Promise that returns no value.
4703+ * @throws { BusinessError } 201 - Permission denied.
4704+ * @throws { BusinessError } 202 - Permission denied. Non-system APP calling system API.
4705+ * @throws { BusinessError } 17700097 - The device does not support the dual mode.
4706+ * @throws { BusinessError } 17700098 - The input parameter is invalid. It is either outside the range of valid
4707+ * enum values or does not include the following required enum values: [
4708+ * DeviceModeDistributionPolicy.UNIVERSAL_DIFFERENT_PACKAGE,
4709+ * DeviceModeDistributionPolicy.PARTIAL_COMPATIBLE_DIFFERENT_PACKAGE,
4710+ * DeviceModeDistributionPolicy.FULL_COMPATIBLE_DIFFERENT_PACKAGE].
4711+ * @throws { BusinessError } 17700099 - The device is installing or uninstalling an application,
4712+ * or a previous API call is still being processed. Please try again.
4713+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
4714+ * @systemapi
4715+ * @stagemodelonly
4716+ * @since 26.1.0 dynamic&static
4717+ */
4718+ function filterBundleListByDeviceModeDistributionPolicies(
4719+ policies: Array<DeviceModeDistributionPolicy>): Promise<void>;
4720+ 
4596 /**4721 /**
4597 * Defines the application information.4722 * Defines the application information.
4598 *4723 *
@@ -1241,6 +1241,12 @@ declare namespace installer {
1241 * certificate distribution type set to **app_gallery** or the signing certificate type set to **debug** support1241 * certificate distribution type set to **app_gallery** or the signing certificate type set to **debug** support
1242 * downgrade installation. To use downgrade installation, you must request the ohos.permission.INSTALL_BUNDLE and1242 * downgrade installation. To use downgrade installation, you must request the ohos.permission.INSTALL_BUNDLE and
1243 * ohos.permission.INSTALL_ALLOW_DOWNGRADE permissions.1243 * ohos.permission.INSTALL_ALLOW_DOWNGRADE permissions.
1244+ * - **ohos.bms.param.deviceModeDistributionPolicy**: The value is a decimal string of a
1245+ * [DeviceModeDistributionPolicy]{@link @ohos.bundle.bundleManager:bundleManager.DeviceModeDistributionPolicy}
1246+ * enum value (for example, **"4"**). It specifies the device mode distribution policy for the application
1247+ * being installed (supported since API version 26.1.0). If this key is not present, the policy defaults to
1248+ * **UNSPECIFIED** (0). If the value is invalid (not a decimal string integer or out of range [0, 8]), this key
1249+ * is ignored and the policy defaults to **UNSPECIFIED**.
1244 *1250 *
1245 * @syscap SystemCapability.BundleManager.BundleFramework.Core1251 * @syscap SystemCapability.BundleManager.BundleFramework.Core
1246 * @systemapi1252 * @systemapi
@@ -1518,6 +1518,98 @@ declare namespace bundleManager {
1518 BUNDLE_INSTALLED = 31518 BUNDLE_INSTALLED = 3
1519 }1519 }
1520 1520 
1521+ /**
1522+ * 定义设备模式分发策略枚举,用于指定应用程序如何分发到设备上。
1523+ *
1524+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1525+ * @systemapi
1526+ * @stagemodelonly
1527+ * @since 26.1.0 dynamic&static
1528+ */
1529+ enum DeviceModeDistributionPolicy {
1530+ /**
1531+ * 未指定设备模式分发策略。
1532+ *
1533+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1534+ * @systemapi
1535+ * @stagemodelonly
1536+ * @since 26.1.0 dynamic&static
1537+ */
1538+ UNSPECIFIED = 0,
1539+ /**
1540+ * 该应用程序仅在主模式下可用。
1541+ *
1542+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1543+ * @systemapi
1544+ * @stagemodelonly
1545+ * @since 26.1.0 dynamic&static
1546+ */
1547+ MAIN_ONLY = 1,
1548+ /**
1549+ * 该应用程序仅在副模式下可用。
1550+ *
1551+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1552+ * @systemapi
1553+ * @stagemodelonly
1554+ * @since 26.1.0 dynamic&static
1555+ */
1556+ SUB_ONLY = 2,
1557+ /**
1558+ * 应用程序在两种模式下都可用,具有相同的包体。
1559+ *
1560+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1561+ * @systemapi
1562+ * @stagemodelonly
1563+ * @since 26.1.0 dynamic&static
1564+ */
1565+ UNIVERSAL_IDENTICAL_PACKAGE = 3,
1566+ /**
1567+ * 应用程序在两种模式下都可用,具有不同的包体。
1568+ *
1569+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1570+ * @systemapi
1571+ * @stagemodelonly
1572+ * @since 26.1.0 dynamic&static
1573+ */
1574+ UNIVERSAL_DIFFERENT_PACKAGE = 4,
1575+ /**
1576+ * 该应用程序在不同模式之间以相同包体方式部分兼容。
1577+ *
1578+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1579+ * @systemapi
1580+ * @stagemodelonly
1581+ * @since 26.1.0 dynamic&static
1582+ */
1583+ PARTIAL_COMPATIBLE_IDENTICAL_PACKAGE = 5,
1584+ /**
1585+ * 应用程序在不同模式之间以不同包体部分兼容。
1586+ *
1587+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1588+ * @systemapi
1589+ * @stagemodelonly
1590+ * @since 26.1.0 dynamic&static
1591+ */
1592+ PARTIAL_COMPATIBLE_DIFFERENT_PACKAGE = 6,
1593+ /**
1594+ * 应用程序在不同模式之间以相同包体完全兼容。
1595+ *
1596+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1597+ * @systemapi
1598+ * @stagemodelonly
1599+ * @since 26.1.0 dynamic&static
1600+ */
1601+ FULL_COMPATIBLE_IDENTICAL_PACKAGE = 7,
1602+ /**
1603+ * 应用程序在不同模式之间以不同的包体方式完全兼容。
1604+ *
1605+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
1606+ * @systemapi
1607+ * @stagemodelonly
1608+ * @since 26.1.0 dynamic&static
1609+ */
1610+ FULL_COMPATIBLE_DIFFERENT_PACKAGE = 8,
1611+ }
1612+ 
1521 /**1613 /**
1522 * 根据给定的bundleFlags获取当前应用的BundleInfo。使用Promise异步回调。1614 * 根据给定的bundleFlags获取当前应用的BundleInfo。使用Promise异步回调。
1523 *1615 *
@@ -4278,6 +4370,36 @@ declare namespace bundleManager {
4278 */4370 */
4279 function getInstalledBundleList(bundleFlags: int): Promise<Array<BundleInfo>>;4371 function getInstalledBundleList(bundleFlags: int): Promise<Array<BundleInfo>>;
4280 4372 
4373+ /**
4374+ * 支持按设备模式分发策略过滤应用列表。该接口使用promise返回结果。
4375+ *
4376+ * > **说明:**
4377+ * >
4378+ * > 入参不能为空。所有值必须在的枚举值范围内。
4379+ * > DeviceModeDistributePolicy,以及所有不同套餐的策略(通用差分包、部分兼容差分包和全兼容差分包)必须包含。
4380+ *
4381+ * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
4382+ * @param { Array<DeviceModeDistributionPolicy> } policies - DeviceModeDistributionPolicy值的数组。
4383+ * @returns { Promise<void> } Promise 对象,无返回值。
4384+ * @throws { BusinessError } 201 - Permission denied.
4385+ * @throws { BusinessError } 202 - Permission denied. Non-system APP calling system API.
4386+ * @throws { BusinessError } 17700097 - The device does not support the dual mode.
4387+ * @throws { BusinessError } 17700098 - The input parameter is invalid. It is either outside the range of valid
4388+ * enum values or does not include the following required enum values: [
4389+ * DeviceModeDistributionPolicy.UNIVERSAL_DIFFERENT_PACKAGE,
4390+ * DeviceModeDistributionPolicy.PARTIAL_COMPATIBLE_DIFFERENT_PACKAGE,
4391+ * DeviceModeDistributionPolicy.FULL_COMPATIBLE_DIFFERENT_PACKAGE].
4392+ * @throws { BusinessError } 17700099 - The device is installing or uninstalling an application,
4393+ * or a previous API call is still being processed. Please try again.
4394+ * @syscap SystemCapability.BundleManager.BundleFramework.Core
4395+ * @systemapi
4396+ * @stagemodelonly
4397+ * @since 26.1.0 dynamic&static
4398+ */
4399+ function filterBundleListByDeviceModeDistributionPolicies(
4400+ policies: Array<DeviceModeDistributionPolicy>
4401+ ): Promise<void>;
4402+ 
4281 /**4403 /**
4282 * 应用程序信息。4404 * 应用程序信息。
4283 *4405 *
@@ -1173,7 +1173,11 @@ declare namespace installer {
1173 * ohos.permission.INSTALL_BUNDLE和ohos.permission.INSTALL_ALLOW_DOWNGRADE权限。</br> - "1173 * ohos.permission.INSTALL_BUNDLE和ohos.permission.INSTALL_ALLOW_DOWNGRADE权限。</br> - "
1174 * ohos.bms.param.originalInstallSource":用于指定待安装应用的原始安装来源,对应value取值范围为1174 * ohos.bms.param.originalInstallSource":用于指定待安装应用的原始安装来源,对应value取值范围为
1175 * [ApplicationInfo]{@link ./bundleManager/ApplicationInfo:ApplicationInfo}中的installSource字段取值。使用该参数安装的应用,其安装来源1175 * [ApplicationInfo]{@link ./bundleManager/ApplicationInfo:ApplicationInfo}中的installSource字段取值。使用该参数安装的应用,其安装来源
1176- * installSource会被设置为指定的value值。参数生效条件:待安装应用必须未在设备上安装;当value指定为应用包名时,要求指定的应用必须已安装且为系统应用。从API version 23开始支持。1176+ * installSource会被设置为指定的value值。参数生效条件:待安装应用必须未在设备上安装;当value指定为应用包名时,要求指定的应用必须已安装且为系统应用。从API version 23开始支持。</br> - "
1177+ * ohos.bms.param.deviceModeDistributionPolicy":value值为
1178+ * [DeviceModeDistributionPolicy]{@link @ohos.bundle.bundleManager:bundleManager.DeviceModeDistributionPolicy}
1179+ * 枚举值的十进制字符串(例如**"4"**)。用于指定正在安装应用的设备模式分发策略(自API version 26.1.0起支持)。若未传入该键,则策略默认为**UNSPECIFIED**(0)。
1180+ * 若值非法(不是十进制整数字符串或超出[0, 8]范围),则忽略该键,策略默认为**UNSPECIFIED**。
1177 *1181 *
1178 * @syscap SystemCapability.BundleManager.BundleFramework.Core1182 * @syscap SystemCapability.BundleManager.BundleFramework.Core
1179 * @systemapi1183 * @systemapi