Opt: specification for package name when get_render_resolution in an Android device #1070
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在Android.get_render_resolution中增加应用包名参数
这使得get_render_resolution能够获取到除top activity以外的应用的渲染区域
理由有二:
首先:有些应用会创建悬浮窗,导致top activity并不是用户所关注的应用,例如在我的手机上
我想调试QQ,但是当前的top activity是一个气泡,即使我一直在QQ中收发消息,并且现在屏幕上根本见不着这个气泡,
这使得我不得不通过某些手段杀掉这个气泡才能获取到qq的渲染区域,这是非常不方便的
其次:由于先前的get_render_resolution需要获取top acvity,在我的手机上这最终会从dumpsys activity top命令中获取,而该命令执行缓慢,通常需要2-3秒才能执行完毕,这使得如果我把get_render_resolution注册到rotation_watcher--屏幕旋转后原本在左边的黑边就跑到右边去了所以要重新获取渲染区域--就会带来一些表现问题,我希望能够加速这一过程
最后:render resolution本就是每个应用都有,能够指定应用包名而非限制顶层应用更加符合get_render_resolution的语义