从终端运行以下命令时:
亚行外壳转储系统 | grep GLES
输出是:
GLES:高通、Adreno (TM) 330、OpenGL ES 3.0 V@53.0 AU@ (CL@)
但是,以编程方式运行时我无法获得输出。
String GPUModel = "";
String command = "adb shell dumpsys | grep GLES";
try {
InputStream inputStream = Runtime.getRuntime()
.exec(command)
.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
GPUModel = bufferedReader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
GPUModel 为空。