未验证 提交 395de097 编写于 作者: O openharmony_ci 提交者: Gitee

!19542 翻译完成:19157+19289 4.0beta1 RN+ API changes

Merge pull request !19542 from wusongqing/TR19157
此差异已折叠。
# OpenHarmony Release Notes
## OpenHarmony 4.x Releases
- [OpenHarmony v4.0 Beta1 (2023-06-03)](OpenHarmony-v4.0-beta1.md)
## OpenHarmony 3.x Releases
- [OpenHarmony v3.2 Release (2023-04-09)](OpenHarmony-v3.2-release.md)
- [OpenHarmony v3.2.1 Release (2023-05-22)](OpenHarmony-v3.2.1-release.md)
- [OpenHarmony v3.2.1 Release (2023-05-22)](OpenHarmony-v3.2.1-release.md)
- [OpenHarmony v3.2 Beta5 (2023-01-31)](OpenHarmony-v3.2-beta5.md)
- [OpenHarmony v3.2 Beta4 (2022-11-30)](OpenHarmony-v3.2-beta4.md)
- [OpenHarmony v3.2 Beta3 (2022-09-30)](OpenHarmony-v3.2-beta3.md)
- [OpenHarmony v3.2 Beta2 (2022-07-30)](OpenHarmony-v3.2-beta2.md)
- [OpenHarmony v3.2 Beta1 (2022-05-31)](OpenHarmony-v3.2-beta1.md)
- [OpenHarmony v3.1 Release (2022-03-30)](OpenHarmony-v3.1-release.md)
- [OpenHarmony v3.1.7 Release (2023-04-04)](OpenHarmony-v3.1.7-release.md)
- [OpenHarmony v3.1.6 Release (2023-02-06)](OpenHarmony-v3.1.6-release.md)
- [OpenHarmony v3.1.5 Release (2023-01-10)](OpenHarmony-v3.1.5-release.md)
- [OpenHarmony v3.1.4 Release (2022-11-02)](OpenHarmony-v3.1.4-release.md)
- [OpenHarmony v3.1.3 Release (2022-09-30)](OpenHarmony-v3.1.3-release.md)
- [OpenHarmony v3.1.2 Release (2022-08-24)](OpenHarmony-v3.1.2-release.md)
- [OpenHarmony v3.1.1 Release (2022-05-31)](OpenHarmony-v3.1.1-release.md)
- [OpenHarmony v3.1.7 Release (2023-04-04)](OpenHarmony-v3.1.7-release.md)
- [OpenHarmony v3.1.6 Release (2023-02-06)](OpenHarmony-v3.1.6-release.md)
- [OpenHarmony v3.1.5 Release (2023-01-10)](OpenHarmony-v3.1.5-release.md)
- [OpenHarmony v3.1.4 Release (2022-11-02)](OpenHarmony-v3.1.4-release.md)
- [OpenHarmony v3.1.3 Release (2022-09-30)](OpenHarmony-v3.1.3-release.md)
- [OpenHarmony v3.1.2 Release (2022-08-24)](OpenHarmony-v3.1.2-release.md)
- [OpenHarmony v3.1.1 Release (2022-05-31)](OpenHarmony-v3.1.1-release.md)
- [OpenHarmony v3.1 Beta (2021-12-31)](OpenHarmony-v3.1-beta.md)
- [OpenHarmony v3.0 LTS (2021-09-30)](OpenHarmony-v3.0-LTS.md)
- [OpenHarmony v3.0.8 LTS (2022-03-03)](OpenHarmony-v3.0.8-LTS.md)
- [OpenHarmony v3.0.7 LTS (2022-12-05)](OpenHarmony-v3.0.7-LTS.md)
- [OpenHarmony v3.0.6 LTS (2022-09-15)](OpenHarmony-v3.0.6-LTS.md)
- [OpenHarmony v3.0.5 LTS (2022-07-01)](OpenHarmony-v3.0.5-LTS.md)
- [OpenHarmony v3.0.3 LTS (2022-04-08)](OpenHarmony-v3.0.3-LTS.md)
- [OpenHarmony v3.0.2 LTS (2022-03-18)](OpenHarmony-v3.0.2-LTS.md)
- [OpenHarmony v3.0.1 LTS (2022-01-12)](OpenHarmony-v3.0.1-LTS.md)
- [OpenHarmony v3.0.8 LTS (2022-03-03)](OpenHarmony-v3.0.8-LTS.md)
- [OpenHarmony v3.0.7 LTS (2022-12-05)](OpenHarmony-v3.0.7-LTS.md)
- [OpenHarmony v3.0.6 LTS (2022-09-15)](OpenHarmony-v3.0.6-LTS.md)
- [OpenHarmony v3.0.5 LTS (2022-07-01)](OpenHarmony-v3.0.5-LTS.md)
- [OpenHarmony v3.0.3 LTS (2022-04-08)](OpenHarmony-v3.0.3-LTS.md)
- [OpenHarmony v3.0.2 LTS (2022-03-18)](OpenHarmony-v3.0.2-LTS.md)
- [OpenHarmony v3.0.1 LTS (2022-01-12)](OpenHarmony-v3.0.1-LTS.md)
## OpenHarmony 2.x Releases
......
# Readme
| Subsystem | Change Type | Change Description |
| :------------- | ------------ | ------------------------------------------------------------ |
| Common | Verification enhanced | [Permission verification enhanced for system APIs. Now only system applications are allowed to use system APIs. If third-party applications use a system API, error 202 is returned.](changelogs-common.md)|
| Ability framework | Behavior changed | [In the **appRecovery** API, the enum names of **RestartFlag** are changed from **NO_RESTART** upon a specific fault to **RESTART** upon a specific fault.](changelogs-ability.md)|
| Multi-language runtime subsystem| Parsing rule changed| [LLVM parsing format changed. When your code depends on the **version-script** or **-gcc-toolchain** option, parsing may fail if you continue to use the original LLVM 12 configuration file or options.](changelogs-arkcompiler.md)|
| Multi-language runtime subsystem| Verification enhanced | [New alarms are added and existing alarms are enhanced along with the upgrade from LLVM 12 to LLVM 15](changelogs-arkcompiler.md)|
| Multi-language runtime subsystem| Verification enhanced | [LLVM emu-tls is changed. If you use both LLVM 12 and LLVM 15, the emu-tls symbol cannot be found in libc++.so.](changelogs-arkcompiler.md)|
| Multi-language runtime subsystem| Verification enhanced | [New features and internal interface changes in the official release of LLVM 15 are inherited.](changelogs-arkcompiler.md)|
| Bundle management subsystem | Mechanism changed | [The HAP is no longer decompressed during HAP installation.](changelogs-bundlemanager.md)|
| Resource scheduler subsystem | Behavior changed | [The reminder agent allows you to customize buttons for system applications. Clicking a custom button will redirect you to the specified application page.](changelogs-resourceschedule.md)|
# Ability Framework Changelog
## cl.ability.1 RestartFlag Attribute Names Changed and Unsupported Attribute Deleted in appRecovery
In the **appRecovery** API, the enum names of **RestartFlag** are changed from **NO_RESTART** upon a specific fault to **RESTART** upon a specific fault.
The **CPP_CRASH_NO_RESTART** enum is deleted.
**Change Impact**
If your application uses the **CPP_CRASH_NO_RESTART**, **JS_CRASH_NO_RESTART**, or **APP_FREEZE_NO_RESTART** attribute in versions earlier than 4.0.2.3, its behavior will change after an upgrade to 4.0.2.3.
**Key API/Component Changes**
**RestartFlag** <sup>9+</sup>
Before change
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| ALWAYS_RESTART | 0 | The application is restarted in all cases.|
| CPP_CRASH_NO_RESTART | 0x0001 | The application is **not restarted** in the case of CPP_CRASH.|
| JS_CRASH_NO_RESTART | 0x0002 | The application is **not restarted** in the case of JS_CRASH.|
| APP_FREEZE_NO_RESTART | 0x0004 | The application is **not restarted** in the case of APP_FREEZE.|
| NO_RESTART | 0xFFFF | The application is not restarted in any case.|
After change
| Name | Value | Description |
| ---------- | ---- | ---------- |
| ALWAYS_RESTART | 0 | The application is restarted in all cases.|
| CPP_CRASH_NO_RESTART | NA | **Deleted.** The restart in this scenario is not supported.|
| RESTART_WHEN_JS_CRASH | 0x0001 | The application is **restarted** in the case of JS_CRASH.|
| RESTART_WHEN_APP_FREEZE | 0x0002 | The application is **restarted** in the case of APP_FREEZE.|
| NO_RESTART | 0xFFFF | The application is not restarted in any case.|
**Adaptation Guide**
Perform adaptation based on the new semantics.
# Multi-language Runtime Subsystem Changelog
## cl.arkcompiler.1 New Alarms and Existing Alarm Enhancements for LLVM
**Change Impact**
By default, the **-Werror** option is disabled for the OpenHarmony NDK. If you have enabled the **-Werror** option, you are advised to correct the code based on the suggestions in the check result or mask the errors.
**Changes in Key Compilation Check Rules**
| New Check Item| Description| Suggestion|
| --- | --- | --- |
| Wunused-but-set-variable | An alarm is generated when the code contains unused variables (including the ++ operator).| Add the **maybe_unused** attribute when defining variables or use macros to distinguish variables.|
| Wdeprecated-non-prototype | An alarm is generated when a function without a prototype exists in the code.| Add a function prototype and specify the parameters.|
| Wunqualified-std-cast-call | An alarm is generated when **std::move** is incorrectly used in code.| Specify the use case of **std::move** and check the code.|
| Wdeprecated-builtins | An alarm is generated when a deprecated built-in function is used in the code.| Use the substitute function.|
| Warray-parameter | An alarm is generated when a function parameter contains an array that uses inconsistent forms.| Ensure the consistency of the function parameter.|
| Wbitwise-instead-of-logical | An alarm is generated when bitwise OR is used in Boolean operations.| Use logical OR in Boolean operations.|
| Wint-conversion | An alarm is generated when an int variable is converted to a pointer in the code.| Use a new implementation mode in the code.|
| Wdeprecated-declarations | An alarm is generated when a deprecated definition (including functions and variables) is used in code.| Use a new implementation mode in the code.|
| Wnull-pointer-subtraction | An alarm is generated when a null pointer is used in the subtraction operation.| Do not a null pointer in the subtraction operation.|
| Wunused-but-set-parameter | An alarm is generated when a function contains unused parameters.| Delete unused parameters.|
| Warray-bounds | An alarm is generated when out-of-bounds access to an array occurs in the code.| Modify the out-of-bounds access.|
| Wdeprecated-pragma | An alarm is generated when a deprecated macro is used in the code.| Delete the deprecated macro.|
| Wreserved-identifier | An alarm is generated when a variable starting with __ is used in the code.| Check the code to prevent variables starting with underscores (_) from being used externally.|
**Adaptation Guide**
1. For issues in the code that are not detected by LLVM 12, check and update the code.
2. Some old implementations are discarded during LLVM update. Adapt to the new rules and update the code.
3. If you believe a certain type of error can be masked, use the **-Wno-xxx** option to mask the error.
Defective code example
```
void Heap::Resume(TriggerGCType gcType)
{
if (mode_ != HeapMode::SPAWN &&
activeSemiSpace_->AdjustCapacity(inactiveSemiSpace_->GetAllocatedSizeSinceGC())) {
// If activeSpace capacity changes, oldSpace maximumCapacity should change too.
size_t multiple = 2;
// oldSpaceMaxLimit is assigned a value but is not used.
size_t oldSpaceMaxLimit = 0;
if (activeSemiSpace_->GetInitialCapacity() >= inactiveSemiSpace_->GetInitialCapacity()) {
size_t delta = activeSemiSpace_->GetInitialCapacity() - inactiveSemiSpace_->GetInitialCapacity();
oldSpaceMaxLimit = oldSpace_->GetMaximumCapacity() - delta * multiple;
} else {
size_t delta = inactiveSemiSpace_->GetInitialCapacity() - activeSemiSpace_->GetInitialCapacity();
oldSpaceMaxLimit = oldSpace_->GetMaximumCapacity() + delta * multiple;
}
inactiveSemiSpace_->SetInitialCapacity(activeSemiSpace_->GetInitialCapacity());
}
// irrelated code ...
}
```
The oldSpaceMaxLimit variable is not used, and the compiler reports an alarm.
```
../../arkcompiler/ets_runtime/ecmascript/mem/heap.cpp:247:16: error: variable 'oldSpaceMaxLimit' set but not used [-Werror,-Wunused-but-set-variable]
size_t oldSpaceMaxLimit = 0;
```
The error is rectified after the attribute is added.
```
void Heap::Resume(TriggerGCType gcType)
{
if (mode_ != HeapMode::SPAWN &&
activeSemiSpace_->AdjustCapacity(inactiveSemiSpace_->GetAllocatedSizeSinceGC())) {
// If activeSpace capacity changes, oldSpace maximumCapacity should change too.
size_t multiple = 2;
// Add the maybe_unused attribute and declare that the variable oldSpaceMaxLimit may not be used.
[[maybe_unused]] size_t oldSpaceMaxLimit = 0;
if (activeSemiSpace_->GetInitialCapacity() >= inactiveSemiSpace_->GetInitialCapacity()) {
size_t delta = activeSemiSpace_->GetInitialCapacity() - inactiveSemiSpace_->GetInitialCapacity();
oldSpaceMaxLimit = oldSpace_->GetMaximumCapacity() - delta * multiple;
} else {
size_t delta = inactiveSemiSpace_->GetInitialCapacity() - activeSemiSpace_->GetInitialCapacity();
oldSpaceMaxLimit = oldSpace_->GetMaximumCapacity() + delta * multiple;
}
inactiveSemiSpace_->SetInitialCapacity(activeSemiSpace_->GetInitialCapacity());
}
// irrelated code ...
}
```
## cl.arkcompiler.2 LLVM Parsing Format Changed
**Change Impact**
When your code depends on the **version-script** or **-gcc-toolchain** option, parsing may fail if you continue to use the original LLVM 12 configuration file or options.
**Changes in Key Compilation Rules**
1. The symbol representation is changed. In the new version, consecutive greater signs (>) are represented as ">>", which was represented as "> >" in the old version.
2. The -xx options are deprecated. For example, the **-gcc-toolchain** option is replaced by the **--gcc-toolchain** option. (This option has been marked as deprecated in versions later than Clang 3.4 and is officially deprecated in LLVM15.)
**Adaptation Guide**
If two consecutive greater signs (>) exist in the code (without considering the number of spaces in the middle), they will be parsed as "> >" in the older version and ">>" in the new version in version-script (due to mangling differences). In LLVM15, ">>" must be used.
Original configuration file
```
{
global:
extern "C++" {
"google::protobuf::TextFormat::ParseFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::Message*)";
// In LLVM 12, "> >" can be parsed, but ">>" cannot.
"google::protobuf::TextFormat::PrintToString(google::protobuf::Message const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)";
};
local:
*;
}
```
Modified configuration file
```
{
global:
extern "C++" {
"google::protobuf::TextFormat::ParseFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, google::protobuf::Message*)";
// In LLVM 15, ">>" can be parsed.
"google::protobuf::TextFormat::PrintToString(google::protobuf::Message const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)";
};
local:
*;
}
```
## cl.arkcompiler.3 LLVM emu-tls Changed
**Change Impact**
If you use both LLVM 12 and LLVM 15 (this behavior is prohibited) for your code, the emu-tls symbol cannot be found in libc++.so.
**Key Library Dependency Changes**
In LLVM 15, the emu-tls symbol is extracted from the target binary file to libc++.so. That is, the __emutls_get_address attribute changes from an internal symbol to an externally visible symbol, which is included in libc++.so. As a result, the compiled dynamic library may depend on libc++.so.
**Adaptation Guide**
This symbol is also in libclang_rt.builtin.a. If you do not want the compiled dynamic library to depend on libc++.so, statically link the libclang_rt.builtin.a library.
## cl.arkcompiler.4 LLVM Official Release Notes
**Change Impact**
New features are added and internal interfaces are changed (such as IR in LLVM and compiler front-end modification). For details, see the official release notes.
**Key Documents**
https://releases.llvm.org/13.0.0/docs/ReleaseNotes.html
https://releases.llvm.org/14.0.0/docs/ReleaseNotes.html
https://releases.llvm.org/15.0.0/docs/ReleaseNotes.html
**Adaptation Guide**
For details about the updates and adaptation guide, see the official documents.
# Bundle Management Subsystem Changelog
## cl.bundlemanager.1 Changed Underlying Capability by Not Decompressing the HAP During HAP Installation
The HAP will no longer be decompressed during installation. After the installation is complete, only the HAP file exists in the installation directory. As a result, the application must use the standard resource management interface, rather than a combined path, to access a resource file.
**Change Impact**
If the application uses a combined path to access a resource file, the access fails. It must use the resource management interface.
**Key API/Component Changes**
No API or component change is involved.
**Adaptation Guide**
The resource management subsystem provides the JS interface for accessing resource files. Reference: [Accessing Resource Files](../../../application-dev/reference/apis/js-apis-resource-manager.md#getrawfilecontent9)
\ No newline at end of file
# Common Capability Changelog
## cl.common.1 System API Usage Rule Changed
When a system API is called, no verification is performed to check whether the caller is a system application or third-party application. As a result, a third-party application can switch to the full SDK to use system APIs, which brings security risks. To address this issue, application identity verification is added to OpenHarmony 4.0.2.1 and later versions.
**Change Impact**
System APIs are available only to system applications. When a third-party application tries to use a system API, the **202** error will be returned via either an exception or asynchronous callback.
**Adaptation Guide**
To use a system API, a third-party application must either request the system application permission or use a substitute API that is available for non-system applications.
# Resource Scheduler Subsystem Changelog
## cl.resourceschedule.reminderAgent.1
The reminder agent allows you to customize buttons for system applications. Clicking a custom button will redirect you to the specified application page.
**Change Impact**
For system applications developed based on OpenHarmony 4.0.7.1 and later SDK versions, you can set custom buttons for reminders.
**Key API/Component Changes**
| Module| Class| Method/Attribute/Enum/Constant| Change Type|
| -- | -- | -- | -- |
| reminderAgentManager | ActionButtonType | ACTION_BUTTON_TYPE_CUSTOM = 2 | Added|
| reminderAgentManager | ActionButton | wantAgent?: WantAgent | Added|
| reminderAgentManager | WantAgent | uri?: string | Added|
| reminderAgentManager | ReminderRequest | actionButton?: [ActionButton?, ActionButton?, ActionButton?] | Changed|
**Adaptation Guide**
```ts
import reminderAgentManager from '@ohos.reminderAgentManager';
let targetReminderAgent: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, // The reminder type is alarm clock.
...
actionButton: [
{
title: 'Remind later',
type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_SNOOZE
},
{
title: 'Close',
type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE
},
{
title: 'Custom',
type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CUSTOM,
wantAgent: {
pkgName: "com.example.myapplication",
abilityName: "EntryAbility",
}
},
]
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册