1# 包管理子系统变更说明
2
3## cl.bundlemanager.1 ApplicationReservedFlag枚举和ApplicationInfo中的applicationReservedFlag字段删除
4
5**访问级别**
6
7公开接口
8
9**删除原因**
10
11applicationReservedFlag命名过于复杂,不易理解,且当前存储信息没有使用方,可以删除。
12
13**删除影响**
14
15该变更为非兼容性变更。ApplicationInfo中的applicationReservedFlag原本用于存储应用的保留字段,当前仅存储应用是否加密的信息。废弃后,无法再通过applicationReservedFlag获取应用的保留信息。
16
17**API Level**
18
1911
20
21**删除发生版本**
22
23从OpenHarmony SDK 4.1.5.5开始
24
25**删除的接口/组件**
26
27| 接口声明 | 删除说明 |
28| --------------- | ------- |
29| enum ApplicationReservedFlag | 不再需要该枚举来获取相应信息。 |
30| readonly applicationReservedFlag: number; | 命名过于复杂,不易理解,当前存储信息没有使用方。 |
31
32**适配指导**
33
34当前该接口没有使用方,applicationReservedFlag中存储的应用加密信息,应用无需感知。
35
36
37## cl.bundlemanager.2 包管理NDK结构体OH_NativeBundle_ApplicationInfo删除appId和appIdentifier字段。
38
39**访问级别**
40
41公开接口
42
43**删除原因**
44
45结构体[OH_NativeBundle_ApplicationInfo](../../../application-dev/reference/native-apis/_o_h___native_bundle_application_info.md)删除appId和appIdentifier字段。
46
47**删除影响**
48
49如果使用API 11及以上的开发的Native应用,使用包管理查询接口[OH_NativeBundle_GetCurrentApplicationInfo](../../../application-dev/reference/native-apis/native__interface__bundle.md#oh_nativebundle_getcurrentapplicationinfo)不再能查询appId和appIdentifier信息。
50
51**API Level**
52
5311
54
55**删除发生版本**
56
57从OpenHarmony SDK 4.1.5.5开始
58
59**删除的接口/组件**
60
61应用调用包管理NDK接口[OH_NativeBundle_GetCurrentApplicationInfo](../../../application-dev/reference/native-apis/native__interface__bundle.md#oh_nativebundle_getcurrentapplicationinfo)查询应用自身信息。
62
63**适配指导**
64
65调用包管理接口[OH_NativeBundle_GetAppId](../../../application-dev/reference/native-apis/native__interface__bundle.md#oh_nativebundle_getappid)查询appId信息。
66调用包管理接口[OH_NativeBundle_GetAppIdentifier](../../../application-dev/reference/native-apis/native__interface__bundle.md#oh_nativebundle_getappidentifier)查询appIdentifier信息。
67
68示例代码
69
70 ```c++
71    static napi_value GetCurrentApplicationInfo(napi_env env, napi_callback_info info)
72    {
73        // 调用Native接口获取应用信息
74        OH_NativeBundle_ApplicationInfo nativeApplicationInfo = OH_NativeBundle_GetCurrentApplicationInfo();
75        napi_value result = nullptr;
76        napi_create_object(env, &result);
77        // Native接口获取的应用包名转为js对象里的bundleName属性
78        napi_value bundleName;
79        napi_create_string_utf8(env, nativeApplicationInfo.bundleName, NAPI_AUTO_LENGTH, &bundleName);
80        napi_set_named_property(env, result, "bundleName", bundleName);
81        // Native接口获取的指纹信息转为js对象里的fingerprint属性
82        napi_value fingerprint;
83        napi_create_string_utf8(env, nativeApplicationInfo.fingerprint, NAPI_AUTO_LENGTH, &fingerprint);
84        napi_set_named_property(env, result, "fingerprint", fingerprint);
85
86        char* appId = OH_NativeBundle_GetAppId();  // new
87        // Native接口获取的appId转为js对象里的appId属性
88        napi_value napi_appId;
89        napi_create_string_utf8(env, appId, NAPI_AUTO_LENGTH, &napi_appId);
90        napi_set_named_property(env, result, "appId", napi_appId);
91
92        char* appIdentifier = OH_NativeBundle_GetAppIdentifier();  // new
93        // Native接口获取的appIdentifier转为js对象里的appIdentifier属性
94        napi_value napi_appIdentifier;
95        napi_create_string_utf8(env, appIdentifier, NAPI_AUTO_LENGTH, &napi_appIdentifier);
96        napi_set_named_property(env, result, "appIdentifier", napi_appIdentifier);
97        // 最后为了防止内存泄漏,手动释放
98        free(nativeApplicationInfo.bundleName);
99        free(nativeApplicationInfo.fingerprint);
100        free(appId);
101        free(appIdentifier);
102        return result;
103    }
104```
105
106## c3.bundlemanager.3 调试应用安装管控变更
107
108**访问级别**
109
110其他
111
112**变更原因**
113
114当前对调试应用安装做了管控,无法在非开发者模式下安装调试应用,可以由[签名证书](../../../application-dev/security/app-provision-structure.md)中的type字段来判断是否为调试应用。
115
116**变更影响**
117
118该变更为非兼容性变更。如果应用的签名证书类型为debug,且设备处于非开发者模式,会导致无法安装。
119
120**API Level**
121
12211
123
124**变更发生版本**
125
126从OpenHarmony SDK 4.1.5.5开始
127
128**变更的接口/组件**
129
130不涉及接口及组件变更。
131
132**适配指导**
133
134可通过设置中的“通用-开发者模式”来打开或者关闭开发者模式。
135