检测硬件加速运行:安卓 [英] Detect Hardware Acceleration at Runtime: Android

查看:120
本文介绍了检测硬件加速运行:安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以持续检测,如果在创建时的活动,使硬件加速?我担心我的媒体库的用户将通过清单启用它时,他们不应该由未明确禁止它为我的活动(如我教他们做什么。)

Is it possible to consistently detect if an Activity has hardware acceleration enabled when it is created? I'm worried that users of my library will enable it through the manifest when they shouldn't, by not specifically disabling it for my Activity (as I instruct them to do.)

的唯一可靠的信息,我能找到(<一href="http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html">http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html)说我可以查询 View.isHardwareAccelerated() Canvas.isHardwareAccelerated()。但是,我的目的,我想确保它是从我的图书馆的活动时显示,到目前为止,我不能得到任何报告一致的是/否当它是打开或关闭。我试着黑客在一个虚拟视图,将其设置为活动然后测试它,但它始终返回false。另外,我试着测试 Window.getAttributes().flags ,但他们都没有表现出它的。

The only solid information I can find (http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html) says that I can query View.isHardwareAccelerated() and Canvas.isHardwareAccelerated(). However, for my purposes, I would like to ensure it is off when my library's Activity is shown. So far, I can't get anything to report a consistent yes/no when it is on or off. I tried hacking in a dummy view, setting it to my activity and then testing it, but it always returns false. Also, I tried testing Window.getAttributes( ).flags, but they aren't showing it either.

我测试这一点,因为硬件加速绘制路径,我的库不正常,而且似乎没有像有什么办法可以解决这个问题。

I am testing this because the hardware accelerated draw path for my library doesn't function correctly, and there doesn't seem like there is any way to fix it.

推荐答案

尝试FLAG_HARDWARE_ACCELERATED 标志 ActivityInfo 的活动,您将通过 PackageManager > getActivityInfo()。

Try FLAG_HARDWARE_ACCELERATED in flags in ActivityInfo for the activity, which you would get from PackageManager via getActivityInfo().

这篇关于检测硬件加速运行:安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆