Skip to content

Commit f6708dd

Browse files
committed
fix env variables, use syscap
1 parent ced961f commit f6708dd

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

entry/src/main/cpp/napi_init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ static napi_value run(napi_env env, napi_callback_info info) {
202202
"/data/app/bin:/data/service/hnp/bin:/bin:"
203203
"/usr/local/bin:/usr/bin:/system/bin:/vendor/bin",
204204
1);
205+
setenv("LD_LIBRARY_PATH", "/data/app/harmonix.org/harmonix_1.0/lib", 1);
205206

206207
chdir(home);
207208
execl("/bin/sh", "/bin/sh", nullptr);

entry/src/main/ets/entryability/EntryAbility.ets

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ export default class EntryAbility extends UIAbility {
2929
hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
3030
});
3131

32-
windowStage.getMainWindow((err: BusinessError, window: window.Window) => {
33-
if (err.code) {
34-
hilog.error(0x0000, 'testTag', 'Failed to get the main window. Cause: %{public}s', JSON.stringify(err) ?? '');
35-
return;
36-
}
37-
window.setWindowDecorVisible(false);
38-
window.setWindowDecorHeight(STYLE_CONFIGURATION.TAB_BAR_HEIGHT);
39-
});
32+
if (canIUse('SystemCapability.Window.SessionManager')) {
33+
windowStage.getMainWindow((err: BusinessError, window: window.Window) => {
34+
if (err.code) {
35+
hilog.error(0x0000, 'testTag', 'Failed to get the main window. Cause: %{public}s', JSON.stringify(err) ?? '');
36+
return;
37+
}
38+
window.setWindowDecorVisible(false);
39+
window.setWindowDecorHeight(STYLE_CONFIGURATION.TAB_BAR_HEIGHT);
40+
});
41+
}
4042

4143
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
4244
await atManager.requestPermissionsFromUser(this.context, ['ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY']);

entry/src/main/syscap.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"devices": {
3+
"general": [
4+
"2in1"
5+
]
6+
},
7+
"development": {
8+
"addedSysCaps": [
9+
"SystemCapability.Window.SessionManager"
10+
]
11+
},
12+
"production": {
13+
"addedSysCaps": [
14+
"SystemCapability.Window.SessionManager"
15+
]
16+
}
17+
}

0 commit comments

Comments
 (0)