How SafeWebView works
masterSafeWebView addresses four main issues in Android WebView development:
- Security: Mitigates vulnerabilities associated with
addJavascriptInterface. - JS-to-Java Callbacks: Supports passing JavaScript functions from the web page to the Java layer for easy callbacks.
- Stability: Resolves various WebView-related crashes.
- Proxy Support: Implements proxy settings for different Android versions using Java reflection.
Core Mechanism:
Instead of direct injection which can be insecure, SafeWebView uses prompt as a bridge. It uses reflection to call methods in the Java interface class by passing the method name, parameter types, and encapsulated parameters as a JSON string via the prompt mechanism.