1# Window Subsystem Changelog 2 3## cl.window.1 New Error Code Added for setWindowPrivacyMode 4 5**Access Level** 6 7Public API 8 9**Reason for Change** 10 11According to the API reference of **setWindowPrivacyMode**, the **ohos.permission.PRIVACY_WINDOW** permission is required for calling this API. However, if the permission is not carried, error code 201 is not returned. 12 13**Change Impact** 14 15This change is a non-compatible change. When an application calls **setWindowPrivacyMode** without requesting the **ohos.permission.PRIVACY_WINDOW** permission, error code 201 is returned. The application needs to handle the error. 16 17**Start API Level** 18 199 20 21**Change Since** 22 23OpenHarmony SDK 4.1.6.5 24 25**Key API/Component Changes** 26 27Before the change, if the application calls **setWindowPrivacyMode** without carrying the **ohos.permission.PRIVACY_WINDOW** permission, no error code indicating permission verification failure is returned. However, the setting fails. 28 29After the change, if the application calls **setWindowPrivacyMode** without carrying the **ohos.permission.PRIVACY_WINDOW** permission, error code 201 indicating permission verification failure is returned, and the setting fails. 30 31**Adaptation Guide** 32 33If the **ohos.permission.PRIVACY_WINDOW** permission is not configured when the application calls **setWindowPrivacyMode**, error code 201 is returned through the callback. Handle the error. 34 35``` 36import { UIAbility }from '@kit.AbilityKit'; 37import { window } from '@kit.ArkUI'; 38import { BusinessError } from '@kit.BasicServicesKit'; 39 40export default class EntryAbility extends UIAbility { 41 onWindowStageCreate(windowStage: window.WindowStage): void { 42 console.log('onWindowStageCreate'); 43 let promise = windowStage.getMainWindow(); 44 promise.then((windowClass: window.Window)=>{ 45 windowClass.setWindowPrivacyMode(true, (err: BusinessError)=> { 46 if (err.code) { 47 console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err)); 48 return; 49 } 50 console.info('Succeeded in setting the window to privacy mode.'); 51 }); 52 }).catch((err: BusinessError)=>{ 53 console.log("Failed to get main window. Cause:" + JSON.stringify(err)); 54 }) 55 } 56}; 57``` 58