1/* 2 * Copyright (c) 2023 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 * @systemapi 29 * @stagemodelonly 30 * @since 11 31 */ 32declare namespace locationManager { 33 /** 34 * The location policy. 35 * 36 * @enum { number } 37 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 38 * @systemapi 39 * @stagemodelonly 40 * @since 11 41 */ 42 export enum LocationPolicy { 43 /** 44 * Default location service. 45 * 46 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 47 * @systemapi 48 * @stagemodelonly 49 * @since 11 50 */ 51 DEFAULT_LOCATION_SERVICE = 0, 52 53 /** 54 * Disallows open location service. 55 * 56 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 57 * @systemapi 58 * @stagemodelonly 59 * @since 11 60 */ 61 DISALLOW_LOCATION_SERVICE = 1, 62 63 /** 64 * Force open the location service. 65 * 66 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 67 * @systemapi 68 * @stagemodelonly 69 * @since 11 70 */ 71 FORCE_OPEN_LOCATION_SERVICE = 2, 72 } 73 74 /** 75 * Sets the policy of location service. 76 * This function can be called by a super administrator. 77 * 78 * @permission ohos.permission.ENTERPRISE_MANAGE_LOCATION 79 * @param { Want } admin - admin indicates the administrator ability information. 80 * @param { LocationPolicy } policy - the policy of location service. 81 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 82 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 83 * @throws { BusinessError } 201 - the application does not have permission to call this function. 84 * @throws { BusinessError } 202 - not system application. 85 * @throws { BusinessError } 401 - invalid input parameter. 86 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 87 * @systemapi 88 * @stagemodelonly 89 * @since 11 90 */ 91 function setLocationPolicy(admin: Want, policy: LocationPolicy): void; 92 93 /** 94 * Gets device location service policy. 95 * This function can be called by a super administrator. 96 * 97 * @permission ohos.permission.ENTERPRISE_MANAGE_LOCATION 98 * @param { Want } admin - admin indicates the administrator ability information. 99 * @returns { LocationPolicy } the policy of location service. 100 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 101 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 102 * @throws { BusinessError } 201 - the application does not have permission to call this function. 103 * @throws { BusinessError } 202 - not system application. 104 * @throws { BusinessError } 401 - invalid input parameter. 105 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 106 * @systemapi 107 * @stagemodelonly 108 * @since 11 109 */ 110 function getLocationPolicy(admin: Want): LocationPolicy; 111} 112 113export default locationManager; 114