!11366 【EDM】增加内网升级接口

Merge pull request !11366 from 方昀/master
This commit is contained in:
openharmony_ci 2024-06-03 11:27:26 +00:00 committed by Gitee
commit f5b58c6371
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -194,6 +194,280 @@ declare namespace systemManager {
installEndTime?: number;
}
/**
* The device system update package info.
*
* @typedef UpdatePackageInfo
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
export interface UpdatePackageInfo {
/**
* The version of system update package.
*
* @type { string }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
version: string;
/**
* The detail of system update packages.
*
* @type { Array<Package> }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
packages: Array<Package>;
/**
* The description of system update package.
*
* @type { ?PackageDescription }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
description?: PackageDescription;
}
/**
* The detail of system update package.
*
* @typedef Package
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
interface Package {
/**
* The type of system update package.
*
* @type { PackageType }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
type: PackageType;
/**
* The path of system update package.
*
* @type { string }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
path: string;
/**
* The file descriptor of system update package.
*
* @type { ?number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
fd?: number;
}
/**
* Enum for system update package.
*
* @enum { number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
enum PackageType {
/**
* FIRMWARE
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
FIRMWARE = 1
}
/**
* The description of system update package.
*
* @typedef PackageDescription
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
interface PackageDescription {
/**
* The custom notification of system update package.
*
* @type { ?NotifyDescription }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
notify?: NotifyDescription;
}
/**
* The custom notification of system update package.
*
* @typedef NotifyDescription
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
interface NotifyDescription {
/**
* The custom notification tips of system update package.
*
* @type { ?string }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
installTips?: string;
/**
* The custom notification tips detail of system update package.
*
* @type { ?string }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
installTipsDetail?: string;
}
/**
* The result of system update.
*
* @typedef UpdateResult
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
interface UpdateResult {
/**
* The current version of the system.
*
* @type { string }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
version: string;
/**
* The update status of the system.
*
* @type { UpdateStatus }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
status: UpdateStatus;
/**
* The update error message of the system.
*
* @type { ErrorInfo }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
errorInfo: ErrorInfo;
}
/**
* Enum for system update status.
*
* @enum { number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
enum UpdateStatus {
/**
* The specified version system update package does not exist.
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
NO_UPDATE_PACKAGE = -4,
/**
* The system update package waiting for installation.
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
UPDATE_WAITING = -3,
/**
* The system is updating.
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
UPDATING = -2,
/**
* The system update failed.
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
UPDATE_FAILURE = -1,
/**
* The system update successful.
*
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
UPDATE_SUCCESS = 0
}
/**
* The update error information of the system.
*
* @typedef ErrorInfo
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
interface ErrorInfo {
/**
* The update error code of the system.
*
* @type { number }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
code: number;
/**
* The update error message of the system.
*
* @type { string }
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
message: string;
}
/**
* Sets NTP server.
* This function can be called by a super administrator.
@ -269,6 +543,45 @@ declare namespace systemManager {
* @since 12
*/
function getOtaUpdatePolicy(admin: Want): OtaUpdatePolicy;
/**
* Notifies the system of update packages information.
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_SYSTEM
* @param { Want } admin - admin indicates the administrator ability information.
* @param { UpdatePackageInfo } packageInfo - packageInfo indicates the information of system update package.
* @returns { Promise<void> } the promise returned by the notifyUpdatePackages.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 9201004 - The update packages do not exist or analyzing failed.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
function notifyUpdatePackages(admin: Want, packageInfo: UpdatePackageInfo): Promise<void>;
/**
* Gets the result of system update.
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_SYSTEM
* @param { Want } admin - admin indicates the administrator ability information.
* @param { string } version - version indicates the version of update.
* @returns { Promise<UpdateResult> } the promise returned by the getUpdateResult.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
function getUpdateResult(admin: Want, version: string): Promise<UpdateResult>;
}
export default systemManager;