From f44869289699baa0ec3485cfc0f9929cd46a46c7 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 11 Nov 2021 14:12:13 +0800 Subject: [PATCH] android: fix when there's no permission, crash will happen --- .../java/pub/doric/devkit/util/SimulatorUtil.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/util/SimulatorUtil.java b/doric-android/devkit/src/main/java/pub/doric/devkit/util/SimulatorUtil.java index 72a63e0c..672f878c 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/util/SimulatorUtil.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/util/SimulatorUtil.java @@ -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() {