已合并
feat: add DeviceModeDistributionPolicy enum and filterBundleListByDeviceModeDistributionPolicies #35428
Luobniz21创建于 8月27日
feat: add DeviceModeDistributionPolicy enum and filterBundleListByDeviceModeDistributionPolicies #35428
已合并
共 4 个文件变更+258-1
| @@ -1635,6 +1635,99 @@ declare namespace bundleManager { | |||
| 1635 | CLONE_APP = 2 | 1635 | 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 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1643 | + * | ||
| 1644 | + * | ||
| 1645 | + * 26.1.0 dynamic&static | ||
| 1646 | + */ | ||
| 1647 | + enum DeviceModeDistributionPolicy { | ||
| 1648 | + /** | ||
| 1649 | + * Unspecified device mode distribution policy. | ||
| 1650 | + * | ||
| 1651 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1652 | + * | ||
| 1653 | + * | ||
| 1654 | + * 26.1.0 dynamic&static | ||
| 1655 | + */ | ||
| 1656 | + UNSPECIFIED = 0, | ||
| 1657 | + /** | ||
| 1658 | + * The application is only available in primary mode. | ||
| 1659 | + * | ||
| 1660 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1661 | + * | ||
| 1662 | + * | ||
| 1663 | + * 26.1.0 dynamic&static | ||
| 1664 | + */ | ||
| 1665 | + MAIN_ONLY = 1, | ||
| 1666 | + /** | ||
| 1667 | + * The application is only available in secondary mode. | ||
| 1668 | + * | ||
| 1669 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1670 | + * | ||
| 1671 | + * | ||
| 1672 | + * 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 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1679 | + * | ||
| 1680 | + * | ||
| 1681 | + * 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 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1688 | + * | ||
| 1689 | + * | ||
| 1690 | + * 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 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1697 | + * | ||
| 1698 | + * | ||
| 1699 | + * 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 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1706 | + * | ||
| 1707 | + * | ||
| 1708 | + * 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 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1715 | + * | ||
| 1716 | + * | ||
| 1717 | + * 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 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1724 | + * | ||
| 1725 | + * | ||
| 1726 | + * 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 promise | 1732 | * 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 | + * ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | ||
H | |||
| 4701 | + * { Array<DeviceModeDistributionPolicy> } policies - Array of DeviceModeDistributionPolicy values. | ||
| 4702 | + * { Promise<void> } Promise that returns no value. | ||
| 4703 | + * { BusinessError } 201 - Permission denied. | ||
| 4704 | + * { BusinessError } 202 - Permission denied. Non-system APP calling system API. | ||
| 4705 | + * { BusinessError } 17700097 - The device does not support the dual mode. | ||
| 4706 | + * { 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 | + * { BusinessError } 17700099 - The device is installing or uninstalling an application, | ||
| 4712 | + * or a previous API call is still being processed. Please try again. | ||
| 4713 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 4714 | + * | ||
| 4715 | + * | ||
| 4716 | + * 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** support | 1241 | * 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 and | 1242 | * 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]{ .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 | * SystemCapability.BundleManager.BundleFramework.Core | 1251 | * SystemCapability.BundleManager.BundleFramework.Core |
| 1246 | * | 1252 | * |
| @@ -1518,6 +1518,98 @@ declare namespace bundleManager { | |||
| 1518 | BUNDLE_INSTALLED = 3 | 1518 | BUNDLE_INSTALLED = 3 |
| 1519 | } | 1519 | } |
| 1520 | 1520 | ||
| 1521 | + /** | ||
| 1522 | + * 定义设备模式分发策略枚举,用于指定应用程序如何分发到设备上。 | ||
| 1523 | + * | ||
| 1524 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1525 | + * | ||
| 1526 | + * | ||
| 1527 | + * 26.1.0 dynamic&static | ||
| 1528 | + */ | ||
| 1529 | + enum DeviceModeDistributionPolicy { | ||
| 1530 | + /** | ||
| 1531 | + * 未指定设备模式分发策略。 | ||
| 1532 | + * | ||
| 1533 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1534 | + * | ||
| 1535 | + * | ||
| 1536 | + * 26.1.0 dynamic&static | ||
| 1537 | + */ | ||
| 1538 | + UNSPECIFIED = 0, | ||
| 1539 | + /** | ||
| 1540 | + * 该应用程序仅在主模式下可用。 | ||
| 1541 | + * | ||
| 1542 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1543 | + * | ||
| 1544 | + * | ||
| 1545 | + * 26.1.0 dynamic&static | ||
| 1546 | + */ | ||
| 1547 | + MAIN_ONLY = 1, | ||
| 1548 | + /** | ||
| 1549 | + * 该应用程序仅在副模式下可用。 | ||
| 1550 | + * | ||
| 1551 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1552 | + * | ||
| 1553 | + * | ||
| 1554 | + * 26.1.0 dynamic&static | ||
| 1555 | + */ | ||
| 1556 | + SUB_ONLY = 2, | ||
| 1557 | + /** | ||
| 1558 | + * 应用程序在两种模式下都可用,具有相同的包体。 | ||
| 1559 | + * | ||
| 1560 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1561 | + * | ||
| 1562 | + * | ||
| 1563 | + * 26.1.0 dynamic&static | ||
| 1564 | + */ | ||
| 1565 | + UNIVERSAL_IDENTICAL_PACKAGE = 3, | ||
| 1566 | + /** | ||
| 1567 | + * 应用程序在两种模式下都可用,具有不同的包体。 | ||
| 1568 | + * | ||
| 1569 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1570 | + * | ||
| 1571 | + * | ||
| 1572 | + * 26.1.0 dynamic&static | ||
| 1573 | + */ | ||
| 1574 | + UNIVERSAL_DIFFERENT_PACKAGE = 4, | ||
| 1575 | + /** | ||
| 1576 | + * 该应用程序在不同模式之间以相同包体方式部分兼容。 | ||
| 1577 | + * | ||
| 1578 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1579 | + * | ||
| 1580 | + * | ||
| 1581 | + * 26.1.0 dynamic&static | ||
| 1582 | + */ | ||
| 1583 | + PARTIAL_COMPATIBLE_IDENTICAL_PACKAGE = 5, | ||
| 1584 | + /** | ||
| 1585 | + * 应用程序在不同模式之间以不同包体部分兼容。 | ||
| 1586 | + * | ||
| 1587 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1588 | + * | ||
| 1589 | + * | ||
| 1590 | + * 26.1.0 dynamic&static | ||
| 1591 | + */ | ||
| 1592 | + PARTIAL_COMPATIBLE_DIFFERENT_PACKAGE = 6, | ||
| 1593 | + /** | ||
| 1594 | + * 应用程序在不同模式之间以相同包体完全兼容。 | ||
| 1595 | + * | ||
| 1596 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1597 | + * | ||
| 1598 | + * | ||
| 1599 | + * 26.1.0 dynamic&static | ||
| 1600 | + */ | ||
| 1601 | + FULL_COMPATIBLE_IDENTICAL_PACKAGE = 7, | ||
| 1602 | + /** | ||
| 1603 | + * 应用程序在不同模式之间以不同的包体方式完全兼容。 | ||
| 1604 | + * | ||
| 1605 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 1606 | + * | ||
| 1607 | + * | ||
| 1608 | + * 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 | + * ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | ||
| 4382 | + * { Array<DeviceModeDistributionPolicy> } policies - DeviceModeDistributionPolicy值的数组。 | ||
| 4383 | + * { Promise<void> } Promise 对象,无返回值。 | ||
| 4384 | + * { BusinessError } 201 - Permission denied. | ||
| 4385 | + * { BusinessError } 202 - Permission denied. Non-system APP calling system API. | ||
| 4386 | + * { BusinessError } 17700097 - The device does not support the dual mode. | ||
| 4387 | + * { 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 | + * { BusinessError } 17700099 - The device is installing or uninstalling an application, | ||
| 4393 | + * or a previous API call is still being processed. Please try again. | ||
| 4394 | + * SystemCapability.BundleManager.BundleFramework.Core | ||
| 4395 | + * | ||
| 4396 | + * | ||
| 4397 | + * 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]{ ./bundleManager/ApplicationInfo:ApplicationInfo}中的installSource字段取值。使用该参数安装的应用,其安装来源 | 1175 | * [ApplicationInfo]{ ./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]{ .bundle.bundleManager:bundleManager.DeviceModeDistributionPolicy} | ||
| 1179 | + * 枚举值的十进制字符串(例如**"4"**)。用于指定正在安装应用的设备模式分发策略(自API version 26.1.0起支持)。若未传入该键,则策略默认为**UNSPECIFIED**(0)。 | ||
| 1180 | + * 若值非法(不是十进制整数字符串或超出[0, 8]范围),则忽略该键,策略默认为**UNSPECIFIED**。 | ||
| 1177 | * | 1181 | * |
| 1178 | * SystemCapability.BundleManager.BundleFramework.Core | 1182 | * SystemCapability.BundleManager.BundleFramework.Core |
| 1179 | * | 1183 | * |
权限?