在Android的变革进程优先级优先级、进程、Android

2023-09-04 12:41:29 作者:源能量

如何改变进程的优先级在Android中?我发现它在android的文档优先级进程的描述和说明

进程和线程描述

进程优先级

但我没有发现任何的改变进程的优先级通过某种方法。

PS:我需要这个来测试应用程序的只有一些功能,它与进程优先级连接,它不会在程序中使用

我看到的唯一方法是尝试通过的重要字段以更改优先级,但它是一个坏主意,我猜。

解决方案   

如何改变进程的优先级在Android的?

通常情况下,你不知道。处理优先级由操作系统管理。如果你的应用程序是在前台,它会与前景优先级运行。如果你的应用程序是不是在前台,也不会与前台优先级运行。

  

我需要这个来测试应用程序的只有一些功能,它与进程优先级连接,它不会在程序中使用。

然后用一个过程,是在前台与一个不是测试。

  

我看到的唯一方法是尝试通过重要领域以更改优先级,但它是一个坏主意,我猜。

更改这个数字是不太可能产生效果。 RunningAppProcessInfo 是输出结构,而不是由任何改变,通过该结构报告的手段。

解读Android进程优先级ADJ算法

How to change process priority in Android? I have found process description and description of it's priorities in android docs

process and thread description

process priorities

but I have found nothing on changing process priority by some method.

ps: I need this to test only some feature of application which is connected with process priority and it won't be used in program.

The only way I see is to try to change the priority via importance field, but it's a bad idea I guess.

解决方案

How to change process priority in Android?

Generally, you don't. Process priority is managed by the OS. If your app is in the foreground, it will run with foreground priority. If your app is not in the foreground, it will not run with foreground priority.

I need this to test only some feature of application which is connected with process priority and it won't be used in program.

Then test with a process that is in the foreground versus one that is not.

The only way I see is to try to change the priority via importance field, but it's a bad idea I guess.

Changing that number is unlikely to have an effect. RunningAppProcessInfo is an output structure, not a means by which to change anything reported via that structure.