重命名enterprise device management接口

Signed-off-by: caiminggang <caiminggang1@huawei.com>
This commit is contained in:
caiminggang 2022-11-10 19:19:37 +08:00
parent 3d52035290
commit 7444263110
4 changed files with 145 additions and 42 deletions

View File

@ -18,6 +18,7 @@
*
* @since 9
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @StageModelOnly
*/
export default class EnterpriseAdminExtensionAbility {
@ -26,15 +27,17 @@ export default class EnterpriseAdminExtensionAbility {
*
* @since 9
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @StageModelOnly
*/
onAdminEnabled(): void;
/**
* Called back when an application is disabled.
*
* @since 9
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @StageModelOnly
*/
onAdminDisabled(): void;

View File

@ -14,44 +14,70 @@
*/
import { AsyncCallback, Callback } from "./basic";
import { DeviceSettingsManager as _DeviceSettingsManager } from "./enterpriseDeviceManager/DeviceSettingsManager";
import Want from "./@ohos.application.Want";
import Want from "./@ohos.app.ability.Want";
/**
* enterprise device manager.
* @name enterpriseDeviceManager
* @since 9
* This module provides the capability to manage the administrator of the enterprise devices.
* @namespace adminManager
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @since 9
*/
declare namespace enterpriseDeviceManager {
declare namespace adminManager {
/**
* @name EnterpriseInfo
* @since 9
* Provides the enterprise information.
* @typedef EnterpriseInfo
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @since 9
*/
export interface EnterpriseInfo {
/**
* The name of enterprise.
* @type {string}
* @since 9
*/
name: string;
/**
* The description of enterprise.
* @type {string}
* @since 9
*/
description: string;
}
/**
* @name DeviceSettingsManager
* @since 9
* Enum for type of administrator.
* @enum {number}
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
*/
export type DeviceSettingsManager = _DeviceSettingsManager
/**
* @name AdminType
* @systemapi
* @since 9
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
*/
export enum AdminType {
/**
* The value of normal administrator.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @since 9
*/
ADMIN_TYPE_NORMAL = 0x00,
/**
* The value of super administrator.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @since 9
*/
ADMIN_TYPE_SUPER = 0x01
}
/**
* Enum for managed event
* @enum {number}
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @since 9
*/
export enum ManagedEvent {
/**
@ -255,7 +281,7 @@ declare namespace enterpriseDeviceManager {
* Get information of the administrator's enterprise.
* @param { Want } admin - admin indicates the administrator ability information.
* @param { AsyncCallback<EnterpriseInfo> } callback - callback contained the enterprise info of administrator.
* @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
@ -268,7 +294,7 @@ declare namespace enterpriseDeviceManager {
* Get information of the administrator's enterprise.
* @param { Want } admin - admin indicates the administrator ability information.
* @returns { Promise<EnterpriseInfo> } promise contained the enterprise info of administrator.
* @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
@ -284,7 +310,7 @@ declare namespace enterpriseDeviceManager {
* @param { Want } admin - admin indicates the administrator ability information.
* @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application.
* @param { AsyncCallback<void> } callback - the callback of setEnterpriseInfo.
* @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 201 - the application does not have permission to call this function.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
@ -301,7 +327,7 @@ declare namespace enterpriseDeviceManager {
* @param { Want } admin - admin indicates the administrator ability information.
* @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application.
* @returns { Promise<void> } the promise returned by the setEnterpriseInfo.
* @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 201 - the application does not have permission to call this function.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
@ -335,16 +361,6 @@ declare namespace enterpriseDeviceManager {
*/
function isSuperAdmin(bundleName: String): Promise<boolean>;
/**
* Obtains the interface used to set device settings policy.
*
* @since 9
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @return Returns the DeviceSettingsManager interface.
*/
function getDeviceSettingsManager(callback: AsyncCallback<DeviceSettingsManager>): void;
function getDeviceSettingsManager(): Promise<DeviceSettingsManager>;
/**
* Subscribes the managed event of admin.
* @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
@ -414,4 +430,4 @@ declare namespace enterpriseDeviceManager {
function unsubscribeManagedEvent(admin: Want, managedEvents: Array<ManagedEvent>): Promise<void>;
}
export default enterpriseDeviceManager;
export default adminManager;

View File

@ -13,15 +13,35 @@
* limitations under the License.
*/
import { AsyncCallback, Callback } from "./../basic";
import Want from "./../@ohos.application.Want";
import { AsyncCallback } from "./basic";
import Want from "./@ohos.app.ability.Want";
/**
* @name Offers set settings policies on the devices.
* @since 9
* This module provides the capability to manage the datetime of the enterprise devices.
* @namespace dateTimeManager.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @since 9
*/
export interface DeviceSettingsManager {
declare namespace dateTimeManager {
/**
* Sets the system time.
* This function can be called by a super administrator.
* @permission ohos.permission.ENTERPRISE_SET_DATETIME
* @param { Want } admin - admin indicates the administrator ability information.
* @param { number } time - time indicates rhe target time stamp (ms).
* @param { AsyncCallback<void> } callback - the callback of setDateTime.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - the application does not have permission to call this function.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 9
*/
function setDateTime(admin: Want, time: number, callback: AsyncCallback<void>): void;
/**
* Sets the system time.
@ -30,8 +50,8 @@ export interface DeviceSettingsManager {
* @param { Want } admin - admin indicates the administrator ability information.
* @param { number } time - time indicates rhe target time stamp (ms).
* @returns { Promise<void> } the promise returned by the setDateTime.
* @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device.
* @throws { BusinessError } 9200002 - the administrator applicayion does not have permission to manage the device.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - the application does not have permission to call this function.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
@ -39,6 +59,7 @@ export interface DeviceSettingsManager {
* @stagemodelonly
* @since 9
*/
setDateTime(admin: Want, time: number, callback: AsyncCallback<void>): void;
setDateTime(admin: Want, time: number): Promise<void>;
}
function setDateTime(admin: Want, time: number): Promise<void>;
}
export default dateTimeManager;

63
api/@ohos.enterprise.deviceInfo.d.ts vendored Normal file
View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from "./basic";
import Want from "./@ohos.app.ability.Want";
/**
* This module provides the capability to manage the device info of the enterprise devices.
* @namespace deviceInfo.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @since 9
*/
declare namespace deviceInfo {
/**
* Gets the device serial.
* This function can be called by a super administrator.
* @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
* @param { Want } admin - admin indicates the administrator ability information.
* @param { AsyncCallback<string> } callback - the callback of getDeviceSerial.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - the application does not have permission to call this function.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 9
*/
function getDeviceSerial(admin: Want, callback: AsyncCallback<string>): void;
/**
* Gets the device serial.
* This function can be called by a super administrator.
* @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
* @param { Want } admin - admin indicates the administrator ability information.
* @returns { Promise<string> } the promise returned by the getDeviceSerial.
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - the application does not have permission to call this function.
* @throws { BusinessError } 401 - invalid input parameter.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 9
*/
function getDeviceSerial(admin: Want): Promise<string>;
}
export default deviceInfo;