目录

Device Security Mode Query (C/C++)

Use Cases

Device Security Kit provides the capability of querying the system security mode. By calling the API provided by Device Security Kit, your app can check the current security mode (common or Secure Shield) of the device and provide differentiated services accordingly.

Development Procedure

  1. Import and link the shared library of the device security mode in CMakeLists.txt.

    find_library(dsm-lib libdevice_security_mode.z.so)
    target_link_libraries(entry PUBLIC libace_napi.z.so ${dsm-lib})
  2. Import the header file of the device security mode.

    #include <DeviceSecurityKit/device_security_mode.h>
  3. Call the API to query the current security mode of a device.

    int32_t IsSecureShieldModeOn(void)
    {
        DSM_DeviceSecurityMode mode = HMS_DSM_GetDeviceSecurityMode();
        return mode & DSM_SECURE_SHIELD_MODE;
    }

If the ArkWeb component is used in your app, you need to evaluate the compatibility of web features by referring to NOTE.