Skip to content

[BUG]相册调用计数可能存在重复计数的情形 #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
neo2470 opened this issue Jan 8, 2024 · 1 comment
Open

[BUG]相册调用计数可能存在重复计数的情形 #57

neo2470 opened this issue Jan 8, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@neo2470
Copy link

neo2470 commented Jan 8, 2024

Appscan 版本

2.1.4

系统版本

电脑版本:

Windows 10 专业版

手机型号:

雷电模拟器9.0.61,模拟型号HMA-AL00

安卓版本:

Android 9

Bug 描述

使用系统API读取相册,调用ContentResolver.query方法(query内部会调用重载方法,如下)时,会被重复计算调用次数。

context.contentResolver.query(
    MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
    null,
    selection,
    selectionArgs,
    "${MediaStore.Images.Media.DATE_MODIFIED} desc limit $limit offset $offset"
)

现象:AppScan报告相册调用次数为 3 次。应该是1次才对

AppScan导出错误栈如下:

// #1 main 获取相册内容
android.content.ContentResolver.query(Native Method)
com.***.mediapicker.viewmodel.PhotoPickerViewModel2$loadPhoto$1.invokeSuspend(PhotoPickerViewModel2.kt:200)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

// #2 main 获取相册内容
android.content.ContentResolver.query(Native Method)
android.content.ContentResolver.query(ContentResolver.java:711)
android.content.ContentResolver.query(Native Method)
com.***.mediapicker.viewmodel.PhotoPickerViewModel2$loadPhoto$1.invokeSuspend(PhotoPickerViewModel2.kt:200)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

// #3 main 获取相册内容
android.content.ContentResolver.query(Native Method)
android.content.ContentResolver.query(ContentResolver.java:753)
android.content.ContentResolver.query(Native Method)
android.content.ContentResolver.query(ContentResolver.java:711)
android.content.ContentResolver.query(Native Method)
com.***.mediapicker.viewmodel.PhotoPickerViewModel2$loadPhoto$1.invokeSuspend(PhotoPickerViewModel2.kt:200)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
@neo2470 neo2470 added the bug Something isn't working label Jan 8, 2024
@ChnMig ChnMig self-assigned this Jan 8, 2024
@ChnMig
Copy link
Collaborator

ChnMig commented Jan 9, 2024

看了一下, 这个准确说是待优化项, 对于目前的捕捉来讲, 确实是调用了底层的相册获取接口, 只是从操作方讲, 确实是只触发了一次, 这个我们看看怎么处理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants