好的,这个解决方案工作正常
它可以从 ObjAnimator 的循环中调用(例如监听器 - onRepeat)
您可以统计事件并得出有关设备速度的结论。
ps 它不够聪明,但直到没有人回答本机帧率报告...
boolean getCatLog(){
boolean yes=false;
try {
Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String output;
String lastLine = null;
while ((output = reader.readLine()) != null) {
lastLine = output;
}
if(lastLine!=null && lastLine.contains("Choreographer")){
Log.d(TAG,"yes!"); //do not remove!
yes=true;
}
reader.close();
process.waitFor();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return yes;
}