1e41f4b71Sopenharmony_ci# SDK Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## 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
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci**Change Reason**
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciAn 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.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Change Impact**
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciThe application build behavior is affected.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ciBefore change:
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciWhen an FA model application uses an API available only in the stage model, a WARN alarm is generated, with the message content as follows:
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci"This API is used only in Stage Mode, but the current Mode is FA."
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciWhen a stage model application uses an API available only in the FA model, a WARN alarm is generated, with the message content as follows:
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci"This API is used only in FA Mode, but the current Mode is Stage."
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciAfter change:
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciWhen an FA model application uses an API available only in the stage model, an ERROR alarm is generated, with the message content as follows:
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci"This API is used only in Stage Mode, but the current Mode is FA."
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ciWhen a stage model application uses an API available only in the FA model, an ERROR alarm is generated, with the message content as follows:
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci"This API is used only in FA Mode, but the current Mode is Stage."
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**Start API Level**
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci12
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**Change Since**
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciOpenHarmony SDK 5.0.0.24
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**Key API/Component Changes**
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ciThis change affects only the build. For details about the involved APIs and their substitutes, see [API Model Conversion List](./api-model-switch.md).
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**Adaptation Guide**
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ciIf 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.
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ciScenario 1: A substitute exists.
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ciReplace the API with the substitute in your code.
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ciNegative example:
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci```ts
56e41f4b71Sopenharmony_ci// The current project is in the stage model.
57e41f4b71Sopenharmony_ciimport featureAbility from '@ohos.ability.featureAbility';
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_cilet context: featureAbility.Context = featureAbility.getContext().getApplicationContext();
60e41f4b71Sopenharmony_ci```
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ciPositive example:
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci```ts
65e41f4b71Sopenharmony_ci// The current project is in the stage model.
66e41f4b71Sopenharmony_ciimport UIAbility from '@ohos.app.ability.UIAbility';
67e41f4b71Sopenharmony_ciimport common from '@ohos.app.ability.common';
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ciexport default class EntryAbility extends UIAbility {
70e41f4b71Sopenharmony_ci  onCreate() {
71e41f4b71Sopenharmony_ci    console.log('MyAbility onCreate');
72e41f4b71Sopenharmony_ci    let applicationContext: common.Context;
73e41f4b71Sopenharmony_ci    try {
74e41f4b71Sopenharmony_ci      applicationContext = this.context.getApplicationContext();
75e41f4b71Sopenharmony_ci    } catch (error) {
76e41f4b71Sopenharmony_ci      console.error(`getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}`);
77e41f4b71Sopenharmony_ci    }
78e41f4b71Sopenharmony_ci  }
79e41f4b71Sopenharmony_ci}
80e41f4b71Sopenharmony_ci```
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ciScenario 2: No substitute is available.
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ciDelete the code of the incorrect API call.
85