android - Android Camera Client 的优先级是如何设置的?

标签 android camera android-camera

相机 API 文档说“当优先级较高的应用程序尝试使用相机时,较低优先级应用程序的 Activity 相机客户端可能会被“逐出”

我的问题是,如何设置应用程序的优先级?是否可以通过编程方式或在系统级别为预安装的应用设置此设置?

最佳答案

Android 平台设置优先级。例如,在前台运行的进程比在后台运行的服务具有更高的优先级。当设备内存被填满而 Android 需要释放内存时,使用相同的优先级系统。优先级较低的进程被杀死。

您可以在此 API 中找到不同级别的优先级

https://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo.html

importance added in API level 3

int importance

The relative importance level that the system places on this process. These constants are numbered so that "more important" values are always smaller than "less important" values.

Value is IMPORTANCE_FOREGROUND, IMPORTANCE_FOREGROUND_SERVICE, IMPORTANCE_TOP_SLEEPING, IMPORTANCE_VISIBLE, IMPORTANCE_PERCEPTIBLE, IMPORTANCE_SERVICE, IMPORTANCE_CACHED or IMPORTANCE_GONE.

关于android - Android Camera Client 的优先级是如何设置的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37684447/

相关文章:

android - 如何在shell中获取/dev/logo的内容?

Android:在风景模式下拍摄的照片力

javascript - 将相机放置在 Three.js 立方体内

android - 拍照总是在onActivityResult(..)中返回RESULT_CANCELED(0)

Android 相机 android.hardware.Camera 已弃用

android - 禁用 SwipeRefreshLayout 拉动刷新的正确方法是什么

android - 从 FragmentPagerAdapter 动态添加和删除 fragment

java - 查看 android 监视器图时,.release() 不会减少我的内存

camera - 实时摄像头输入到 Julia-lang

android - 相机显示拉伸(stretch)图像