Starting from version 6.0.2(22), the function of subscribing to Super Privacy mode change events is supported.
The Super Privacy mode allows users to disable sensitive components with just one tap. Currently, the sensitive components managed by the Super Privacy mode include the location service, camera, and microphone, and will be adjusted with the version evolution. Apps can call the API provided by Device Security Kit to listen for the Super Privacy status.
This feature requires that the Super Privacy option be available on the device. To check the option, go to Settings > Privacy & security > Super Privacy on the device.

Process description:
Your app calls the on API to subscribe to the Super Privacy mode change events.
Device Security Kit calls the callback function to notify your app of the mode change.
Your app processes services based on the current Super Privacy mode.
Your app unsubscribes from Super Privacy mode change events when the Super Privacy mode is no longer needed.
The following table lists the APIs for subscribing to and unsubscribing from Super Privacy mode change events. For details, please refer to API Reference.
| API | Description |
|---|---|
| on(type: 'superPrivacyModeChange', callback: Callback<SuperPrivacyMode>): void | Subscribes to Super Privacy mode change events. |
| off(type: 'superPrivacyModeChange', callback?: Callback<SuperPrivacyMode>): void | Unsubscribes from Super Privacy mode change events. |
Import the SuperPrivacyMode module and related public modules.
import { superPrivacyMode } from '@kit.DeviceSecurityKit';
import { hilog } from '@kit.PerformanceAnalysisKit'; Define the callback function triggered when the Super Privacy mode changes.
const superPrivacyChangedCallback = (mode: superPrivacyMode.SuperPrivacyMode): void => {
hilog.info(DOMAIN, TAG, `super privacy mode changed, mode = ${mode}`);
// ...
} Call the on API to subscribe to the Super Privacy mode change events.
const DOMAIN = 0x0000; const TAG = 'SuperPrivacyModeTest';
hilog.info(DOMAIN, TAG, 'start register super privacy mode changed listener');
try {
superPrivacyMode.on('superPrivacyModeChange', superPrivacyChangedCallback);
hilog.info(DOMAIN, TAG, 'register super privacy mode change listener success');
// ...
} catch (err) {
hilog.error(DOMAIN, TAG, `register super privacy changed listener failed, errCode:${err?.code}, errMessage:${err?.message}`);
// ...
} Call the off API to unsubscribe from the Super Privacy mode change events.
const DOMAIN = 0x0000; const TAG = 'SuperPrivacyModeTest';
hilog.info(DOMAIN, TAG, 'start unregister super privacy mode changed listener');
try {
superPrivacyMode.off('superPrivacyModeChange', superPrivacyChangedCallback);
subscribeCallback_ = null;
// ...
} catch (err) {
hilog.error(DOMAIN, TAG, `unregister super privacy changed listener failed, errCode:${err?.code}, errMessage:${err?.message}`);
// ...
}