Merge "Normalize HDPI and MDPI assets"
diff --git a/res/drawable-hdpi/arcs.png b/res/drawable-hdpi/arcs.png
deleted file mode 100644
index 9555a9f..0000000
--- a/res/drawable-hdpi/arcs.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_close_window.png b/res/drawable-hdpi/btn_close_window.png
deleted file mode 100644
index 12e5c55..0000000
--- a/res/drawable-hdpi/btn_close_window.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/fav_icn_background.png b/res/drawable-hdpi/fav_icn_background.png
deleted file mode 100644
index a4ee08a..0000000
--- a/res/drawable-hdpi/fav_icn_background.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/textfield_voice_search.9.png b/res/drawable-hdpi/textfield_voice_search.9.png
deleted file mode 100644
index 5d3f281..0000000
--- a/res/drawable-hdpi/textfield_voice_search.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/url_bg_active.9.png b/res/drawable-hdpi/url_bg_active.9.png
deleted file mode 100644
index 479acb1..0000000
--- a/res/drawable-hdpi/url_bg_active.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/url_bg_default.9.png b/res/drawable-hdpi/url_bg_default.9.png
deleted file mode 100644
index 7db9db4..0000000
--- a/res/drawable-hdpi/url_bg_default.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/arcs.png b/res/drawable-mdpi/arcs.png
deleted file mode 100644
index 5e0d949..0000000
--- a/res/drawable-mdpi/arcs.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/btn_close_window.png b/res/drawable-mdpi/btn_close_window.png
deleted file mode 100644
index 53f878b..0000000
--- a/res/drawable-mdpi/btn_close_window.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/fav_icn_background.png b/res/drawable-mdpi/fav_icn_background.png
deleted file mode 100755
index 9275ff3..0000000
--- a/res/drawable-mdpi/fav_icn_background.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/help_useragent_laptop.png b/res/drawable-mdpi/help_useragent_laptop.png
deleted file mode 100644
index 59aa721..0000000
--- a/res/drawable-mdpi/help_useragent_laptop.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/help_useragent_tablet.png b/res/drawable-mdpi/help_useragent_tablet.png
deleted file mode 100644
index 7b579cd..0000000
--- a/res/drawable-mdpi/help_useragent_tablet.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/textfield_voice_search.9.png b/res/drawable-mdpi/textfield_voice_search.9.png
deleted file mode 100644
index e7baba0..0000000
--- a/res/drawable-mdpi/textfield_voice_search.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/blank.xml b/res/drawable/blank.xml
deleted file mode 100644
index 724f5e7..0000000
--- a/res/drawable/blank.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape>
- <corners android:radius="5dip"/>
- <solid android:color="@color/white"/>
- </shape>
- </item>
-</layer-list>
diff --git a/res/drawable/btn_bookmark.xml b/res/drawable/btn_bookmark.xml
deleted file mode 100644
index ce169d0..0000000
--- a/res/drawable/btn_bookmark.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<!-- Custom layout file which mimics the btn_search_dialog_voice look, but draws
- the pressed state even without window focus -->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
- android:drawable="@*android:drawable/btn_search_dialog_voice_pressed" />
- <item android:state_pressed="false"
- android:drawable="@*android:drawable/btn_search_dialog_voice_default" />
-</selector>
diff --git a/res/drawable/button_bg_selected.xml b/res/drawable/button_bg_selected.xml
deleted file mode 100644
index d0c677b..0000000
--- a/res/drawable/button_bg_selected.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
- <!--
- Copyright (C) 2010 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.
- -->
-<shape
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <solid
- android:color="#ff4d83ba" />
-</shape>
\ No newline at end of file
diff --git a/res/drawable/close_background.xml b/res/drawable/close_background.xml
deleted file mode 100644
index 627712f..0000000
--- a/res/drawable/close_background.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_window_focused="false"
- android:drawable="@android:color/transparent" />
- <item android:state_focused="false" android:state_pressed="true"
- android:drawable="@*android:drawable/list_selector_background_transition" />
- <item android:state_focused="false" android:state_pressed="false"
- android:drawable="@color/black"/>
-</selector>
diff --git a/res/drawable/stop_background.xml b/res/drawable/stop_background.xml
deleted file mode 100644
index a9a4dd4..0000000
--- a/res/drawable/stop_background.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- Custom background for the stop button which mimics btn_search_dialog
- but draws in a pressed state even if it is in an unfocused window -->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_pressed="true"
- android:drawable="@*android:drawable/btn_search_dialog_pressed" />
- <item android:state_pressed="false"
- android:drawable="@*android:drawable/btn_search_dialog_default" />
-</selector>
diff --git a/res/drawable/title_loading.xml b/res/drawable/title_loading.xml
deleted file mode 100644
index 7f145d3..0000000
--- a/res/drawable/title_loading.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- Custom layout file which mimics the textfield_search look, but draws the
- pressed state even without window focus -->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_pressed="true"
- android:drawable="@*android:drawable/textfield_search_pressed" />
-
- <item android:state_enabled="true" android:state_focused="true"
- android:drawable="@*android:drawable/textfield_search_selected" />
-
- <item android:drawable="@*android:drawable/textfield_search_default" />
-
-</selector>
-
diff --git a/res/drawable/title_text.xml b/res/drawable/title_text.xml
deleted file mode 100644
index b435e4d..0000000
--- a/res/drawable/title_text.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<!-- Custom layout file which mimics the standard edit_text look, but draws the
- pressed state even without window focus -->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
- android:drawable="@*android:drawable/textfield_search_empty_pressed" />
- <item android:state_pressed="false"
- android:drawable="@*android:drawable/textfield_search_empty_default" />
-</selector>
diff --git a/res/drawable/title_voice.xml b/res/drawable/title_voice.xml
deleted file mode 100644
index e96eb94..0000000
--- a/res/drawable/title_voice.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true"
- android:drawable="@*android:drawable/textfield_search_empty_pressed" />
- <item android:state_pressed="false"
- android:drawable="@drawable/textfield_voice_search" />
-</selector>
diff --git a/res/drawable/url_selector.xml b/res/drawable/url_selector.xml
deleted file mode 100644
index d4febe6..0000000
--- a/res/drawable/url_selector.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:state_focused="true"
- android:drawable="@drawable/url_bg_active" />
- <item
- android:state_focused="false"
- android:drawable="@drawable/url_bg_default" />
-</selector>
\ No newline at end of file
diff --git a/res/layout/website_settings_row.xml b/res/layout/website_settings_row.xml
index 6308035..3df63e2 100644
--- a/res/layout/website_settings_row.xml
+++ b/res/layout/website_settings_row.xml
@@ -27,7 +27,7 @@
android:layout_marginLeft="18dip"
android:layout_marginRight="18dip"
android:layout_centerVertical="true"
- android:background="@drawable/fav_icn_background"
+ android:background="@drawable/bookmark_list_favicon_bg"
android:padding="2dip" />
<LinearLayout android:id="@+id/features"
diff --git a/src/com/android/browser/KeyChainLookup.java b/src/com/android/browser/KeyChainLookup.java
new file mode 100644
index 0000000..7f236e5
--- /dev/null
+++ b/src/com/android/browser/KeyChainLookup.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 201 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.browser;
+
+import android.content.Context;
+import android.os.AsyncTask;
+import android.os.RemoteException;
+import android.security.KeyChain;
+import android.webkit.ClientCertRequestHandler;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+
+final class KeyChainLookup extends AsyncTask<Void, Void, Void> {
+ private final Context mContext;
+ private final ClientCertRequestHandler mHandler;
+ private final String mAlias;
+ KeyChainLookup(Context context, ClientCertRequestHandler handler, String alias) {
+ mContext = context;
+ mHandler = handler;
+ mAlias = alias;
+ }
+ @Override protected Void doInBackground(Void... params) {
+ PrivateKey privateKey;
+ X509Certificate[] certificateChain;
+ try {
+ privateKey = KeyChain.getPrivateKey(mContext, mAlias);
+ certificateChain = KeyChain.getCertificateChain(mContext, mAlias);
+ } catch (InterruptedException e) {
+ mHandler.ignore();
+ return null;
+ } catch (RemoteException e) {
+ mHandler.ignore();
+ return null;
+ }
+ mHandler.proceed(privateKey, certificateChain);
+ return null;
+ }
+}
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java
index 6ef759f..eeca95a 100644
--- a/src/com/android/browser/NavScreen.java
+++ b/src/com/android/browser/NavScreen.java
@@ -169,16 +169,12 @@
private void onCloseTab(Tab tab) {
if (tab != null) {
- mUiController.closeTab(tab);
- if (mUiController.getTabControl().getTabCount() == 0) {
- openNewTab();
- } else {
- mAdapter.notifyDataSetChanged();
- }
+ switchToSelected();
+ mUiController.closeCurrentTab();
+ mAdapter.notifyDataSetChanged();
}
}
-
private void openNewTab() {
// need to call openTab explicitely with setactive false
Tab tab = mUiController.openTab(BrowserSettings.getInstance().getHomePage(),
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index f94a8ab..d7f84b5 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -312,6 +312,7 @@
}
void hideNavScreen(boolean animate) {
+ if (mNavScreen == null) return;
Tab tab = mNavScreen.getSelectedTab();
mCustomViewContainer.removeView(mNavScreen);
mNavScreen = null;
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 95c7850..e517d76 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -32,12 +32,15 @@
import android.os.Bundle;
import android.os.Message;
import android.os.SystemClock;
+import android.security.KeyChain;
+import android.security.KeyChainAliasResponse;
import android.speech.RecognizerResultsIntent;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewStub;
+import android.webkit.ClientCertRequestHandler;
import android.webkit.ConsoleMessage;
import android.webkit.DownloadListener;
import android.webkit.GeolocationPermissions;
@@ -791,6 +794,27 @@
}
/**
+ * Displays client certificate request to the user.
+ */
+ @Override
+ public void onReceivedClientCertRequest(final WebView view,
+ final ClientCertRequestHandler handler, final String host_and_port) {
+ if (!mInForeground) {
+ handler.ignore();
+ return;
+ }
+ KeyChain.choosePrivateKeyAlias(mActivity, new KeyChainAliasResponse() {
+ @Override public void alias(String alias) {
+ if (alias == null) {
+ handler.cancel();
+ return;
+ }
+ new KeyChainLookup(mActivity, handler, alias).execute();
+ }
+ });
+ }
+
+ /**
* Handles an HTTP authentication request.
*
* @param handler The authentication handler
@@ -1232,6 +1256,11 @@
mClient.onReceivedSslError(view, handler, error);
}
@Override
+ public void onReceivedClientCertRequest(WebView view,
+ ClientCertRequestHandler handler, String host_and_port) {
+ mClient.onReceivedClientCertRequest(view, handler, host_and_port);
+ }
+ @Override
public void onReceivedHttpAuthRequest(WebView view,
HttpAuthHandler handler, String host, String realm) {
mClient.onReceivedHttpAuthRequest(view, handler, host, realm);
diff --git a/tests/src/com/android/browser/JNIBindingsTestApp.java b/tests/src/com/android/browser/JNIBindingsTestApp.java
index f4efa2c..5d1fd0d 100644
--- a/tests/src/com/android/browser/JNIBindingsTestApp.java
+++ b/tests/src/com/android/browser/JNIBindingsTestApp.java
@@ -23,6 +23,7 @@
import android.os.Message;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
+import android.webkit.ClientCertRequestHandler;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
@@ -220,6 +221,16 @@
handler.proceed();
}
+ /**
+ * Ignores and logs SSL client certificate requests.
+ */
+ @Override
+ public void onReceivedClientCertRequest(WebView view, ClientCertRequestHandler handler,
+ String host_and_port) {
+ Log.w(TAG, "SSL client certificate request: " + host_and_port);
+ handler.cancel();
+ }
+
});
}
diff --git a/tests/src/com/android/browser/PopularUrlsTest.java b/tests/src/com/android/browser/PopularUrlsTest.java
index a635f0b..f1ab71b 100644
--- a/tests/src/com/android/browser/PopularUrlsTest.java
+++ b/tests/src/com/android/browser/PopularUrlsTest.java
@@ -24,6 +24,7 @@
import android.test.ActivityInstrumentationTestCase2;
import android.text.TextUtils;
import android.util.Log;
+import android.webkit.ClientCertRequestHandler;
import android.webkit.DownloadListener;
import android.webkit.HttpAuthHandler;
import android.webkit.JsPromptResult;
@@ -225,6 +226,16 @@
}
/**
+ * Ignores and logs SSL client certificate requests.
+ */
+ @Override
+ public void onReceivedClientCertRequest(WebView view, ClientCertRequestHandler handler,
+ String host_and_port) {
+ Log.w(TAG, "SSL client certificate request: " + host_and_port);
+ handler.cancel();
+ }
+
+ /**
* Ignores http auth with dummy username and password
*/
@Override
diff --git a/tests/src/com/android/browser/TestWebViewClient.java b/tests/src/com/android/browser/TestWebViewClient.java
index 7159a7e..208a822 100644
--- a/tests/src/com/android/browser/TestWebViewClient.java
+++ b/tests/src/com/android/browser/TestWebViewClient.java
@@ -20,6 +20,7 @@
import android.net.http.SslError;
import android.os.Message;
import android.view.KeyEvent;
+import android.webkit.ClientCertRequestHandler;
import android.webkit.HttpAuthHandler;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
@@ -102,6 +103,13 @@
/** {@inheritDoc} */
@Override
+ public void onReceivedClientCertRequest(WebView view, ClientCertRequestHandler handler,
+ String host_and_port) {
+ mWrappedClient.onReceivedClientCertRequest(view, handler, host_and_port);
+ }
+
+ /** {@inheritDoc} */
+ @Override
public void onReceivedHttpAuthRequest(WebView view,
HttpAuthHandler handler, String host, String realm) {
mWrappedClient.onReceivedHttpAuthRequest(view, handler, host, realm);