API: bundleManager替换bundle

Signed-off-by: tangzhigang1 <tangzhigang7@huawei.com>
This commit is contained in:
tangzhigang1 2023-05-06 15:12:55 +08:00
parent 548df25595
commit 9a42779b6f
6 changed files with 26 additions and 17 deletions

View File

@ -33,6 +33,10 @@
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GET_INSTALLED_BUNDLE_LIST",
"reason": "$string:get_installed_bundle_list_reason"
},
{
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},

View File

@ -15,6 +15,10 @@
{
"name": "distributed_data_sync_reason",
"value": "SystemUI Distributed Notification Request"
},
{
"name": "get_installed_bundle_list_reason",
"value": "SystemUI Get installed bundle list"
}
]
}

View File

@ -33,6 +33,10 @@
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GET_INSTALLED_BUNDLE_LIST",
"reason": "$string:get_installed_bundle_list_reason"
},
{
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},

View File

@ -15,6 +15,10 @@
{
"name": "distributed_data_sync_reason",
"value": "SystemUI Distributed Notification Request"
},
{
"name": "get_installed_bundle_list_reason",
"value": "SystemUI Get installed bundle list"
}
]
}

View File

@ -16,14 +16,14 @@
import Log from '../../../../../../../../common/src/main/ets/default/Log';
import AbilityManager from '../../../../../../../../common/src/main/ets/default/abilitymanager/abilityManager';
import BundleManager from '../../../../../../../../common/src/main/ets/default/abilitymanager/bundleManager';
import Bundle from '@ohos.bundle';
import { BundleInfo } from 'bundle/bundleInfo';
import Bundle from '@ohos.bundle.bundleManager';
import { BundleInfo } from 'bundleManager/BundleInfo';
import ResMgr from '@ohos.resourceManager';
import {BusinessError} from '@ohos.base';
import SwitchUserManager from '../../../../../../../../common/src/main/ets/default/SwitchUserManager';
const INDEX = 0;
const IS_INCLUDE_ABILITY_INFO = 0;
const IS_INCLUDE_ABILITY_INFO = 0x00000001;
const TAG = 'NotificationManagenment-BundleResourceModel';
@ -59,10 +59,8 @@ export default class BundleResourceModel {
let appInfo = data[index].appInfo;
if (appInfo.labelResource.id > 0) {
BundleManager.getString(appInfo.labelResource, (value) => {
{
if (value) {
label = value;
}
if (value) {
label = value;
}
})
} else {
@ -85,7 +83,7 @@ export default class BundleResourceModel {
appBundleName: data[index].name,
appIconId: appInfo.iconId,
appUri: 'pages/setEnable',
appUid: data[index].uid,
appUid: appInfo.uid,
systemApp: appInfo.systemApp
};
this.mBundleInfoList.push(bundleItemData);
@ -112,17 +110,13 @@ export default class BundleResourceModel {
let label = '';
let userInfo = await SwitchUserManager.getInstance().getCurrentUserInfo();
await Bundle.getBundleInfo(bundleName, IS_INCLUDE_ABILITY_INFO, {
userId: userInfo.userId
}).then((data) => {
await Bundle.getBundleInfo(bundleName, IS_INCLUDE_ABILITY_INFO, userInfo.userId).then((data) => {
Log.showInfo(TAG, `getBundleInfo bundleInfo:${JSON.stringify(data)}`);
let appInfo = data.appInfo;
if (appInfo.labelResource.id > 0) {
BundleManager.getString(appInfo.labelResource, (value) => {
{
if (value) {
mBundleInfo.appTitle = value;
}
if (value) {
mBundleInfo.appTitle = value;
}
})
}
@ -133,7 +127,7 @@ export default class BundleResourceModel {
mBundleInfo.appBundleName = data.name;
mBundleInfo.appIconId = appInfo.iconId;
mBundleInfo.appUri = '';
mBundleInfo.appUid = data.uid;
mBundleInfo.appUid = appInfo.uid;
mBundleInfo.systemApp = appInfo.systemApp;
Log.showDebug(TAG, 'getBundleInfo getResourceManager label:' + label);
if (appInfo.iconResource.id > 0) {

View File

@ -17,7 +17,6 @@ import {NotificationItemData} from '../../common/constants';
import Log from '../../../../../../../../../../common/src/main/ets/default/Log';
import Notification from '@ohos.notification';
import CheckEmptyUtils from '../../../../../../../../../../common/src/main/ets/default/CheckEmptyUtils';
import Bundle from '@ohos.bundle';
const TAG = 'NotificationRuleController';