public interface ISfpPolicyManager
SystemCapability.Security#DATACLASSFICATION_DATAFLAG| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getFlag(Context context,
String filePath,
String labelName) |
Obtains the label flag of a specified file.
|
String |
getLabel(Context context,
String filePath,
String labelName) |
Obtains the label of a specified file.
|
int |
setLabel(Context context,
String filePath,
String labelName,
String labelValue,
int flag) |
Sets a specified label for the given file to improve data security and privacy.
|
int setLabel(Context context, String filePath, String labelName, String labelValue, int flag)
context - Indicates the application context, from which you can obtain the file storage path and check
whether it is a Credential Encrypted (CE) or Device Encrypted (DE) storage path.filePath - Indicates the absolute path of the file.labelName - Indicates the label name, which can only be
SfpPolicyManager#LABEL_NAME_SECURITY_LEVEL currently.labelValue - Indicates the label value, which can be S0, S1, S2,
S3, or S4.flag - Indicates the flag of the label value. The flag can be either of the following
if labelValue is S3, and the flag can only be 0x0000 if labelValue is
S0, S1, S2, or S4):
0x0000: When the device is locked, the file cannot be opened, read, or written.0x0001: When the device is locked, the file can be read or written if it is opened,
but cannot be read or written if it has been closed, unless the device is unlocked.0: The label is set successfully.1: Any input parameter is invalid.2: A label has been set for this file.3: labelValue does not match the storage type in the application context.4: This method fails to be called.String getLabel(Context context, String filePath, String labelName)
context - Indicates the application context, from which you can obtain the file storage path
and check whether it is a CE or DE storage path.filePath - Indicates the absolute path of the file.labelName - Indicates the label name, which can only be
SfpPolicyManager#LABEL_NAME_SECURITY_LEVEL currently.int getFlag(Context context, String filePath, String labelName)
context - Indicates the application context, from which you can obtain the file storage path and check
whether it is a CE or DE storage path.filePath - Indicates the absolute path of the file.labelName - Indicates the label name, which can only be SfpPolicyManager#LABEL_NAME_SECURITY_LEVEL.-1: No label has been set for this file.0: When the device is locked, the file cannot be opened, read, or written.
This flag is available when labelValue is S0, S1, S2,
S3, or S4.1: When the device is locked, the file can be read or written if it is opened, but cannot be read or
written if it has been closed, unless the device is unlocked.
This flag is available only when labelValue is S3.