android: fix when there's no permission, crash will happen

This commit is contained in:
pengfei.zhou 2021-11-11 14:12:13 +08:00 committed by osborn
parent fb65b35b7b
commit f448692896

View File

@ -30,11 +30,16 @@ import java.io.InputStreamReader;
public class SimulatorUtil {
public static boolean isSimulator(Context context) {
return notHasBlueTooth()
|| notHasLightSensorManager(context)
|| isFeatures()
|| checkIsNotRealPhone()
|| checkPipes();
try {
return notHasBlueTooth()
|| notHasLightSensorManager(context)
|| isFeatures()
|| checkIsNotRealPhone()
|| checkPipes();
} catch (Throwable e) {
e.printStackTrace();
return false;
}
}
private static boolean notHasBlueTooth() {