mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-27 09:12:32 +00:00
!516 【master】【RK3568】【压力测试】【ToC】【高概率】【wukong】出现33次 进程com.ohos.photos下出现jscrash,栈名:initializeConsume/getCountOfMedia
Merge pull request !516 from liujuan/master
This commit is contained in:
commit
6f7c8f68fc
@ -35,34 +35,34 @@ export class SelectUtil {
|
||||
|
||||
static getCountOfMedia(uriArray: Array<string>, selectedMap: Map<string, MediaItem>): Promise<Array<number>> {
|
||||
let result = [0, 0];
|
||||
if (uriArray === undefined || uriArray.length <= 0) {
|
||||
if (uriArray === null || uriArray === undefined || uriArray.length <= 0) {
|
||||
Log.info(TAG, 'uriArray is null or empty!');
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve): void => {
|
||||
resolve(result);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
if (selectedMap === undefined || selectedMap.size <= 0) {
|
||||
Log.info(TAG, 'selectedMap is null or empty!');
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve): void => {
|
||||
resolve(result);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
let imageCount: number = 0;
|
||||
let videoCount: number = 0;
|
||||
for (let i = 0; i < selectedMap.size; i++) {
|
||||
for (let i = 0; i < uriArray.length; i++) {
|
||||
let mediaItem: MediaItem = selectedMap.get(uriArray[i]);
|
||||
if (mediaItem.mediaType === UserFileManagerAccess.MEDIA_TYPE_IMAGE) {
|
||||
if (mediaItem?.mediaType === UserFileManagerAccess.MEDIA_TYPE_IMAGE) {
|
||||
imageCount++;
|
||||
} else if (mediaItem.mediaType === UserFileManagerAccess.MEDIA_TYPE_VIDEO) {
|
||||
} else if (mediaItem?.mediaType === UserFileManagerAccess.MEDIA_TYPE_VIDEO) {
|
||||
videoCount++;
|
||||
}
|
||||
}
|
||||
result = [imageCount, videoCount];
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve): void => {
|
||||
resolve(result);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
static async grantPermissionForUris(uris: Array<string>, bundleName: string): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user