mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-11 00:00:05 +08:00
Refactor to avoid adb warnings of VFY: on start-up.
This commit is contained in:
@@ -215,10 +215,10 @@ public class CordovaWebView extends WebView {
|
|||||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
|
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
|
||||||
settings.setNavDump(true);
|
settings.setNavDump(true);
|
||||||
|
|
||||||
//Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
|
// Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
|
||||||
//while we do this
|
// while we do this
|
||||||
if(android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
|
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
|
||||||
settings.setAllowUniversalAccessFromFileURLs(true);
|
Level16Apis.enableUniversalAccess(settings);
|
||||||
// Enable database
|
// Enable database
|
||||||
settings.setDatabaseEnabled(true);
|
settings.setDatabaseEnabled(true);
|
||||||
String databasePath = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
|
String databasePath = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
|
||||||
@@ -891,4 +891,13 @@ public class CordovaWebView extends WebView {
|
|||||||
public boolean hadKeyEvent() {
|
public boolean hadKeyEvent() {
|
||||||
return handleButton;
|
return handleButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapping these functions in their own class prevents warnings in adb like:
|
||||||
|
// VFY: unable to resolve virtual method 285: Landroid/webkit/WebSettings;.setAllowUniversalAccessFromFileURLs
|
||||||
|
@TargetApi(16)
|
||||||
|
private static class Level16Apis {
|
||||||
|
static void enableUniversalAccess(WebSettings settings) {
|
||||||
|
settings.setAllowUniversalAccessFromFileURLs(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user