camera录像过程中发现,退出预览界面帧率只有16帧,达不到正常的25帧。进入预览界面帧率达到25帧,发现引用必须是前台进程才能使camera的帧率达到25帧,需要提高进程优先级。
在ActivityManagerService中修改进程优先级,主要是在computeOomAdjLocked方法中添加
diff --git a/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java b/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java index ead4c01..67d2796 100755 --- a/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java @@ -23314,7 +23314,10 @@ public class ActivityManagerService extends IActivityManager.Stub int prevAppAdj = app.curAdj; int prevProcState = app.curProcState; - + if((app.processName.equals("video.evs.camera")) + || (app.processName.equals("video.evs.camera:renderservice"))) { + app.maxAdj = ProcessList.FOREGROUND_APP_ADJ; + } if (app.maxAdj <= ProcessList.FOREGROUND_APP_ADJ) { // The max adjustment doesn't allow this app to be anything // below foreground, so it is not worth doing work for it.