merge in ics-release history after reset to master
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d215724..d4d6467 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -498,8 +498,10 @@
<string name="pref_min_font_size">Minimum font size</string>
<!-- Label for the current minimum font size value [CHAR LIMIT=6] -->
<string name="pref_min_font_size_value"><xliff:g id="font_size">%d</xliff:g>pt</string>
- <!-- Label for text zoom (percent) [CHAR LIMIT=30] -->
- <string name="pref_text_zoom">Text zoom</string>
+ <!-- Label for text scaling (percent) [CHAR LIMIT=30] -->
+ <string name="pref_text_zoom">Text scaling</string>
+ <!-- Label for zoom on double-tap (percent) [CHAR LIMIT=30] -->
+ <string name="pref_zoom_on_double_tap">Zoom on double-tap</string>
<!-- Label for whether or not to force-enable user scalablity (aka, zoom) [CHAR LIMIT=30] -->
<string name="pref_force_userscalable">Force enable zoom</string>
<!-- Summary for whether or not to force-enable user scalablity (aka, zoom) [CHAR LIMIT=30] -->
@@ -625,7 +627,7 @@
<!-- Title for accessibility settings [CHAR LIMIT=25] -->
<string name="pref_accessibility_title">Accessibility</string>
<!-- Font size settings category under accessibility settings [CHAR LIMIT=50] -->
- <string name="pref_font_size_category">Font size</string>
+ <string name="pref_font_size_category">Text size</string>
<!-- Title for lab settings [CHAR LIMIT=25] -->
<string name="pref_lab_title">Labs</string>
<!-- Title for lab quick controls feature [CHAR LIMIT=40] -->
diff --git a/res/xml/bandwidth_preferences.xml b/res/xml/bandwidth_preferences.xml
index f294026..bb1688e 100644
--- a/res/xml/bandwidth_preferences.xml
+++ b/res/xml/bandwidth_preferences.xml
@@ -20,7 +20,6 @@
android:key="preload_when"
android:title="@string/pref_data_preload_title"
android:summary="@string/pref_data_preload_summary"
- android:defaultValue="@string/pref_data_preload_default_value"
android:entries="@array/pref_data_preload_choices"
android:entryValues="@array/pref_data_preload_values"
android:dialogTitle="@string/pref_data_preload_dialogtitle" />
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index f93edde..3128934 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -203,6 +203,7 @@
updateNavigationState(tab);
mTitleBar.onTabDataChanged(tab);
mNavigationBar.onTabDataChanged(tab);
+ onProgressChanged(tab);
}
@Override
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index b9eec9c..145178b 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -20,11 +20,13 @@
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Build;
import android.os.Message;
import android.preference.PreferenceManager;
import android.provider.Browser;
+import android.provider.Settings;
import android.util.DisplayMetrics;
import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
@@ -427,7 +429,13 @@
}
public void setDebugEnabled(boolean value) {
- mPrefs.edit().putBoolean(PREF_DEBUG_MENU, value).apply();
+ Editor edit = mPrefs.edit();
+ edit.putBoolean(PREF_DEBUG_MENU, value);
+ if (!value) {
+ // Reset to "safe" value
+ edit.putBoolean(PREF_ENABLE_HARDWARE_ACCEL_SKIA, false);
+ }
+ edit.apply();
}
public void clearCache() {
@@ -802,8 +810,16 @@
return context.getResources().getString(R.string.pref_data_preload_value_always);
}
- private String getDefaultPreloadSetting() {
- return mContext.getResources().getString(R.string.pref_data_preload_default_value);
+ private static final String DEAULT_PRELOAD_SECURE_SETTING_KEY =
+ "browser_default_preload_setting";
+
+ public String getDefaultPreloadSetting() {
+ String preload = Settings.Secure.getString(mContext.getContentResolver(),
+ DEAULT_PRELOAD_SECURE_SETTING_KEY);
+ if (preload == null) {
+ preload = mContext.getResources().getString(R.string.pref_data_preload_default_value);
+ }
+ return preload;
}
public String getPreloadEnabled() {
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 602df06..282d4f2 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -336,8 +336,11 @@
// TabControl.restoreState() will create a new tab even if
// restoring the state fails.
setActiveTab(mTabControl.getCurrentTab());
- // Handle the intent
- mIntentHandler.onNewIntent(intent);
+ // Handle the intent if needed. If icicle != null, we are restoring
+ // and the intent will be stale - ignore it.
+ if (icicle == null) {
+ mIntentHandler.onNewIntent(intent);
+ }
}
// Read JavaScript flags if it exists.
String jsFlags = getSettings().getJsEngineFlags();
@@ -2358,6 +2361,7 @@
if (tab != null) {
dismissSubWindow(tab);
tab.loadUrl(url, headers);
+ mUi.onProgressChanged(tab);
}
}
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index cc6b57c..c76197d 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -65,7 +65,6 @@
}
void onNewIntent(Intent intent) {
- mActivity.setIntent(null);
Tab current = mTabControl.getCurrentTab();
// When a tab is closed on exit, the current tab index is set to -1.
// Reset before proceed as Browser requires the current tab to be set.
diff --git a/src/com/android/browser/SnapshotByteArrayOutputStream.java b/src/com/android/browser/SnapshotByteArrayOutputStream.java
new file mode 100644
index 0000000..bfd1a76
--- /dev/null
+++ b/src/com/android/browser/SnapshotByteArrayOutputStream.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package com.android.browser;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class SnapshotByteArrayOutputStream extends OutputStream {
+
+ // Maximum size, just below CursorWindow's 2mb row limit
+ private static final int MAX_SIZE = 2000000;
+ private ByteArrayOutputStream mStream;
+
+ public SnapshotByteArrayOutputStream() {
+ mStream = new ByteArrayOutputStream(MAX_SIZE);
+ }
+
+ @Override
+ public synchronized void write(int oneByte) throws IOException {
+ checkError(1);
+ mStream.write(oneByte);
+ }
+
+ @Override
+ public void write(byte[] buffer, int offset, int count) throws IOException {
+ checkError(count);
+ mStream.write(buffer, offset, count);
+ }
+
+ private void checkError(int expandBy) throws IOException {
+ if ((size() + expandBy) > MAX_SIZE) {
+ throw new IOException("Exceeded max size!");
+ }
+ }
+
+ public int size() {
+ return mStream.size();
+ }
+
+ public byte[] toByteArray() {
+ return mStream.toByteArray();
+ }
+
+}
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index ae52943..936aca9 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -103,6 +103,7 @@
private static final int MSG_CAPTURE = 42;
private static final int CAPTURE_DELAY = 100;
+ private static final int INITIAL_PROGRESS = 5;
private static Bitmap sDefaultFavicon;
@@ -563,7 +564,7 @@
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
mInPageLoad = true;
- mPageLoadProgress = 0;
+ mPageLoadProgress = INITIAL_PROGRESS;
mCurrentState = new PageState(mContext,
view.isPrivateBrowsingEnabled(), url, favicon);
mLoadStartTime = SystemClock.uptimeMillis();
@@ -2016,7 +2017,7 @@
public ContentValues createSnapshotValues() {
if (mMainView == null) return null;
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ SnapshotByteArrayOutputStream bos = new SnapshotByteArrayOutputStream();
try {
GZIPOutputStream stream = new GZIPOutputStream(bos);
if (!mMainView.saveViewState(stream)) {
@@ -2054,6 +2055,8 @@
public void loadUrl(String url, Map<String, String> headers) {
if (mMainView != null) {
+ mPageLoadProgress = INITIAL_PROGRESS;
+ mInPageLoad = true;
mCurrentState = new PageState(mContext, false, url, null);
mWebViewController.onPageStarted(this, mMainView, null);
mMainView.loadUrl(url, headers);
diff --git a/src/com/android/browser/preferences/BandwidthPreferencesFragment.java b/src/com/android/browser/preferences/BandwidthPreferencesFragment.java
index 18b9fa4..2c147cc 100644
--- a/src/com/android/browser/preferences/BandwidthPreferencesFragment.java
+++ b/src/com/android/browser/preferences/BandwidthPreferencesFragment.java
@@ -16,12 +16,11 @@
package com.android.browser.preferences;
-import android.content.res.Resources;
import android.os.Bundle;
-import android.preference.Preference;
+import android.preference.ListPreference;
import android.preference.PreferenceFragment;
-import android.util.Log;
+import com.android.browser.BrowserSettings;
import com.android.browser.PreferenceKeys;
import com.android.browser.R;
@@ -36,4 +35,18 @@
addPreferencesFromResource(R.xml.bandwidth_preferences);
}
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (!getPreferenceScreen().getSharedPreferences()
+ .contains(PreferenceKeys.PREF_DATA_PRELOAD)) {
+ // set default value for preload setting
+ ListPreference preload = (ListPreference) getPreferenceScreen().findPreference(
+ PreferenceKeys.PREF_DATA_PRELOAD);
+ if (preload != null) {
+ preload.setValue(BrowserSettings.getInstance().getDefaultPreloadSetting());
+ }
+ }
+ }
+
}
diff --git a/src/com/android/browser/preferences/GeneralPreferencesFragment.java b/src/com/android/browser/preferences/GeneralPreferencesFragment.java
index 05aa1a7..c018474 100644
--- a/src/com/android/browser/preferences/GeneralPreferencesFragment.java
+++ b/src/com/android/browser/preferences/GeneralPreferencesFragment.java
@@ -29,6 +29,7 @@
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
+import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
@@ -152,6 +153,8 @@
return false;
}
});
+ dialog.getWindow().setSoftInputMode(
+ WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
dialog.show();
}