[ 
https://issues.apache.org/jira/browse/CB-13800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16332769#comment-16332769
 ] 

ASF GitHub Bot commented on CB-13800:
-------------------------------------

infil00p closed pull request #429: CB-13800: Drop pre-KitKat specific code
URL: https://github.com/apache/cordova-android/pull/429
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/framework/src/org/apache/cordova/CordovaActivity.java 
b/framework/src/org/apache/cordova/CordovaActivity.java
index e2ed1cb82..dbbb48f69 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -123,7 +123,7 @@ public void onCreate(Bundle savedInstanceState) {
         if (preferences.getBoolean("Fullscreen", false)) {
             // NOTE: use the FullscreenNotImmersive configuration key to set 
the activity in a REAL full screen
             // (as was the case in previous cordova versions)
-            if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) && 
!preferences.getBoolean("FullscreenNotImmersive", false)) {
+            if (!preferences.getBoolean("FullscreenNotImmersive", false)) {
                 immersiveMode = true;
             } else {
                 
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java 
b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index 3ea5e5765..a27fc6af4 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -149,21 +149,6 @@ public void onExceededDatabaseQuota(String url, String 
databaseIdentifier, long
         quotaUpdater.updateQuota(MAX_QUOTA);
     }
 
-    // console.log in api level 7: 
http://developer.android.com/guide/developing/debug-tasks.html
-    // Expect this to not compile in a future Android release!
-    @SuppressWarnings("deprecation")
-    @Override
-    public void onConsoleMessage(String message, int lineNumber, String 
sourceID)
-    {
-        //This is only for Android 2.1
-        if(android.os.Build.VERSION.SDK_INT == 
android.os.Build.VERSION_CODES.ECLAIR_MR1)
-        {
-            LOG.d(LOG_TAG, "%s: Line %d : %s", sourceID, lineNumber, message);
-            super.onConsoleMessage(message, lineNumber, sourceID);
-        }
-    }
-
-    @TargetApi(8)
     @Override
     public boolean onConsoleMessage(ConsoleMessage consoleMessage)
     {
diff --git a/framework/src/org/apache/cordova/engine/SystemWebViewClient.java 
b/framework/src/org/apache/cordova/engine/SystemWebViewClient.java
index d17650240..0b6a577ea 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebViewClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebViewClient.java
@@ -112,7 +112,7 @@ public void onReceivedHttpAuthRequest(WebView view, 
HttpAuthHandler handler, Str
      * @param request
      */
     @Override
-    @TargetApi(21)
+    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
     public void onReceivedClientCertRequest (WebView view, ClientCertRequest 
request)
     {
 
@@ -219,7 +219,6 @@ public void onReceivedError(WebView view, int errorCode, 
String description, Str
      * @param handler       An SslErrorHandler object that will handle the 
user's response.
      * @param error         The SSL error object.
      */
-    @TargetApi(8)
     @Override
     public void onReceivedSslError(WebView view, SslErrorHandler handler, 
SslError error) {
 
@@ -316,7 +315,6 @@ public void clearAuthenticationTokens() {
         this.authenticationTokens.clear();
     }
 
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
     @Override
     public WebResourceResponse shouldInterceptRequest(WebView view, String 
url) {
         try {
@@ -349,7 +347,7 @@ public WebResourceResponse shouldInterceptRequest(WebView 
view, String url) {
     }
 
     private static boolean needsKitKatContentUrlFix(Uri uri) {
-        return android.os.Build.VERSION.SDK_INT >= 
android.os.Build.VERSION_CODES.KITKAT && "content".equals(uri.getScheme());
+        return "content".equals(uri.getScheme());
     }
 
     private static boolean needsSpecialsInAssetUrlFix(Uri uri) {
@@ -364,11 +362,6 @@ private static boolean needsSpecialsInAssetUrlFix(Uri uri) 
{
             return false;
         }
 
-        switch(android.os.Build.VERSION.SDK_INT){
-            case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH:
-            case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
-                return true;
-        }
         return false;
     }
 }
diff --git a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java 
b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
index d15b0eeec..1cbd7f8bb 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
@@ -121,9 +121,8 @@ public void runOnUiThread(Runnable r) {
                 
SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
             }
         }));
-        if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
-            nativeToJsMessageQueue.addBridgeMode(new 
NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
-       bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
+        nativeToJsMessageQueue.addBridgeMode(new 
NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
+        bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
         exposeJsInterface(webView, bridge);
     }
 
@@ -153,26 +152,8 @@ private void initWebViewSettings() {
         settings.setJavaScriptCanOpenWindowsAutomatically(true);
         settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
 
-        // Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated 
entirely for Jellybean 4.2)
-        try {
-            Method gingerbread_getMethod =  
WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class });
-
-            String manufacturer = android.os.Build.MANUFACTURER;
-            LOG.d(TAG, "CordovaWebView is running on device made by: " + 
manufacturer);
-            if(android.os.Build.VERSION.SDK_INT < 
android.os.Build.VERSION_CODES.HONEYCOMB &&
-                    android.os.Build.MANUFACTURER.contains("HTC"))
-            {
-                gingerbread_getMethod.invoke(settings, true);
-            }
-        } catch (NoSuchMethodException e) {
-            LOG.d(TAG, "We are on a modern version of Android, we will 
deprecate HTC 2.3 devices in 2.8");
-        } catch (IllegalArgumentException e) {
-            LOG.d(TAG, "Doing the NavDump failed with bad arguments");
-        } catch (IllegalAccessException e) {
-            LOG.d(TAG, "This should never happen: IllegalAccessException means 
this isn't Android anymore");
-        } catch (InvocationTargetException e) {
-            LOG.d(TAG, "This should never happen: InvocationTargetException 
means this isn't Android anymore.");
-        }
+        String manufacturer = android.os.Build.MANUFACTURER;
+        LOG.d(TAG, "CordovaWebView is running on device made by: " + 
manufacturer);
 
         //We don't save any form data in the application
         settings.setSaveFormData(false);
@@ -180,12 +161,9 @@ private void initWebViewSettings() {
 
         // Jellybean rightfully tried to lock this down. Too bad they didn't 
give us a whitelist
         // while we do this
-        if (android.os.Build.VERSION.SDK_INT >= 
android.os.Build.VERSION_CODES.JELLY_BEAN) {
-            settings.setAllowUniversalAccessFromFileURLs(true);
-        }
-        if (android.os.Build.VERSION.SDK_INT >= 
android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
-            settings.setMediaPlaybackRequiresUserGesture(false);
-        }
+        settings.setAllowUniversalAccessFromFileURLs(true);
+        settings.setMediaPlaybackRequiresUserGesture(false);
+
         // Enable database
         // We keep this disabled because we use or shim to get around 
DOM_EXCEPTION_ERROR_16
         String databasePath = 
webView.getContext().getApplicationContext().getDir("database", 
Context.MODE_PRIVATE).getPath();
@@ -195,8 +173,7 @@ private void initWebViewSettings() {
 
         //Determine whether we're in debug or release mode, and turn on 
Debugging!
         ApplicationInfo appInfo = 
webView.getContext().getApplicationContext().getApplicationInfo();
-        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 &&
-            android.os.Build.VERSION.SDK_INT >= 
android.os.Build.VERSION_CODES.KITKAT) {
+        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
             enableRemoteDebugging();
         }
 
@@ -244,7 +221,6 @@ public void onReceive(Context context, Intent intent) {
         // end CB-1405
     }
 
-    @TargetApi(Build.VERSION_CODES.KITKAT)
     private void enableRemoteDebugging() {
         try {
             WebView.setWebContentsDebuggingEnabled(true);
@@ -254,17 +230,9 @@ private void enableRemoteDebugging() {
         }
     }
 
-    // Yeah, we know, which is why we makes ure that we don't do this if the 
bridge is
-    // below JELLYBEAN_MR1.  It'd be great if lint was just a little smarter.
+    // Yeah, we know. It'd be great if lint was just a little smarter.
     @SuppressLint("AddJavascriptInterface")
     private static void exposeJsInterface(WebView webView, CordovaBridge 
bridge) {
-        if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
-            LOG.i(TAG, "Disabled addJavascriptInterface() bridge since Android 
version is old.");
-            // Bug being that Java Strings do not get converted to JS strings 
automatically.
-            // This isn't hard to work-around on the JS side, but it's easier 
to just
-            // use the prompt bridge instead.
-            return;
-        }
         SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge);
         webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
     }
@@ -346,12 +314,6 @@ public void destroy() {
 
     @Override
     public void evaluateJavascript(String js, ValueCallback<String> callback) {
-        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-            webView.evaluateJavascript(js, callback);
-        }
-        else
-        {
-            LOG.d(TAG, "This webview is using the old bridge");
-        }
+        webView.evaluateJavascript(js, callback);
     }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Drop pre-KitKat specific code
> -----------------------------
>
>                 Key: CB-13800
>                 URL: https://issues.apache.org/jira/browse/CB-13800
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-android
>    Affects Versions: 7.0.0
>            Reporter: Bas Bosman
>            Assignee: Bas Bosman
>            Priority: Minor
>
> With the release of cordova-android 7.0.0 the minimum API-Level was set to 19.
>  
> There are a couple of places in the codebase where we have specific logic for 
> older API-levels, which are now no longer needed and therefore can be removed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to