Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Class Info |
|---|
public class HwSfpPolicyManager Contains various methods for setting and querying file protection policies and file risk levels. |
Qualifier and Type | Method Name and Description |
|---|---|
HwSfpPolicyManager | Obtains a HwSfpPolicyManager instance. |
int | setLabel(Context context, String filePath, String labelName, String labelValue, int flag) Sets a risk level and protection policy for a file. |
String | getLabel(Context context, String filePath, String labelName) Obtains the risk level of a file. |
int | getFlag(Context context, String filePath, String labelName) Obtains the flag information about a file risk level. |
Method |
|---|
public static HwSfpPolicyManager getDefault() Obtains a HwSfpPolicyManager instance. |
Return
Type | Description |
|---|---|
HwSfpPolicyManager | An existing instance (if initialized) or a new instance (if uninitialized). |
Throws
Name | Description |
|---|---|
NoExtAPIException | When the version is not compatible. |
Method |
|---|
public int setLabel(Context context, String filePath, String labelName, String labelValue, int flag) Sets a risk level and protection policy for a file. |
Parameters
Name | Description |
|---|---|
context | App context, which is used to obtain the file storage path and determine whether the path is a CE/DE path. |
filePath | File for which the risk level needs to be set. The format is filePath (absolute path+file name), for example, /data/user/0/com.tips.test/test1.txt. |
labelName | Classification label name. Currently, only HwSfpPolicyManager.LABEL_NAME_SECURITY_LEVEL is supported. |
labelValue | Label value, which can be S0, S1, S2, S3, or S4. For details about the label values, see Service Introduction. |
flag | Additional flag information about the label value. This parameter is valid only when labelValue is set to S3. The flag values are as follows:
|
Return
Type | Description |
|---|---|
int |
|
Throws
Name | Description |
|---|---|
NoExtAPIException | When the version is not compatible. |
Method |
|---|
public String getLabel(Context context, String filePath, String labelName) Obtains the risk level of a file. |
Parameters
Name | Description |
|---|---|
context | App context, which is used to obtain the file storage path and determine whether the path is a CE/DE path. |
filePath | File for which the risk level needs to be queried. The format is filePath (absolute path+file name), for example, /data/user/0/com.tips.test/test1.txt. |
labelName | Classification label name. Currently, only HwSfpPolicyManager.LABEL_NAME_SECURITY_LEVEL is supported. |
Return
Type | Description |
|---|---|
String |
For details about the label values, see Overview. |
Throws
Name | Description |
|---|---|
NoExtAPIException | When the version is not compatible. |
Method |
|---|
public int getFlag(Context context, String filePath, String labelName) Obtains the flag information about a file risk level. |
Parameters
Name | Description |
|---|---|
context | App context, which is used to obtain the file storage path and determine whether the path is a CE/DE path. |
filePath | File for which the risk level needs to be set. The format is filePath (absolute path+file name), for example, /data/user/0/com.tips.test/test1.txt. |
labelName | Classification label name. Currently, only HwSfpPolicyManager.LABEL_NAME_SECURITY_LEVEL is supported. |
Return
Type | Description |
|---|---|
int |
|
Throws
Name | Description |
|---|---|
NoExtAPIException | When the version is not compatible. |