1/* 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit MDMKit 19 */ 20 21import type Want from './@ohos.app.ability.Want'; 22 23/** 24 * This module provides the capability to manage the location of the enterprise devices. 25 * 26 * @namespace locationManager 27 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 28 * @stagemodelonly 29 * @since 11 30 */ 31declare namespace locationManager { 32 /** 33 * The location policy. 34 * 35 * @enum { number } 36 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 37 * @stagemodelonly 38 * @since 12 39 */ 40 export enum LocationPolicy { 41 /** 42 * Default location service. 43 * 44 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 45 * @stagemodelonly 46 * @since 12 47 */ 48 DEFAULT_LOCATION_SERVICE = 0, 49 50 /** 51 * Disallows open location service. 52 * 53 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 54 * @stagemodelonly 55 * @since 12 56 */ 57 DISALLOW_LOCATION_SERVICE = 1, 58 59 /** 60 * Force open the location service. 61 * 62 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 63 * @stagemodelonly 64 * @since 12 65 */ 66 FORCE_OPEN_LOCATION_SERVICE = 2, 67 } 68 69 /** 70 * Sets the policy of location service. 71 * This function can be called by a super administrator. 72 * 73 * @permission ohos.permission.ENTERPRISE_MANAGE_LOCATION 74 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 75 * The admin must have the corresponding permission. 76 * @param { LocationPolicy } policy - the policy of location service. 77 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 78 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 79 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 80 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 81 * 2. Incorrect parameter types; 3. Parameter verification failed. 82 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 83 * @stagemodelonly 84 * @since 12 85 */ 86 function setLocationPolicy(admin: Want, policy: LocationPolicy): void; 87 88 /** 89 * Gets device location service policy. 90 * This function can be called by a super administrator. 91 * 92 * @permission ohos.permission.ENTERPRISE_MANAGE_LOCATION 93 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 94 * If the admin is not empty, it must have the corresponding permission. 95 * @returns { LocationPolicy } the policy of location service. 96 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 97 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 98 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 99 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 100 * 2. Incorrect parameter types; 3. Parameter verification failed. 101 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 102 * @stagemodelonly 103 * @since 12 104 */ 105 function getLocationPolicy(admin: Want): LocationPolicy; 106} 107 108export default locationManager; 109