1# SDK Subsystem Changelog
2
3## cl.sdk.1 Severity Increased for an Alarm Generated When an API Available Only for the FA Model Is Used in a Stage Model Application or Vice Versa
4
5**Change Reason**
6
7An API available only for the FA model should not be used in an application developed in the stage model, and an API available only for the stage model should be used in an application developed in the FA model. The build process should be interrupted if this requirement is not met.
8
9**Change Impact**
10
11The application build behavior is affected.
12
13Before change:
14
15When an FA model application uses an API available only in the stage model, a WARN alarm is generated, with the message content as follows:
16
17"This API is used only in Stage Mode, but the current Mode is FA."
18
19When a stage model application uses an API available only in the FA model, a WARN alarm is generated, with the message content as follows:
20
21"This API is used only in FA Mode, but the current Mode is Stage."
22
23After change:
24
25When an FA model application uses an API available only in the stage model, an ERROR alarm is generated, with the message content as follows:
26
27"This API is used only in Stage Mode, but the current Mode is FA."
28
29When a stage model application uses an API available only in the FA model, an ERROR alarm is generated, with the message content as follows:
30
31"This API is used only in FA Mode, but the current Mode is Stage."
32
33**Start API Level**
34
3512
36
37**Change Since**
38
39OpenHarmony SDK 5.0.0.24
40
41**Key API/Component Changes**
42
43This change affects only the build. For details about the involved APIs and their substitutes, see [API Model Conversion List](./api-model-switch.md).
44
45**Adaptation Guide**
46
47If such an alarm is generated during application build, search for the corresponding API in [API Model Conversion List](./api-model-switch.md) based on the alarm information and find its substitute in the stage model. Then proceed as follows by scenario.
48
49Scenario 1: A substitute exists.
50
51Replace the API with the substitute in your code.
52
53Negative example:
54
55```ts
56// The current project is in the stage model.
57import featureAbility from '@ohos.ability.featureAbility';
58
59let context: featureAbility.Context = featureAbility.getContext().getApplicationContext();
60```
61
62Positive example:
63
64```ts
65// The current project is in the stage model.
66import UIAbility from '@ohos.app.ability.UIAbility';
67import common from '@ohos.app.ability.common';
68
69export default class EntryAbility extends UIAbility {
70  onCreate() {
71    console.log('MyAbility onCreate');
72    let applicationContext: common.Context;
73    try {
74      applicationContext = this.context.getApplicationContext();
75    } catch (error) {
76      console.error(`getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}`);
77    }
78  }
79}
80```
81
82Scenario 2: No substitute is available.
83
84Delete the code of the incorrect API call.
85