Prevent webview activities on > 21 api level
In 5.1 Android intruduced the concept of
prevent webviews from launching on priviledged
apps. This workaround prevents it from being
launched.
Bug: 26296119
Change-Id: I6ac7bfe465a32bef648e02a5e6cd2b80bcc53331
diff --git a/sl4a/ScriptingLayerForAndroid/src/com/googlecode/android_scripting/activity/ScriptingLayerService.java b/sl4a/ScriptingLayerForAndroid/src/com/googlecode/android_scripting/activity/ScriptingLayerService.java
index 16e4fa7..7c6e281 100644
--- a/sl4a/ScriptingLayerForAndroid/src/com/googlecode/android_scripting/activity/ScriptingLayerService.java
+++ b/sl4a/ScriptingLayerForAndroid/src/com/googlecode/android_scripting/activity/ScriptingLayerService.java
@@ -24,7 +24,9 @@
import android.content.SharedPreferences;
import android.os.Binder;
import android.os.IBinder;
+import android.os.Build;
import android.preference.PreferenceManager;
+import android.util.Log;
import com.googlecode.android_scripting.AndroidProxy;
import com.googlecode.android_scripting.BaseApplication;
@@ -60,6 +62,7 @@
private final IBinder mBinder;
private final Map<Integer, InterpreterProcess> mProcessMap;
+ private final String LOG_TAG = "sl4a";
private volatile int mModCount = 0;
private NotificationManager mNotificationManager;
private Notification mNotification;
@@ -171,7 +174,11 @@
String name = intent.getStringExtra(Constants.EXTRA_SCRIPT_PATH);
if (name != null && name.endsWith(HtmlInterpreter.HTML_EXTENSION)) {
- launchHtmlScript(intent);
+ if (Integer.valueOf(android.os.Build.VERSION.SDK) > 21) {
+ Log.e(LOG_TAG, "Starting a WebViewClient not permitted for your SDK Version.");
+ } else {
+ launchHtmlScript(intent);
+ }
if (mProcessMap.isEmpty()) {
stopSelf(startId);
}