161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit NetworkKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type { AsyncCallback, Callback } from './@ohos.base';
2261847f8eSopenharmony_ciimport type connection from './@ohos.net.connection';
2361847f8eSopenharmony_ci
2461847f8eSopenharmony_ci/**
2561847f8eSopenharmony_ci * Provides interfaces to manage network policy rules.
2661847f8eSopenharmony_ci * @namespace policy
2761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.NetManager.Core
2861847f8eSopenharmony_ci * @since 10
2961847f8eSopenharmony_ci */
3061847f8eSopenharmony_cideclare namespace policy {
3161847f8eSopenharmony_ci  /**
3261847f8eSopenharmony_ci   * Get network bear type.
3361847f8eSopenharmony_ci   * @typedef { connection.NetBearType }
3461847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
3561847f8eSopenharmony_ci   * @since 10
3661847f8eSopenharmony_ci   */
3761847f8eSopenharmony_ci  type NetBearType = connection.NetBearType;
3861847f8eSopenharmony_ci
3961847f8eSopenharmony_ci  /**
4061847f8eSopenharmony_ci   * Control if applications can use data on background.
4161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
4261847f8eSopenharmony_ci   * @param { boolean } isAllowed - Allow applications to use data on background.
4361847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of setBackgroundAllowed.
4461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
4561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
4661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
4761847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
4861847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
4961847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
5061847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
5161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
5261847f8eSopenharmony_ci   * @since 10
5361847f8eSopenharmony_ci   */
5461847f8eSopenharmony_ci  function setBackgroundAllowed(isAllowed: boolean, callback: AsyncCallback<void>): void;
5561847f8eSopenharmony_ci  
5661847f8eSopenharmony_ci  /**
5761847f8eSopenharmony_ci   * Control if applications can use data on background.
5861847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
5961847f8eSopenharmony_ci   * @param { boolean } isAllowed - Allow applications to use data on background.
6061847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
6161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
6261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
6361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
6461847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
6561847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
6661847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
6761847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
6861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
6961847f8eSopenharmony_ci   * @since 10
7061847f8eSopenharmony_ci   */
7161847f8eSopenharmony_ci  function setBackgroundAllowed(isAllowed: boolean): Promise<void>;
7261847f8eSopenharmony_ci
7361847f8eSopenharmony_ci  /**
7461847f8eSopenharmony_ci   * Get the status if applications can use data on background.
7561847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
7661847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - the callback of allowed or not to use data on background.
7761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
7861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
7961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
8061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
8161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
8261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
8361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
8461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
8561847f8eSopenharmony_ci   * @since 10
8661847f8eSopenharmony_ci   */
8761847f8eSopenharmony_ci  function isBackgroundAllowed(callback: AsyncCallback<boolean>): void;
8861847f8eSopenharmony_ci
8961847f8eSopenharmony_ci  /**
9061847f8eSopenharmony_ci   * Get the status if applications can use data on background.
9161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
9261847f8eSopenharmony_ci   * @returns { Promise<boolean> } The promise returned by the function.
9361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
9461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
9561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
9661847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
9761847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
9861847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
9961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
10061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
10161847f8eSopenharmony_ci   * @since 10
10261847f8eSopenharmony_ci   */
10361847f8eSopenharmony_ci  function isBackgroundAllowed(): Promise<boolean>;
10461847f8eSopenharmony_ci
10561847f8eSopenharmony_ci  /**
10661847f8eSopenharmony_ci   * Get the background network policy for the specified uid.
10761847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
10861847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
10961847f8eSopenharmony_ci   * @param { AsyncCallback<NetBackgroundPolicy> } callback - the callback of getBackgroundPolicyByUid.
11061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
11161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
11261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
11361847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
11461847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
11561847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
11661847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
11761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
11861847f8eSopenharmony_ci   * @since 10
11961847f8eSopenharmony_ci   */
12061847f8eSopenharmony_ci  function getBackgroundPolicyByUid(uid: number, callback: AsyncCallback<NetBackgroundPolicy>): void;
12161847f8eSopenharmony_ci
12261847f8eSopenharmony_ci  /**
12361847f8eSopenharmony_ci   * Get the background network policy for the specified uid.
12461847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
12561847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
12661847f8eSopenharmony_ci   * @returns { Promise<NetBackgroundPolicy> } The promise returned by the function.
12761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
12861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
12961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
13061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
13161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
13261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
13361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
13461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
13561847f8eSopenharmony_ci   * @since 10
13661847f8eSopenharmony_ci   */
13761847f8eSopenharmony_ci  function getBackgroundPolicyByUid(uid: number): Promise<NetBackgroundPolicy>;
13861847f8eSopenharmony_ci
13961847f8eSopenharmony_ci  /**
14061847f8eSopenharmony_ci   * Set the policy for the specified UID.
14161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
14261847f8eSopenharmony_ci   * @param { number } uid - the specified UID of application.
14361847f8eSopenharmony_ci   * @param { NetUidPolicy } policy - the policy of the current UID of application.For details, see {@link NetUidPolicy}.
14461847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of setPolicyByUid.
14561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
14661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
14761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
14861847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
14961847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
15061847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
15161847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
15261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
15361847f8eSopenharmony_ci   * @since 10
15461847f8eSopenharmony_ci   */
15561847f8eSopenharmony_ci  function setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback<void>): void;
15661847f8eSopenharmony_ci
15761847f8eSopenharmony_ci  /**
15861847f8eSopenharmony_ci   * Set the policy for the specified UID.
15961847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
16061847f8eSopenharmony_ci   * @param { number } uid - the specified UID of application.
16161847f8eSopenharmony_ci   * @param { NetUidPolicy } policy - the policy of the current UID of application.For details, see {@link NetUidPolicy}.
16261847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
16361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
16461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
16561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
16661847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
16861847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
16961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
17061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
17161847f8eSopenharmony_ci   * @since 10
17261847f8eSopenharmony_ci   */
17361847f8eSopenharmony_ci  function setPolicyByUid(uid: number, policy: NetUidPolicy): Promise<void>;
17461847f8eSopenharmony_ci
17561847f8eSopenharmony_ci  /**
17661847f8eSopenharmony_ci   * Query the policy of the specified UID.
17761847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
17861847f8eSopenharmony_ci   * @param { number } uid - the specified UID of application.
17961847f8eSopenharmony_ci   * @param { AsyncCallback<NetUidPolicy> } callback - the callback of getPolicyByUid.
18061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
18161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
18261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
18361847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
18461847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
18561847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
18661847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
18761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
18861847f8eSopenharmony_ci   * @since 10
18961847f8eSopenharmony_ci   */
19061847f8eSopenharmony_ci  function getPolicyByUid(uid: number, callback: AsyncCallback<NetUidPolicy>): void;
19161847f8eSopenharmony_ci
19261847f8eSopenharmony_ci  /**
19361847f8eSopenharmony_ci   * Query the policy of the specified UID.
19461847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
19561847f8eSopenharmony_ci   * @param { number } uid - the specified UID of application.
19661847f8eSopenharmony_ci   * @returns { Promise<NetUidPolicy> } The promise returned by the function.
19761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
19861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
19961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
20061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
20161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
20261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
20361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
20461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
20561847f8eSopenharmony_ci   * @since 10
20661847f8eSopenharmony_ci   */
20761847f8eSopenharmony_ci  function getPolicyByUid(uid: number): Promise<NetUidPolicy>;
20861847f8eSopenharmony_ci
20961847f8eSopenharmony_ci  /**
21061847f8eSopenharmony_ci   * Query the application UIDs of the specified policy.
21161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
21261847f8eSopenharmony_ci   * @param { NetUidPolicy } policy - the policy of the current UID of application.For details, see {@link NetUidPolicy}.
21361847f8eSopenharmony_ci   * @param { AsyncCallback<Array<number>> } callback - the callback of getUidsByPolicy.
21461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
21561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
21661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
21761847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
21861847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
21961847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
22061847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
22161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
22261847f8eSopenharmony_ci   * @since 10
22361847f8eSopenharmony_ci   */
22461847f8eSopenharmony_ci  function getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback<Array<number>>): void;
22561847f8eSopenharmony_ci
22661847f8eSopenharmony_ci  /**
22761847f8eSopenharmony_ci   * Query the application UIDs of the specified policy.
22861847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
22961847f8eSopenharmony_ci   * @param { NetUidPolicy } policy - the policy of the current UID of application.For details, see {@link NetUidPolicy}.
23061847f8eSopenharmony_ci   * @returns { Promise<Array<number>> } The promise returned by the function.
23161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
23261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
23361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
23461847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
23561847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
23661847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
23761847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
23861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
23961847f8eSopenharmony_ci   * @since 10
24061847f8eSopenharmony_ci   */
24161847f8eSopenharmony_ci  function getUidsByPolicy(policy: NetUidPolicy): Promise<Array<number>>;
24261847f8eSopenharmony_ci
24361847f8eSopenharmony_ci  /**
24461847f8eSopenharmony_ci   * Get the status whether the uid app can access the metered network or non-metered network.
24561847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
24661847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
24761847f8eSopenharmony_ci   * @param { boolean } isMetered - Indicates metered network or non-metered network.
24861847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - the callback of isUidNetAllowed.
24961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
25061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
25161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
25261847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
25361847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
25461847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
25561847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
25661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
25761847f8eSopenharmony_ci   * @since 10
25861847f8eSopenharmony_ci   */
25961847f8eSopenharmony_ci  function isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback<boolean>): void;
26061847f8eSopenharmony_ci
26161847f8eSopenharmony_ci  /**
26261847f8eSopenharmony_ci   * Get the status whether the uid app can access the metered network or non-metered network.
26361847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
26461847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
26561847f8eSopenharmony_ci   * @param { boolean } isMetered - Indicates metered network or non-metered network.
26661847f8eSopenharmony_ci   * @returns { Promise<boolean> } The promise returned by the function.
26761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
26861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
26961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
27061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
27161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
27261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error. 
27361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
27461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
27561847f8eSopenharmony_ci   * @since 10
27661847f8eSopenharmony_ci   */
27761847f8eSopenharmony_ci  function isUidNetAllowed(uid: number, isMetered: boolean): Promise<boolean>;
27861847f8eSopenharmony_ci
27961847f8eSopenharmony_ci  /**
28061847f8eSopenharmony_ci   * Get the status of whether the specified uid can access the specified network.
28161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
28261847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
28361847f8eSopenharmony_ci   * @param { string } iface - The specified network interface name.
28461847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - the callback of isUidNetAllowed.
28561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
28661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
28761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
28861847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
28961847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
29061847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
29161847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
29261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
29361847f8eSopenharmony_ci   * @since 10
29461847f8eSopenharmony_ci   */
29561847f8eSopenharmony_ci  function isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback<boolean>): void;
29661847f8eSopenharmony_ci
29761847f8eSopenharmony_ci  /**
29861847f8eSopenharmony_ci   * Get the status of whether the specified uid can access the specified network.
29961847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
30061847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
30161847f8eSopenharmony_ci   * @param { string } iface - The specified network interface name.
30261847f8eSopenharmony_ci   * @returns { Promise<boolean> } The promise returned by the function.
30361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
30461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
30561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
30661847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
30761847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
30861847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
30961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
31061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
31161847f8eSopenharmony_ci   * @since 10
31261847f8eSopenharmony_ci   */
31361847f8eSopenharmony_ci  function isUidNetAllowed(uid: number, iface: string): Promise<boolean>;
31461847f8eSopenharmony_ci
31561847f8eSopenharmony_ci  /**
31661847f8eSopenharmony_ci   * Set metered network quota policies.
31761847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
31861847f8eSopenharmony_ci   * @param { Array<NetQuotaPolicy> } quotaPolicies - Indicates {@link NetQuotaPolicy}.
31961847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of setNetQuotaPolicies.
32061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
32161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
32261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
32361847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
32461847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
32561847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
32661847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
32761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
32861847f8eSopenharmony_ci   * @since 10
32961847f8eSopenharmony_ci   */
33061847f8eSopenharmony_ci  function setNetQuotaPolicies(quotaPolicies: Array<NetQuotaPolicy>, callback: AsyncCallback<void>): void;
33161847f8eSopenharmony_ci
33261847f8eSopenharmony_ci  /**
33361847f8eSopenharmony_ci   * Set metered network quota policies.
33461847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
33561847f8eSopenharmony_ci   * @param { Array<NetQuotaPolicy> } quotaPolicies - Indicates {@link NetQuotaPolicy}.
33661847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
33761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
33861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
33961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
34061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
34161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
34261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
34361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
34461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
34561847f8eSopenharmony_ci   * @since 10
34661847f8eSopenharmony_ci   */
34761847f8eSopenharmony_ci  function setNetQuotaPolicies(quotaPolicies: Array<NetQuotaPolicy>): Promise<void>;
34861847f8eSopenharmony_ci
34961847f8eSopenharmony_ci  /**
35061847f8eSopenharmony_ci   * Get metered network quota policies.
35161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
35261847f8eSopenharmony_ci   * @param { AsyncCallback<Array<NetQuotaPolicy>> } callback - the callback of getNetQuotaPolicies.
35361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
35461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
35561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
35661847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
35761847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
35861847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
35961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
36061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
36161847f8eSopenharmony_ci   * @since 10
36261847f8eSopenharmony_ci   */
36361847f8eSopenharmony_ci  function getNetQuotaPolicies(callback: AsyncCallback<Array<NetQuotaPolicy>>): void;
36461847f8eSopenharmony_ci
36561847f8eSopenharmony_ci  /**
36661847f8eSopenharmony_ci   * Get metered network quota policies.
36761847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
36861847f8eSopenharmony_ci   * @returns { Promise<Array<NetQuotaPolicy>> } The promise returned by the function.
36961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
37061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
37161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
37261847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
37361847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
37461847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
37561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
37661847f8eSopenharmony_ci   * @since 10
37761847f8eSopenharmony_ci   */
37861847f8eSopenharmony_ci  function getNetQuotaPolicies(): Promise<Array<NetQuotaPolicy>>;
37961847f8eSopenharmony_ci
38061847f8eSopenharmony_ci  /**
38161847f8eSopenharmony_ci   * Update the policy when the quota reaches the upper limit.
38261847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
38361847f8eSopenharmony_ci   * @param { NetBearType } netType - {@link NetBearType}.
38461847f8eSopenharmony_ci   * @param { string } simId - Specify the matched simId of quota policy when netType is cellular.
38561847f8eSopenharmony_ci   * @param { RemindType } remindType - {@link RemindType}.
38661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of updateRemindPolicy.
38761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
38861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
38961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
39061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
39161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
39261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
39361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
39461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
39561847f8eSopenharmony_ci   * @since 10
39661847f8eSopenharmony_ci   */
39761847f8eSopenharmony_ci  function updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType, callback: AsyncCallback<void>): void;
39861847f8eSopenharmony_ci
39961847f8eSopenharmony_ci  /**
40061847f8eSopenharmony_ci   * Update the policy when the quota reaches the upper limit.
40161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
40261847f8eSopenharmony_ci   * @param { NetBearType } netType - {@link NetBearType}.
40361847f8eSopenharmony_ci   * @param { string } simId - Specify the matched simId of quota policy when netType is cellular.
40461847f8eSopenharmony_ci   * @param { RemindType } remindType - {@link RemindType}.
40561847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
40661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
40761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
40861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
40961847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
41061847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
41161847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
41261847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
41361847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
41461847f8eSopenharmony_ci   * @since 10
41561847f8eSopenharmony_ci   */
41661847f8eSopenharmony_ci  function updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType): Promise<void>;
41761847f8eSopenharmony_ci
41861847f8eSopenharmony_ci  /**
41961847f8eSopenharmony_ci   * Set the list of uids that are allowed to access the Internet in hibernation mode.
42061847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
42161847f8eSopenharmony_ci   * @param { Array<number> } uids - The specified uids of application.
42261847f8eSopenharmony_ci   * @param { boolean } isAllowed - Whether to allow Uids in the list to access the Internet.
42361847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of setDeviceIdleTrustlist.
42461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
42561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
42661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
42761847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
42861847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
42961847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
43061847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
43161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
43261847f8eSopenharmony_ci   * @since 10
43361847f8eSopenharmony_ci   */
43461847f8eSopenharmony_ci  function setDeviceIdleTrustlist(uids: Array<number>, isAllowed: boolean, callback: AsyncCallback<void>): void;
43561847f8eSopenharmony_ci
43661847f8eSopenharmony_ci  /**
43761847f8eSopenharmony_ci   * Set the list of uids that are allowed to access the Internet in hibernation mode.
43861847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
43961847f8eSopenharmony_ci   * @param { Array<number> } uids - The specified uids of application.
44061847f8eSopenharmony_ci   * @param { boolean } isAllowed - Whether to allow Uids in the list to access the Internet.
44161847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
44261847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
44361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
44461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
44561847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
44661847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
44761847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
44861847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
44961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
45061847f8eSopenharmony_ci   * @since 10
45161847f8eSopenharmony_ci   */
45261847f8eSopenharmony_ci  function setDeviceIdleTrustlist(uids: Array<number>, isAllowed: boolean): Promise<void>;
45361847f8eSopenharmony_ci
45461847f8eSopenharmony_ci  /**
45561847f8eSopenharmony_ci   * Obtain the list of uids that are allowed to access the Internet in hibernation mode.
45661847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
45761847f8eSopenharmony_ci   * @param { AsyncCallback<Array<number>> } callback - the callback of getDeviceIdleTrustlist.
45861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
45961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
46061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
46161847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
46261847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
46361847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
46461847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
46561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
46661847f8eSopenharmony_ci   * @since 10
46761847f8eSopenharmony_ci   */
46861847f8eSopenharmony_ci  function getDeviceIdleTrustlist(callback: AsyncCallback<Array<number>>): void;
46961847f8eSopenharmony_ci
47061847f8eSopenharmony_ci  /**
47161847f8eSopenharmony_ci   * Obtain the list of uids that are allowed to access the Internet in hibernation mode.
47261847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
47361847f8eSopenharmony_ci   * @returns { Promise<Array<number>> } The promise returned by the function.
47461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
47561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
47661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
47761847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
47861847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
47961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
48061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
48161847f8eSopenharmony_ci   * @since 10
48261847f8eSopenharmony_ci   */
48361847f8eSopenharmony_ci  function getDeviceIdleTrustlist(): Promise<Array<number>>;
48461847f8eSopenharmony_ci
48561847f8eSopenharmony_ci  /**
48661847f8eSopenharmony_ci   * Set the list of uids that are allowed to access the Internet in power saving mode.
48761847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
48861847f8eSopenharmony_ci   * @param { Array<number> } uids - The specified uids of application.
48961847f8eSopenharmony_ci   * @param { boolean } isAllowed - Whether to allow Uids in the list to access the Internet.
49061847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of setPowerSaveTrustlist.
49161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
49261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
49361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
49461847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
49561847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
49661847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
49761847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
49861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
49961847f8eSopenharmony_ci   * @since 10
50061847f8eSopenharmony_ci   */
50161847f8eSopenharmony_ci  function setPowerSaveTrustlist(uids: Array<number>, isAllowed: boolean, callback: AsyncCallback<void>): void;
50261847f8eSopenharmony_ci
50361847f8eSopenharmony_ci  /**
50461847f8eSopenharmony_ci   * Set the list of uids that are allowed to access the Internet in power saving mode.
50561847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
50661847f8eSopenharmony_ci   * @param { Array<number> } uids - The specified uids of application.
50761847f8eSopenharmony_ci   * @param { boolean } isAllowed - Whether to allow Uids in the list to access the Internet.
50861847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
50961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
51061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
51161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
51261847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
51361847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
51461847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
51561847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
51661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
51761847f8eSopenharmony_ci   * @since 10
51861847f8eSopenharmony_ci   */
51961847f8eSopenharmony_ci  function setPowerSaveTrustlist(uids: Array<number>, isAllowed: boolean): Promise<void>;
52061847f8eSopenharmony_ci
52161847f8eSopenharmony_ci  /**
52261847f8eSopenharmony_ci   * Obtain the list of uids that are allowed to access the Internet in power saving mode.
52361847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
52461847f8eSopenharmony_ci   * @param { AsyncCallback<Array<number>> } callback - the callback of UIDs list.
52561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
52661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
52761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
52861847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
52961847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
53061847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
53161847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
53261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
53361847f8eSopenharmony_ci   * @since 10
53461847f8eSopenharmony_ci   */
53561847f8eSopenharmony_ci  function getPowerSaveTrustlist(callback: AsyncCallback<Array<number>>): void;
53661847f8eSopenharmony_ci
53761847f8eSopenharmony_ci  /**
53861847f8eSopenharmony_ci   * Obtain the list of uids that are allowed to access the Internet in power saving mode.
53961847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
54061847f8eSopenharmony_ci   * @returns { Promise<Array<number>> } The promise returned by the function.
54161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
54261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
54361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
54461847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
54561847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
54661847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
54761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
54861847f8eSopenharmony_ci   * @since 10
54961847f8eSopenharmony_ci   */
55061847f8eSopenharmony_ci  function getPowerSaveTrustlist(): Promise<Array<number>>;
55161847f8eSopenharmony_ci
55261847f8eSopenharmony_ci  /**
55361847f8eSopenharmony_ci   * Reset network policies\rules\quota policies\firewall rules.
55461847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
55561847f8eSopenharmony_ci   * @param { string } simId - Specify the matched simId of quota policy.
55661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of resetPolicies.
55761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
55861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
55961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
56061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
56161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
56261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
56361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
56461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
56561847f8eSopenharmony_ci   * @since 10
56661847f8eSopenharmony_ci   */
56761847f8eSopenharmony_ci  function resetPolicies(simId: string, callback: AsyncCallback<void>): void;
56861847f8eSopenharmony_ci
56961847f8eSopenharmony_ci  /**
57061847f8eSopenharmony_ci   * Reset network policies\rules\quota policies\firewall rules.
57161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
57261847f8eSopenharmony_ci   * @param { string } simId - Specify the matched simId of quota policy.
57361847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
57461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
57561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
57661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
57761847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
57861847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
57961847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
58061847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
58161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
58261847f8eSopenharmony_ci   * @since 10
58361847f8eSopenharmony_ci   */
58461847f8eSopenharmony_ci  function resetPolicies(simId: string): Promise<void>;
58561847f8eSopenharmony_ci
58661847f8eSopenharmony_ci  /**
58761847f8eSopenharmony_ci   * Set the policy to access the network of the specified application.
58861847f8eSopenharmony_ci   *
58961847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
59061847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
59161847f8eSopenharmony_ci   * @param { NetworkAccessPolicy } policy - The network access policy of application. For details, see {@link NetworkAccessPolicy}.
59261847f8eSopenharmony_ci   * @param { boolean } [isReconfirmed] - Whether this operation is reconfirmed by user or not. Default false.
59361847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
59461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
59561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
59661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
59761847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
59861847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
59961847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
60061847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
60161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
60261847f8eSopenharmony_ci   * @since 12
60361847f8eSopenharmony_ci   */
60461847f8eSopenharmony_ci  function setNetworkAccessPolicy(uid: number, policy: NetworkAccessPolicy, isReconfirmed?: boolean): Promise<void>;
60561847f8eSopenharmony_ci
60661847f8eSopenharmony_ci  /**
60761847f8eSopenharmony_ci   * Query the network access policy of the specified application.
60861847f8eSopenharmony_ci   *
60961847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
61061847f8eSopenharmony_ci   * @param { number } uid - The specified UID of application.
61161847f8eSopenharmony_ci   * @returns { Promise<NetworkAccessPolicy> } Returns the network access policy of the application. For details, see {@link NetworkAccessPolicy}.
61261847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
61361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
61461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
61561847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
61661847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
61761847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
61861847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
61961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
62061847f8eSopenharmony_ci   * @since 12
62161847f8eSopenharmony_ci   */
62261847f8eSopenharmony_ci  function getNetworkAccessPolicy(uid: number): Promise<NetworkAccessPolicy>;
62361847f8eSopenharmony_ci
62461847f8eSopenharmony_ci  /**
62561847f8eSopenharmony_ci   * Query the network access policy of all applications.
62661847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
62761847f8eSopenharmony_ci   * @returns { Promise<UidNetworkAccessPolicy> } the network access policy of all applications.
62861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
62961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
63061847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
63161847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
63261847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
63361847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
63461847f8eSopenharmony_ci   * @since 12
63561847f8eSopenharmony_ci   */
63661847f8eSopenharmony_ci  function getNetworkAccessPolicy(): Promise<UidNetworkAccessPolicy>;
63761847f8eSopenharmony_ci
63861847f8eSopenharmony_ci  /**
63961847f8eSopenharmony_ci   * Register uid policy change listener.
64061847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
64161847f8eSopenharmony_ci   * @param { 'netUidPolicyChange' } type - Indicates Event name.
64261847f8eSopenharmony_ci   * @param { Callback<{ uid: number, policy: NetUidPolicy }> } callback - the callback of on.
64361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
64461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
64561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
64661847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
64761847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
64861847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
64961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
65061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
65161847f8eSopenharmony_ci   * @since 10
65261847f8eSopenharmony_ci   */
65361847f8eSopenharmony_ci  /**
65461847f8eSopenharmony_ci   * Register uid policy change listener.
65561847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
65661847f8eSopenharmony_ci   * @param { 'netUidPolicyChange' } type - Indicates Event name.
65761847f8eSopenharmony_ci   * @param { Callback<NetUidPolicyInfo> } callback - the callback of on.
65861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
65961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
66061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
66161847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
66261847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
66361847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
66461847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
66561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
66661847f8eSopenharmony_ci   * @since 11
66761847f8eSopenharmony_ci   */
66861847f8eSopenharmony_ci  function on(type: 'netUidPolicyChange', callback: Callback<NetUidPolicyInfo>): void;
66961847f8eSopenharmony_ci
67061847f8eSopenharmony_ci  /**
67161847f8eSopenharmony_ci   * Unregister uid policy change listener.
67261847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
67361847f8eSopenharmony_ci   * @param { 'netUidPolicyChange' } type - Indicates Event name.
67461847f8eSopenharmony_ci   * @param { Callback<{ uid: number, policy: NetUidPolicy }> } callback - the callback of off.
67561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
67661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
67761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
67861847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
67961847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
68061847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
68161847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
68261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
68361847f8eSopenharmony_ci   * @since 10
68461847f8eSopenharmony_ci   */
68561847f8eSopenharmony_ci  /**
68661847f8eSopenharmony_ci   * Unregister uid policy change listener.
68761847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
68861847f8eSopenharmony_ci   * @param { 'netUidPolicyChange' } type - Indicates Event name.
68961847f8eSopenharmony_ci   * @param { Callback<NetUidPolicyInfo> } callback - the callback of off.
69061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
69161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
69261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
69361847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
69461847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
69561847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
69661847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
69761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
69861847f8eSopenharmony_ci   * @since 11
69961847f8eSopenharmony_ci   */
70061847f8eSopenharmony_ci  function off(type: 'netUidPolicyChange', callback?: Callback<NetUidPolicyInfo>): void;
70161847f8eSopenharmony_ci
70261847f8eSopenharmony_ci  /**
70361847f8eSopenharmony_ci   * Register uid rule change listener.
70461847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
70561847f8eSopenharmony_ci   * @param { 'netUidRuleChange' } type - Indicates Event name.
70661847f8eSopenharmony_ci   * @param { Callback<{ uid: number, rule: NetUidRule }> } callback - the callback of on.
70761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
70861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
70961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
71061847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
71161847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
71261847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
71361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
71461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
71561847f8eSopenharmony_ci   * @since 10
71661847f8eSopenharmony_ci   */
71761847f8eSopenharmony_ci  /**
71861847f8eSopenharmony_ci   * Register uid rule change listener.
71961847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
72061847f8eSopenharmony_ci   * @param { 'netUidRuleChange' } type - Indicates Event name.
72161847f8eSopenharmony_ci   * @param { Callback<NetUidRuleInfo> } callback - the callback of on.
72261847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
72361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
72461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
72561847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
72661847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
72761847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
72861847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
72961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
73061847f8eSopenharmony_ci   * @since 11
73161847f8eSopenharmony_ci   */
73261847f8eSopenharmony_ci  function on(type: 'netUidRuleChange', callback: Callback<NetUidRuleInfo>): void;
73361847f8eSopenharmony_ci
73461847f8eSopenharmony_ci  /**
73561847f8eSopenharmony_ci   * Unregister uid rule change listener.
73661847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
73761847f8eSopenharmony_ci   * @param { 'netUidRuleChange' } type - Indicates Event name.
73861847f8eSopenharmony_ci   * @param { Callback<{ uid: number, rule: NetUidRule }> } callback - the callback of off.
73961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
74061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
74161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
74261847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
74361847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
74461847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
74561847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
74661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
74761847f8eSopenharmony_ci   * @since 10
74861847f8eSopenharmony_ci   */
74961847f8eSopenharmony_ci  /**
75061847f8eSopenharmony_ci   * Unregister uid rule change listener.
75161847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
75261847f8eSopenharmony_ci   * @param { 'netUidRuleChange' } type - Indicates Event name.
75361847f8eSopenharmony_ci   * @param { Callback<NetUidRuleInfo> } callback - the callback of off.
75461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
75561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
75661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
75761847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
75861847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
75961847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
76061847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
76161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
76261847f8eSopenharmony_ci   * @since 11
76361847f8eSopenharmony_ci   */
76461847f8eSopenharmony_ci  function off(type: 'netUidRuleChange', callback?: Callback<NetUidRuleInfo>): void;
76561847f8eSopenharmony_ci
76661847f8eSopenharmony_ci  /**
76761847f8eSopenharmony_ci   * Register metered ifaces change listener.
76861847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
76961847f8eSopenharmony_ci   * @param { 'netMeteredIfacesChange' } type - Indicates Event name.
77061847f8eSopenharmony_ci   * @param { Callback<Array<string>> } callback - the callback of on.
77161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
77261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
77361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
77461847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
77561847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
77661847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
77761847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
77861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
77961847f8eSopenharmony_ci   * @since 10
78061847f8eSopenharmony_ci   */
78161847f8eSopenharmony_ci  function on(type: 'netMeteredIfacesChange', callback: Callback<Array<string>>): void;
78261847f8eSopenharmony_ci
78361847f8eSopenharmony_ci  /**
78461847f8eSopenharmony_ci   * Unregister metered ifaces change listener.
78561847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
78661847f8eSopenharmony_ci   * @param { 'netMeteredIfacesChange' } type - Indicates Event name.
78761847f8eSopenharmony_ci   * @param { Callback<Array<string>> } callback - the callback of off.
78861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
78961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
79061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
79161847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
79261847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
79361847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
79461847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
79561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
79661847f8eSopenharmony_ci   * @since 10
79761847f8eSopenharmony_ci   */
79861847f8eSopenharmony_ci  function off(type: 'netMeteredIfacesChange', callback?: Callback<Array<string>>): void;
79961847f8eSopenharmony_ci
80061847f8eSopenharmony_ci  /**
80161847f8eSopenharmony_ci   * Register quota policies change listener.
80261847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
80361847f8eSopenharmony_ci   * @param { 'netQuotaPolicyChange' } type - Indicates Event name.
80461847f8eSopenharmony_ci   * @param { Callback<Array<NetQuotaPolicy>> } callback the callback of on.
80561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
80661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
80761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
80861847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
80961847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
81061847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
81161847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
81261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
81361847f8eSopenharmony_ci   * @since 10
81461847f8eSopenharmony_ci   */
81561847f8eSopenharmony_ci  function on(type: 'netQuotaPolicyChange', callback: Callback<Array<NetQuotaPolicy>>): void;
81661847f8eSopenharmony_ci
81761847f8eSopenharmony_ci  /**
81861847f8eSopenharmony_ci   * Unregister quota policies change listener.
81961847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
82061847f8eSopenharmony_ci   * @param { 'netQuotaPolicyChange' } type - Indicates Event name.
82161847f8eSopenharmony_ci   * @param { Callback<Array<NetQuotaPolicy>> } callback - the callback of off.
82261847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
82361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
82461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
82561847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
82661847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
82761847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
82861847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
82961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
83061847f8eSopenharmony_ci   * @since 10
83161847f8eSopenharmony_ci   */
83261847f8eSopenharmony_ci  function off(type: 'netQuotaPolicyChange', callback?: Callback<Array<NetQuotaPolicy>>): void;
83361847f8eSopenharmony_ci
83461847f8eSopenharmony_ci  /**
83561847f8eSopenharmony_ci   * Register network background policy change listener.
83661847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
83761847f8eSopenharmony_ci   * @param { 'netBackgroundPolicyChange' } type - Indicates Event name.
83861847f8eSopenharmony_ci   * @param { Callback<boolean> } callback - the callback of on. 
83961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
84061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
84161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
84261847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
84361847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
84461847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
84561847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
84661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
84761847f8eSopenharmony_ci   * @since 10
84861847f8eSopenharmony_ci   */
84961847f8eSopenharmony_ci  function on(type: 'netBackgroundPolicyChange', callback: Callback<boolean>): void;
85061847f8eSopenharmony_ci
85161847f8eSopenharmony_ci  /**
85261847f8eSopenharmony_ci   * Unregister network background policy change listener.
85361847f8eSopenharmony_ci   * @permission ohos.permission.MANAGE_NET_STRATEGY
85461847f8eSopenharmony_ci   * @param { 'netBackgroundPolicyChange' } type - Indicates Event name.
85561847f8eSopenharmony_ci   * @param { Callback<boolean> } callback - the callback of off.
85661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
85761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
85861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error.
85961847f8eSopenharmony_ci   * @throws { BusinessError } 2100001 - Invalid parameter value.
86061847f8eSopenharmony_ci   * @throws { BusinessError } 2100002 - Failed to connect to the service.
86161847f8eSopenharmony_ci   * @throws { BusinessError } 2100003 - System internal error.
86261847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
86361847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
86461847f8eSopenharmony_ci   * @since 10
86561847f8eSopenharmony_ci   */
86661847f8eSopenharmony_ci  function off(type: 'netBackgroundPolicyChange', callback?: Callback<boolean>): void;
86761847f8eSopenharmony_ci
86861847f8eSopenharmony_ci  /**
86961847f8eSopenharmony_ci   * Indicate whether the application can use metered networks in background.
87061847f8eSopenharmony_ci   * @enum {number}
87161847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
87261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
87361847f8eSopenharmony_ci   * @since 10
87461847f8eSopenharmony_ci   */
87561847f8eSopenharmony_ci  export enum NetBackgroundPolicy {
87661847f8eSopenharmony_ci    /**
87761847f8eSopenharmony_ci     * Default value.
87861847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
87961847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
88061847f8eSopenharmony_ci     * @since 10
88161847f8eSopenharmony_ci     */
88261847f8eSopenharmony_ci    NET_BACKGROUND_POLICY_NONE = 0,
88361847f8eSopenharmony_ci
88461847f8eSopenharmony_ci    /**
88561847f8eSopenharmony_ci     * Apps can use metered networks on background.
88661847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
88761847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
88861847f8eSopenharmony_ci     * @since 10
88961847f8eSopenharmony_ci     */
89061847f8eSopenharmony_ci    NET_BACKGROUND_POLICY_ENABLE = 1,
89161847f8eSopenharmony_ci
89261847f8eSopenharmony_ci    /**
89361847f8eSopenharmony_ci     * Apps can't use metered networks on background.
89461847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
89561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
89661847f8eSopenharmony_ci     * @since 10
89761847f8eSopenharmony_ci     */
89861847f8eSopenharmony_ci    NET_BACKGROUND_POLICY_DISABLE = 2,
89961847f8eSopenharmony_ci
90061847f8eSopenharmony_ci    /**
90161847f8eSopenharmony_ci     * Only apps in trustlist can use metered networks on background.
90261847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
90361847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
90461847f8eSopenharmony_ci     * @since 10
90561847f8eSopenharmony_ci     */
90661847f8eSopenharmony_ci    NET_BACKGROUND_POLICY_TRUSTLIST = 3,
90761847f8eSopenharmony_ci  }
90861847f8eSopenharmony_ci
90961847f8eSopenharmony_ci  /**
91061847f8eSopenharmony_ci   * Net quota policies, including matching network rule usage periods, restrictions, and warnings.
91161847f8eSopenharmony_ci   * @interface NetQuotaPolicy
91261847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
91361847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
91461847f8eSopenharmony_ci   * @since 10
91561847f8eSopenharmony_ci   */
91661847f8eSopenharmony_ci  export interface NetQuotaPolicy {
91761847f8eSopenharmony_ci    /**
91861847f8eSopenharmony_ci     * The matching rules of network quota policies.
91961847f8eSopenharmony_ci     * @type {NetworkMatchRule}
92061847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
92161847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
92261847f8eSopenharmony_ci     * @since 10
92361847f8eSopenharmony_ci     */
92461847f8eSopenharmony_ci    networkMatchRule: NetworkMatchRule;
92561847f8eSopenharmony_ci
92661847f8eSopenharmony_ci    /**
92761847f8eSopenharmony_ci     * Policies that limit network quota.
92861847f8eSopenharmony_ci     * @type {QuotaPolicy}
92961847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
93061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
93161847f8eSopenharmony_ci     * @since 10
93261847f8eSopenharmony_ci     */
93361847f8eSopenharmony_ci    quotaPolicy: QuotaPolicy;
93461847f8eSopenharmony_ci  }
93561847f8eSopenharmony_ci
93661847f8eSopenharmony_ci  /**
93761847f8eSopenharmony_ci   * Policies that limit network quota.
93861847f8eSopenharmony_ci   * @interface QuotaPolicy
93961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
94061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
94161847f8eSopenharmony_ci   * @since 10
94261847f8eSopenharmony_ci   */
94361847f8eSopenharmony_ci  export interface QuotaPolicy {
94461847f8eSopenharmony_ci    /**
94561847f8eSopenharmony_ci     * The period and the start time for quota policy, default: "M1" (Monthly cycle).
94661847f8eSopenharmony_ci     * @type {string}
94761847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
94861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
94961847f8eSopenharmony_ci     * @since 10
95061847f8eSopenharmony_ci     */
95161847f8eSopenharmony_ci    periodDuration: string;
95261847f8eSopenharmony_ci
95361847f8eSopenharmony_ci    /**
95461847f8eSopenharmony_ci     * The warning threshold of traffic, default:  DATA_USAGE_UNKNOWN.
95561847f8eSopenharmony_ci     * @type {number}
95661847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
95761847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
95861847f8eSopenharmony_ci     * @since 10
95961847f8eSopenharmony_ci     */
96061847f8eSopenharmony_ci    warningBytes: number;
96161847f8eSopenharmony_ci
96261847f8eSopenharmony_ci    /**
96361847f8eSopenharmony_ci     * The limit threshold of traffic, default: DATA_USAGE_UNKNOWN.
96461847f8eSopenharmony_ci     * @type {number}
96561847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
96661847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
96761847f8eSopenharmony_ci     * @since 10
96861847f8eSopenharmony_ci     */
96961847f8eSopenharmony_ci    limitBytes: number;
97061847f8eSopenharmony_ci
97161847f8eSopenharmony_ci    /**
97261847f8eSopenharmony_ci     * Is metered network or not.
97361847f8eSopenharmony_ci     * @type {boolean}
97461847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
97561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
97661847f8eSopenharmony_ci     * @since 10
97761847f8eSopenharmony_ci     */
97861847f8eSopenharmony_ci    metered: boolean;
97961847f8eSopenharmony_ci
98061847f8eSopenharmony_ci    /**
98161847f8eSopenharmony_ci     * The action while the used bytes reach the limit, see {@link LimitAction}.
98261847f8eSopenharmony_ci     * @type {LimitAction}
98361847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
98461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
98561847f8eSopenharmony_ci     * @since 10
98661847f8eSopenharmony_ci     */
98761847f8eSopenharmony_ci    limitAction: LimitAction;
98861847f8eSopenharmony_ci
98961847f8eSopenharmony_ci    /**
99061847f8eSopenharmony_ci     * The time of the last warning reminder. For notifying only, default: REMIND_NEVER.
99161847f8eSopenharmony_ci     * @type {?number}
99261847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
99361847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
99461847f8eSopenharmony_ci     * @since 10
99561847f8eSopenharmony_ci     */
99661847f8eSopenharmony_ci    lastWarningRemind?: number;
99761847f8eSopenharmony_ci
99861847f8eSopenharmony_ci    /**
99961847f8eSopenharmony_ci     * The time of the last limit reminder. For notifying only, default: REMIND_NEVER.
100061847f8eSopenharmony_ci     * @type {?number}
100161847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
100261847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
100361847f8eSopenharmony_ci     * @since 10
100461847f8eSopenharmony_ci     */
100561847f8eSopenharmony_ci    lastLimitRemind?: number;
100661847f8eSopenharmony_ci  }
100761847f8eSopenharmony_ci
100861847f8eSopenharmony_ci  /**
100961847f8eSopenharmony_ci   * The matching rules of network quota policies.
101061847f8eSopenharmony_ci   * @interface NetworkMatchRule
101161847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
101261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
101361847f8eSopenharmony_ci   * @since 10
101461847f8eSopenharmony_ci   */
101561847f8eSopenharmony_ci  export interface NetworkMatchRule {
101661847f8eSopenharmony_ci    /**
101761847f8eSopenharmony_ci     * netType see {@link NetBearType}.
101861847f8eSopenharmony_ci     * @type {NetBearType}
101961847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
102061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
102161847f8eSopenharmony_ci     * @since 10
102261847f8eSopenharmony_ci     */
102361847f8eSopenharmony_ci    netType: NetBearType;
102461847f8eSopenharmony_ci
102561847f8eSopenharmony_ci    /**
102661847f8eSopenharmony_ci     * To specify the identity of network, such as different WLAN.
102761847f8eSopenharmony_ci     * @type {string}
102861847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
102961847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
103061847f8eSopenharmony_ci     * @since 10
103161847f8eSopenharmony_ci     */
103261847f8eSopenharmony_ci    identity: string;
103361847f8eSopenharmony_ci
103461847f8eSopenharmony_ci    /**
103561847f8eSopenharmony_ci     * The ID of the target card, valid when netType is BEARER_CELLULAR.
103661847f8eSopenharmony_ci     * @type {string}
103761847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
103861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
103961847f8eSopenharmony_ci     * @since 10
104061847f8eSopenharmony_ci     */
104161847f8eSopenharmony_ci    simId: string;
104261847f8eSopenharmony_ci  }
104361847f8eSopenharmony_ci
104461847f8eSopenharmony_ci  /**
104561847f8eSopenharmony_ci   * The interface is used to generate network unique identifiers.
104661847f8eSopenharmony_ci   * @interface NetUidRuleInfo
104761847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
104861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
104961847f8eSopenharmony_ci   * @since 11
105061847f8eSopenharmony_ci   */
105161847f8eSopenharmony_ci  export interface NetUidRuleInfo {
105261847f8eSopenharmony_ci    /**
105361847f8eSopenharmony_ci     * The warning threshold of traffic, default:  DATA_USAGE_UNKNOWN.
105461847f8eSopenharmony_ci     * @type { number }
105561847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
105661847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
105761847f8eSopenharmony_ci     * @since 11
105861847f8eSopenharmony_ci     */
105961847f8eSopenharmony_ci    uid: number;
106061847f8eSopenharmony_ci    /**
106161847f8eSopenharmony_ci     * Rules whether an uid can access to a metered or non-metered network.
106261847f8eSopenharmony_ci     * @type { NetUidRule }
106361847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
106461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
106561847f8eSopenharmony_ci     * @since 11
106661847f8eSopenharmony_ci     */
106761847f8eSopenharmony_ci    rule: NetUidRule;
106861847f8eSopenharmony_ci  }
106961847f8eSopenharmony_ci
107061847f8eSopenharmony_ci  /**
107161847f8eSopenharmony_ci   * Callback function for registering network UID policy changes.
107261847f8eSopenharmony_ci   * @interface NetUidPolicyInfo
107361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
107461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
107561847f8eSopenharmony_ci   * @since 11
107661847f8eSopenharmony_ci   */
107761847f8eSopenharmony_ci  export interface NetUidPolicyInfo {
107861847f8eSopenharmony_ci    /**
107961847f8eSopenharmony_ci     * The warning threshold of traffic, default:  DATA_USAGE_UNKNOWN.
108061847f8eSopenharmony_ci     * @type { number }
108161847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
108261847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
108361847f8eSopenharmony_ci     * @since 11
108461847f8eSopenharmony_ci     */
108561847f8eSopenharmony_ci    uid: number;
108661847f8eSopenharmony_ci    /**
108761847f8eSopenharmony_ci     * Uid Specifies the Internet access policy in background mode.
108861847f8eSopenharmony_ci     * @type { NetUidPolicy }
108961847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
109061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
109161847f8eSopenharmony_ci     * @since 11
109261847f8eSopenharmony_ci     */
109361847f8eSopenharmony_ci    policy: NetUidPolicy;
109461847f8eSopenharmony_ci  }
109561847f8eSopenharmony_ci
109661847f8eSopenharmony_ci  /**
109761847f8eSopenharmony_ci   * The action when quota policy hit the limit.
109861847f8eSopenharmony_ci   * @enum {number}
109961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
110061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
110161847f8eSopenharmony_ci   * @since 10
110261847f8eSopenharmony_ci   */
110361847f8eSopenharmony_ci  export enum LimitAction {
110461847f8eSopenharmony_ci    /**
110561847f8eSopenharmony_ci     * Default action, do nothing.
110661847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
110761847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
110861847f8eSopenharmony_ci     * @since 10
110961847f8eSopenharmony_ci     */
111061847f8eSopenharmony_ci    LIMIT_ACTION_NONE = -1,
111161847f8eSopenharmony_ci
111261847f8eSopenharmony_ci    /**
111361847f8eSopenharmony_ci     * When the quota policy reaches the limit, the system prohibits users from accessing the network.
111461847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
111561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
111661847f8eSopenharmony_ci     * @since 10
111761847f8eSopenharmony_ci     */
111861847f8eSopenharmony_ci    LIMIT_ACTION_ACCESS_DISABLED = 0,
111961847f8eSopenharmony_ci
112061847f8eSopenharmony_ci    /**
112161847f8eSopenharmony_ci     * When the quota policy reaches the upper limit, the system notifies the user.
112261847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
112361847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
112461847f8eSopenharmony_ci     * @since 10
112561847f8eSopenharmony_ci     */
112661847f8eSopenharmony_ci    LIMIT_ACTION_ALERT_ONLY = 1,
112761847f8eSopenharmony_ci  }
112861847f8eSopenharmony_ci
112961847f8eSopenharmony_ci  /**
113061847f8eSopenharmony_ci   * Rules whether an uid can access to a metered or non-metered network.
113161847f8eSopenharmony_ci   * @enum {number}
113261847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
113361847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
113461847f8eSopenharmony_ci   * @since 10
113561847f8eSopenharmony_ci   */
113661847f8eSopenharmony_ci  export enum NetUidRule {
113761847f8eSopenharmony_ci    /**
113861847f8eSopenharmony_ci     * Default uid rule.
113961847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
114061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
114161847f8eSopenharmony_ci     * @since 10
114261847f8eSopenharmony_ci     */
114361847f8eSopenharmony_ci    NET_RULE_NONE = 0,
114461847f8eSopenharmony_ci
114561847f8eSopenharmony_ci    /**
114661847f8eSopenharmony_ci     * Allow traffic on metered networks while app is foreground.
114761847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
114861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
114961847f8eSopenharmony_ci     * @since 10
115061847f8eSopenharmony_ci     */
115161847f8eSopenharmony_ci    NET_RULE_ALLOW_METERED_FOREGROUND = 1 << 0,
115261847f8eSopenharmony_ci
115361847f8eSopenharmony_ci    /**
115461847f8eSopenharmony_ci     * Allow traffic on metered network.
115561847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
115661847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
115761847f8eSopenharmony_ci     * @since 10
115861847f8eSopenharmony_ci     */
115961847f8eSopenharmony_ci    NET_RULE_ALLOW_METERED = 1 << 1,
116061847f8eSopenharmony_ci
116161847f8eSopenharmony_ci    /**
116261847f8eSopenharmony_ci     * Reject traffic on metered network.
116361847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
116461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
116561847f8eSopenharmony_ci     * @since 10
116661847f8eSopenharmony_ci     */
116761847f8eSopenharmony_ci    NET_RULE_REJECT_METERED = 1 << 2,
116861847f8eSopenharmony_ci
116961847f8eSopenharmony_ci    /**
117061847f8eSopenharmony_ci     * Allow traffic on all network (metered or non-metered).
117161847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
117261847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
117361847f8eSopenharmony_ci     * @since 10
117461847f8eSopenharmony_ci     */
117561847f8eSopenharmony_ci    NET_RULE_ALLOW_ALL = 1 << 5,
117661847f8eSopenharmony_ci
117761847f8eSopenharmony_ci    /**
117861847f8eSopenharmony_ci     * Reject traffic on all network.
117961847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
118061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
118161847f8eSopenharmony_ci     * @since 10
118261847f8eSopenharmony_ci     */
118361847f8eSopenharmony_ci    NET_RULE_REJECT_ALL = 1 << 6,
118461847f8eSopenharmony_ci  }
118561847f8eSopenharmony_ci
118661847f8eSopenharmony_ci  /**
118761847f8eSopenharmony_ci   * Specify the remind type, see {@link updateRemindPolicy}.
118861847f8eSopenharmony_ci   * @enum {number}
118961847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
119061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
119161847f8eSopenharmony_ci   * @since 10
119261847f8eSopenharmony_ci   */
119361847f8eSopenharmony_ci  export enum RemindType {
119461847f8eSopenharmony_ci    /**
119561847f8eSopenharmony_ci     * Warning alerts when the limit is reached.
119661847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
119761847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
119861847f8eSopenharmony_ci     * @since 10
119961847f8eSopenharmony_ci     */
120061847f8eSopenharmony_ci    REMIND_TYPE_WARNING = 1,
120161847f8eSopenharmony_ci
120261847f8eSopenharmony_ci    /**
120361847f8eSopenharmony_ci     * Limit alerts when the limit is reached.
120461847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
120561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
120661847f8eSopenharmony_ci     * @since 10
120761847f8eSopenharmony_ci     */
120861847f8eSopenharmony_ci    REMIND_TYPE_LIMIT = 2,
120961847f8eSopenharmony_ci  }
121061847f8eSopenharmony_ci
121161847f8eSopenharmony_ci  /**
121261847f8eSopenharmony_ci   * Uid Specifies the Internet access policy in background mode.
121361847f8eSopenharmony_ci   * @enum {number}
121461847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
121561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
121661847f8eSopenharmony_ci   * @since 10
121761847f8eSopenharmony_ci   */
121861847f8eSopenharmony_ci  export enum NetUidPolicy {
121961847f8eSopenharmony_ci    /**
122061847f8eSopenharmony_ci     * Default net policy.
122161847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
122261847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
122361847f8eSopenharmony_ci     * @since 10
122461847f8eSopenharmony_ci     */
122561847f8eSopenharmony_ci    NET_POLICY_NONE = 0,
122661847f8eSopenharmony_ci
122761847f8eSopenharmony_ci    /**
122861847f8eSopenharmony_ci     * Allow on metered networks when app in background.
122961847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
123061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
123161847f8eSopenharmony_ci     * @since 10
123261847f8eSopenharmony_ci     */
123361847f8eSopenharmony_ci    NET_POLICY_ALLOW_METERED_BACKGROUND = 1 << 0,
123461847f8eSopenharmony_ci
123561847f8eSopenharmony_ci    /**
123661847f8eSopenharmony_ci     * Reject on metered networks when app in background.
123761847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
123861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
123961847f8eSopenharmony_ci     * @since 10
124061847f8eSopenharmony_ci     */
124161847f8eSopenharmony_ci    NET_POLICY_REJECT_METERED_BACKGROUND = 1 << 1,
124261847f8eSopenharmony_ci  }
124361847f8eSopenharmony_ci
124461847f8eSopenharmony_ci  /**
124561847f8eSopenharmony_ci   * Network policies that limit the specified UID of application to access the network.
124661847f8eSopenharmony_ci   * @interface NetworkAccessPolicy
124761847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
124861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
124961847f8eSopenharmony_ci   * @since 12
125061847f8eSopenharmony_ci   */
125161847f8eSopenharmony_ci  export interface NetworkAccessPolicy {
125261847f8eSopenharmony_ci    /**
125361847f8eSopenharmony_ci     * Indicate whether the application can be allowed to access the network by wifi.
125461847f8eSopenharmony_ci     * @type { ?boolean }
125561847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
125661847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
125761847f8eSopenharmony_ci     * @since 12
125861847f8eSopenharmony_ci     */
125961847f8eSopenharmony_ci    allowWiFi?: boolean;
126061847f8eSopenharmony_ci    /**
126161847f8eSopenharmony_ci     * Indicate whether the application can be allowed to access the network by cellular.
126261847f8eSopenharmony_ci     * @type { ?boolean }
126361847f8eSopenharmony_ci     * @syscap SystemCapability.Communication.NetManager.Core
126461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
126561847f8eSopenharmony_ci     * @since 12
126661847f8eSopenharmony_ci     */
126761847f8eSopenharmony_ci    allowCellular?: boolean;
126861847f8eSopenharmony_ci  }
126961847f8eSopenharmony_ci
127061847f8eSopenharmony_ci  /**
127161847f8eSopenharmony_ci   * Provides the container definition for network access policy key-value pairs.
127261847f8eSopenharmony_ci   * @interface UidNetworkAccessPolicy
127361847f8eSopenharmony_ci   * @syscap SystemCapability.Communication.NetManager.Core
127461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
127561847f8eSopenharmony_ci   * @since 12
127661847f8eSopenharmony_ci   */
127761847f8eSopenharmony_ci  export interface UidNetworkAccessPolicy {
127861847f8eSopenharmony_ci      /**
127961847f8eSopenharmony_ci       * @type key:value pair. Key indicates the specified UID of an application. For value, see @NetworkAccessPolicy.
128061847f8eSopenharmony_ci       * @syscap SystemCapability.Communication.NetManager.Core
128161847f8eSopenharmony_ci       * @systemapi Hide this for inner system use.
128261847f8eSopenharmony_ci       * @since 12
128361847f8eSopenharmony_ci       */
128461847f8eSopenharmony_ci      [uid: string]: NetworkAccessPolicy;
128561847f8eSopenharmony_ci  }
128661847f8eSopenharmony_ci}
128761847f8eSopenharmony_ci
128861847f8eSopenharmony_ciexport default policy;
1289