Skip to content

Commit 41f99e5

Browse files
committed
Optimized reading app debuggable.
1 parent 4bd799b commit 41f99e5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

CoreLibrary/src/main/java/com/didi/virtualapk/internal/VAInstrumentation.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.content.Context;
2727
import android.content.Intent;
2828
import android.content.pm.ActivityInfo;
29+
import android.content.pm.ApplicationInfo;
2930
import android.os.Build;
3031
import android.os.Bundle;
3132
import android.os.Handler;
@@ -116,10 +117,15 @@ public Activity newActivity(ClassLoader cl, String className, Intent intent) thr
116117

117118
if (plugin == null) {
118119
// Not found then goto stub activity.
119-
Context context = this.mPluginManager.getHostContext();
120-
Boolean debugMode = Reflector.QuietReflector.on(context.getPackageName() + ".BuildConfig").field("DEBUG").get();
121-
122-
if (debugMode != null && debugMode) {
120+
boolean debuggable = false;
121+
try {
122+
Context context = this.mPluginManager.getHostContext();
123+
debuggable = (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
124+
} catch (Throwable ex) {
125+
126+
}
127+
128+
if (debuggable) {
123129
throw new ActivityNotFoundException("error intent: " + intent.toURI());
124130
}
125131

0 commit comments

Comments
 (0)