Promandai Movies v1.0版本的 MD5 值为:f2221e4d815efd1a22bf82a42afa3663
以下内容为反编译后的 RuntimeCompat.java 源代码,内容仅作参考
package com.bumptech.glide.load.engine.executor;
import android.os.Build;
import android.os.StrictMode;
import android.util.Log;
import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;
final class RuntimeCompat {
private static final String CPU_LOCATION = "/sys/devices/system/cpu/";
private static final String CPU_NAME_REGEX = "cpu[0-9]+";
private static final String TAG = "GlideRuntimeCompat";
private RuntimeCompat() {
}
public static int availableProcessors() {
int cpus = Runtime.getRuntime().availableProcessors();
if (Build.VERSION.SDK_INT < 17) {
return Math.max(getCoreCountPre17(), cpus);
}
return cpus;
}
private static int getCoreCountPre17() {
File[] cpus = null;
StrictMode.ThreadPolicy originalPolicy = StrictMode.allowThreadDiskReads();
try {
File cpuInfo = new File(CPU_LOCATION);
final Pattern cpuNamePattern = Pattern.compile(CPU_NAME_REGEX);
cpus = cpuInfo.listFiles(new FilenameFilter() {
@Override
public boolean accept(File file, String s) {
return cpuNamePattern.matcher(s).matches();
}
});
} catch (Throwable t) {
try {
if (Log.isLoggable(TAG, 6)) {
Log.e(TAG, "Failed to calculate accurate cpu count", t);
}
StrictMode.setThreadPolicy(originalPolicy);
} finally {
StrictMode.setThreadPolicy(originalPolicy);
}
}
return Math.max(1, cpus != null ? cpus.length : 0);
}
}