Merge "Add version code support for mips64."
diff --git a/chromium/java/com/android/webview/chromium/DataReductionProxyManager.java b/chromium/java/com/android/webview/chromium/DataReductionProxyManager.java
deleted file mode 100644
index aafd41e..0000000
--- a/chromium/java/com/android/webview/chromium/DataReductionProxyManager.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.webview.chromium;
-
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.database.SQLException;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.Handler;
-import android.provider.Settings;
-import android.util.Log;
-import android.webkit.WebView;
-
-import org.chromium.android_webview.AwContentsStatics;
-import org.chromium.base.CommandLine;
-
-import java.lang.reflect.Field;
-
-/**
- * Controls data reduction proxy. This logic will be moved to upstream fully.
- */
-public final class DataReductionProxyManager {
-
-    // The setting Uri. Used when querying GoogleSettings.
-    private static final Uri CONTENT_URI = Uri.parse("content://com.google.settings/partner");
-
-    // Setting name for allowing data reduction proxy. Used when querying GoogleSettings.
-    // Setting type: int ( 0 = disallow, 1 = allow )
-    private static final String WEBVIEW_DATA_REDUCTION_PROXY = "use_webview_data_reduction_proxy";
-
-    private static final String DRP_CLASS = "com.android.webview.chromium.Drp";
-    private static final String TAG = "DataReductionProxySettingListener";
-
-    // This is the same as Chromium data_reduction_proxy::switches::kEnableDataReductionProxy.
-    private static final String ENABLE_DATA_REDUCTION_PROXY = "enable-spdy-proxy-auth";
-    // This is the same as Chromium data_reduction_proxy::switches::kDataReductionProxyKey.
-    private static final String DATA_REDUCTION_PROXY_KEY = "spdy-proxy-auth-value";
-
-    /*
-     * Listen for DataReductionProxySetting changes and take action.
-     * TODO: This is the old mechanism. Will be obsolete after L release.
-     * remove before release.
-     */
-    private static final class ProxySettingListener extends BroadcastReceiver {
-
-        final String mKey;
-
-        ProxySettingListener(final String key) {
-            mKey = key;
-        }
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            applyDataReductionProxySettingsAsync(context, mKey);
-        }
-    }
-
-    private ProxySettingListener mProxySettingListener;
-
-    private ContentObserver mProxySettingObserver;
-
-    public DataReductionProxyManager() { }
-
-    public void start(final Context context) {
-        // This is the DRP key embedded in WebView apk.
-        final String embeddedKey = readKey();
-
-        // Developers could test DRP by passing ENABLE_DATA_REDUCTION_PROXY and (optionally)
-        // DATA_REDUCTION_PROXY_KEY to the commandline switches.  In this case, we will try to
-        // initialize DRP from commandline. And ignore user's preference.  If
-        // DATA_REDUCTION_PROXY_KEY is specified in commandline, use it.  Otherwise, use the key
-        // embedded in WebView apk.
-        CommandLine cl = CommandLine.getInstance();
-        if (cl.hasSwitch(ENABLE_DATA_REDUCTION_PROXY)) {
-            String key = cl.getSwitchValue(DATA_REDUCTION_PROXY_KEY, embeddedKey);
-            if (key == null || key.isEmpty()) {
-                return;
-            }
-
-            // Now we will enable DRP because we've got a commandline switch to enable it.
-            // We won't listen to Google Settings preference change because commandline switches
-            // trump that.
-            AwContentsStatics.setDataReductionProxyKey(key);
-            AwContentsStatics.setDataReductionProxyEnabled(true);
-            return;
-        }
-
-        // Now, there is no commandline switches to enable DRP, and reading the
-        // DRP key from WebView apk failed. Just return and leave DRP disabled.
-        if (embeddedKey == null || embeddedKey.isEmpty()) {
-            return;
-        }
-
-        applyDataReductionProxySettingsAsync(context, embeddedKey);
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(WebView.DATA_REDUCTION_PROXY_SETTING_CHANGED);
-        mProxySettingListener = new ProxySettingListener(embeddedKey);
-        context.registerReceiver(mProxySettingListener, filter);
-        ContentResolver resolver = context.getContentResolver();
-        mProxySettingObserver = new ContentObserver(new Handler()) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri) {
-                applyDataReductionProxySettingsAsync(context, embeddedKey);
-            }
-        };
-        resolver.registerContentObserver(
-                    Uri.withAppendedPath(CONTENT_URI, WEBVIEW_DATA_REDUCTION_PROXY),
-                    false, mProxySettingObserver);
-    }
-
-    private String readKey() {
-        try {
-            Class<?> cls = Class.forName(DRP_CLASS);
-            Field f = cls.getField("KEY");
-            return (String) f.get(null);
-        } catch (ClassNotFoundException ex) {
-            Log.e(TAG, "No DRP key due to exception:" + ex);
-        } catch (NoSuchFieldException ex) {
-            Log.e(TAG, "No DRP key due to exception:" + ex);
-        } catch (SecurityException ex) {
-            Log.e(TAG, "No DRP key due to exception:" + ex);
-        } catch (IllegalArgumentException ex) {
-            Log.e(TAG, "No DRP key due to exception:" + ex);
-        } catch (IllegalAccessException ex) {
-            Log.e(TAG, "No DRP key due to exception:" + ex);
-        } catch (NullPointerException ex) {
-            Log.e(TAG, "No DRP key due to exception:" + ex);
-        }
-        return null;
-    }
-
-    private static void applyDataReductionProxySettingsAsync(final Context context,
-            final String key) {
-        AsyncTask<Void, Void, Boolean> task = new AsyncTask<Void, Void, Boolean>() {
-            @Override
-            protected Boolean doInBackground(Void... params) {
-                return isDataReductionProxyEnabled(context);
-            }
-            @Override
-            protected void onPostExecute(Boolean enabled) {
-                if (enabled) {
-                    // Set the data reduction proxy key.
-                    AwContentsStatics.setDataReductionProxyKey(key);
-                }
-                AwContentsStatics.setDataReductionProxyEnabled(enabled);
-            }
-        };
-        task.execute();
-    }
-
-    private static boolean isDataReductionProxyEnabled(Context context) {
-        return getProxySetting(context.getContentResolver(),
-                    WEBVIEW_DATA_REDUCTION_PROXY) != 0;
-    }
-
-    // Read query setting from GoogleSettings.
-    private static int getProxySetting(ContentResolver resolver, String name) {
-        String value = null;
-        Cursor c = null;
-        try {
-            c = resolver.query(CONTENT_URI, new String[] { "value" },
-                    "name=?", new String[]{ name }, null);
-            if (c != null && c.moveToNext()) value = c.getString(0);
-        } catch (SQLException e) {
-            // SQL error: return null, but don't cache it.
-            Log.e(TAG, "Can't get key " + name + " from " + CONTENT_URI, e);
-        } finally {
-            if (c != null) c.close();
-        }
-        int enabled = 0;
-        try {
-            if (value != null) {
-                enabled = Integer.parseInt(value);
-            }
-        } catch (NumberFormatException e) {
-            Log.e(TAG, "cannot parse" + value, e);
-        }
-        return enabled;
-    }
-}
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java
index 6cf4238..b38c40d 100644
--- a/chromium/java/com/android/webview/chromium/WebViewChromium.java
+++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java
@@ -1348,19 +1348,27 @@
         if (client == null) {
             return false;
         }
-        // If client is not a subclass of WebChromeClient then the methods have not been
-        // implemented because WebChromeClient has empty implementations.
-        if (client.getClass().isAssignableFrom(WebChromeClient.class)) {
-            return false;
+        Class<?> clientClass = client.getClass();
+        boolean foundShowMethod = false;
+        boolean foundHideMethod = false;
+        while (clientClass != WebChromeClient.class && (!foundShowMethod || !foundHideMethod)) {
+            if (!foundShowMethod) {
+                try {
+                    clientClass.getDeclaredMethod("onShowCustomView", View.class,
+                            CustomViewCallback.class);
+                    foundShowMethod = true;
+                } catch (NoSuchMethodException e) { }
+            }
+
+            if (!foundHideMethod) {
+                try {
+                    clientClass.getDeclaredMethod("onHideCustomView");
+                    foundHideMethod = true;
+                } catch (NoSuchMethodException e) { }
+            }
+            clientClass = clientClass.getSuperclass();
         }
-        try {
-            client.getClass().getDeclaredMethod("onShowCustomView", View.class,
-                    CustomViewCallback.class);
-            client.getClass().getDeclaredMethod("onHideCustomView");
-            return true;
-        } catch (NoSuchMethodException e) {
-            return false;
-        }
+        return foundShowMethod && foundHideMethod;
     }
 
     @Override
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
index f54c964..95fff1e 100644
--- a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
+++ b/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
@@ -96,7 +96,6 @@
     // Read/write protected by mLock.
     private boolean mStarted;
 
-    private DataReductionProxyManager mProxyManager;
     private SharedPreferences mWebViewPrefs;
     private WebViewDelegate mWebViewDelegate;
 
@@ -133,6 +132,7 @@
         cl.appendSwitch("enable-dcheck");
 
         ThreadUtils.setWillOverrideUiThread();
+
         // Load chromium library.
         AwBrowserProcess.loadLibrary();
 
@@ -283,10 +283,6 @@
         }
         mWebViewsToStart.clear();
         mWebViewsToStart = null;
-
-        // Start listening for data reduction proxy setting changes.
-        mProxyManager = new DataReductionProxyManager();
-        mProxyManager.start(mWebViewDelegate.getApplication());
     }
 
     boolean hasStarted() {
diff --git a/chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java b/chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java
index 2bf6f14..309ca1e 100644
--- a/chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java
+++ b/chromium/java/com/android/webview/chromium/WebViewDelegateFactory.java
@@ -10,7 +10,6 @@
 import android.util.SparseArray;
 import android.view.View;
 
-
 import java.lang.reflect.Method;
 
 /**
diff --git a/chromium/listing/res/values-my-rMM/strings.xml b/chromium/listing/res/values-my-rMM/strings.xml
index b2c646c..276347b 100644
--- a/chromium/listing/res/values-my-rMM/strings.xml
+++ b/chromium/listing/res/values-my-rMM/strings.xml
@@ -8,6 +8,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="webviewgoogle_play_store_title" msgid="6227907912304696478">"Android စနစ် ဝက်ဘ်မြင်ကွင်း"</string>
-    <string name="webviewgoogle_play_store_tagline" msgid="825305078705915422">"Chrome မှ မောင်းနှင်ပေးသည့် ဝက်ဘ် အကြောင်းအရာများ"</string>
-    <string name="webviewgoogle_play_store_description" msgid="3054088773113944489">"အန်ဒရွိုက် ၀ကဘ်မြင်ကွင်းမှာ Chrome မှ မောင်းနှင်သည့် စနစ် အစိတ်အပိုင်း တစ်ခုဖြစ်ပြီး အန်ဒရွိုက်အား ဝက်ဘ် အကြောင်းအရာများကို ပြခွင့်ပြုသည်။ ထိုအပိုင်းကို သင်၏ ကိရိယာ ထဲမှာ ကြိုတပ်ဆင်ထားပြီ ဖြစ်ကာ သင့်ဆီမှာ နောက်ဆုံး လုံခြုံရေး မွမ်းမံမှုများ နှင့် အခြားသော ဘာဂ် ပြပြင်မှုများ ရှိနေတာကို စစ်ကြည့်ရန် လိုပါသည်။"</string>
+    <string name="webviewgoogle_play_store_tagline" msgid="825305078705915422">"Chrome မှ မောင်းနှင်ပေးသည့် ဝက်ဘ် အကြောင်းအရာများ"</string>
+    <string name="webviewgoogle_play_store_description" msgid="3054088773113944489">"အန်ဒရွိုက် ၀ကဘ်မြင်ကွင်းမှာ Chrome မှ မောင်းနှင်သည့် စနစ် အစိတ်အပိုင်း တစ်ခုဖြစ်ပြီး အန်ဒရွိုက်အား ဝက်ဘ် အကြောင်းအရာများကို ပြခွင့်ပြုသည်။ ထိုအပိုင်းကို သင်၏ ကိရိယာ ထဲမှာ ကြိုတပ်ဆင်ထားပြီ ဖြစ်ကာ သင့်ဆီမှာ နောက်ဆုံး လုံခြုံရေး မွမ်းမံမှုများ နှင့် အခြားသော ဘာဂ် ပြပြင်မှုများ ရှိနေတာကို စစ်ကြည့်ရန် လိုပါသည်။"</string>
 </resources>
diff --git a/chromium/package.mk b/chromium/package.mk
index 2f890ca..061b40e 100644
--- a/chromium/package.mk
+++ b/chromium/package.mk
@@ -35,6 +35,8 @@
 
 LOCAL_MODULE_TAGS := optional
 
+LOCAL_SDK_VERSION := system_current
+
 LOCAL_STATIC_JAVA_LIBRARIES += android_webview_java_with_new_resources
 
 LOCAL_SRC_FILES := $(call all-java-files-under, java)