!310 失败捕获

Merge pull request !310 from fanchenxuan/master+
This commit is contained in:
openharmony_ci 2024-08-30 07:18:44 +00:00 committed by Gitee
commit 4ae0ca6bbe
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 32 additions and 28 deletions

View File

@ -183,33 +183,37 @@ export default class MainAbility extends UIAbility {
const flag =
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION;
bundleManager.getBundleInfo(bundleName, flag).then(bundleInfo => {
let reqPermissions: Array<string> = [];
bundleInfo.reqPermissionDetails.forEach(item => {
reqPermissions.push(item.name);
});
try {
bundleManager.getBundleInfo(bundleName, flag).then(bundleInfo => {
let reqPermissions: Array<string> = [];
bundleInfo.reqPermissionDetails.forEach(item => {
reqPermissions.push(item.name);
});
let info = {
'bundleName': bundleInfo.name,
'api': bundleInfo.targetVersion,
'tokenId': bundleInfo.appInfo.accessTokenId,
'icon': '',
'iconId': bundleInfo.appInfo.iconId,
'iconResource': bundleInfo.appInfo.iconResource,
'label': '',
'labelId': bundleInfo.appInfo.labelId,
'labelResource': bundleInfo.appInfo.labelResource,
'permissions': reqPermissions,
'groupId': [],
'zhTag': '',
'indexTag': '',
'language': ''
};
GlobalContext.store('applicationInfo', info);
globalThis.windowStage.setUIContent(this.context, 'pages/application-secondary', null);
}).catch(() => {
console.log(TAG + 'MainAbility getSperifiedApplication failed.');
this.context.terminateSelf();
});
let info = {
'bundleName': bundleInfo.name,
'api': bundleInfo.targetVersion,
'tokenId': bundleInfo.appInfo.accessTokenId,
'icon': '',
'iconId': bundleInfo.appInfo.iconId,
'iconResource': bundleInfo.appInfo.iconResource,
'label': '',
'labelId': bundleInfo.appInfo.labelId,
'labelResource': bundleInfo.appInfo.labelResource,
'permissions': reqPermissions,
'groupId': [],
'zhTag': '',
'indexTag': '',
'language': ''
};
GlobalContext.store('applicationInfo', info);
globalThis.windowStage.setUIContent(this.context, 'pages/application-secondary', null);
}).catch((error) => {
console.log(TAG + 'Special branch getBundleInfo failed:' + JSON.stringify(error));
this.context.terminateSelf();
});
} catch (error) {
console.error(TAG + 'Special branch failed: ' + JSON.stringify(error));
}
}
};

View File

@ -112,7 +112,7 @@ struct SecurityDialog {
radius: $r('sys.float.ohos_id_corner_radius_default_m')
})
.padding(Constants.PADDING_10)
if(this.index === 1) {
if (this.index === 1) {
Image(this.securityParams[this.index].icon)
.width(Constants.IMAGE_LENGTH_20)
.height(Constants.IMAGE_LENGTH_20)