-
Notifications
You must be signed in to change notification settings - Fork 0
release v2.0.0 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| GlamArLogger.d("Glam_myApp", "onCreate: ") | ||
|
|
||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||
| WebView.setWebContentsDebuggingEnabled(true) |
Check failure
Code scanning / CodeQL
Android Webview debugging enabled High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix the problem, the call to WebView.setWebContentsDebuggingEnabled(true) should be guarded so debugging is only enabled in debug builds. The safest and most canonical way is to check the ApplicationInfo.FLAG_DEBUGGABLE flag at runtime; this indicates whether the app was built as debuggable (as is typical during development) or not (as is typical for production releases). In Kotlin, you can check it as follows:
if (0 != (applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE)) {
WebView.setWebContentsDebuggingEnabled(true)
}This fix should be applied in app/src/main/java/io/pixelbin/glamar/sample/MyApp.kt, replacing the unconditional call at line 20. You will also need to add an import for android.content.pm.ApplicationInfo if it is not already present.
-
Copy modified line R7 -
Copy modified lines R21-R23
| @@ -4,6 +4,7 @@ | ||
| import android.os.Build | ||
| import android.webkit.WebView | ||
| import android.widget.FrameLayout.LayoutParams | ||
| import android.content.pm.ApplicationInfo | ||
| import io.pixelbin.glamar.GlamAr | ||
| import io.pixelbin.glamar.GlamArLogger | ||
| import io.pixelbin.glamar.model.Configuration | ||
| @@ -17,7 +18,9 @@ | ||
| GlamArLogger.d("Glam_myApp", "onCreate: ") | ||
|
|
||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||
| WebView.setWebContentsDebuggingEnabled(true) | ||
| if (0 != (applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE)) { | ||
| WebView.setWebContentsDebuggingEnabled(true) | ||
| } | ||
| } | ||
|
|
||
| val webView = WebView( |
release v2.0.0