Make SWEAB work with M38 branch
Change-Id: I01cee135afdcde2f7dab53a9f45c0413a6cb813b
diff --git a/res/raw/bookmark.png b/res/raw/bookmark.png
index e69de29..a190695 100644
--- a/res/raw/bookmark.png
+++ b/res/raw/bookmark.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_1.png b/res/raw/custom_bookmark_favicon_1.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_1.png
+++ b/res/raw/custom_bookmark_favicon_1.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_10.png b/res/raw/custom_bookmark_favicon_10.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_10.png
+++ b/res/raw/custom_bookmark_favicon_10.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_11.png b/res/raw/custom_bookmark_favicon_11.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_11.png
+++ b/res/raw/custom_bookmark_favicon_11.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_12.png b/res/raw/custom_bookmark_favicon_12.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_12.png
+++ b/res/raw/custom_bookmark_favicon_12.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_13.png b/res/raw/custom_bookmark_favicon_13.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_13.png
+++ b/res/raw/custom_bookmark_favicon_13.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_14.png b/res/raw/custom_bookmark_favicon_14.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_14.png
+++ b/res/raw/custom_bookmark_favicon_14.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_15.png b/res/raw/custom_bookmark_favicon_15.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_15.png
+++ b/res/raw/custom_bookmark_favicon_15.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_16.png b/res/raw/custom_bookmark_favicon_16.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_16.png
+++ b/res/raw/custom_bookmark_favicon_16.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_17.png b/res/raw/custom_bookmark_favicon_17.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_17.png
+++ b/res/raw/custom_bookmark_favicon_17.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_18.png b/res/raw/custom_bookmark_favicon_18.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_18.png
+++ b/res/raw/custom_bookmark_favicon_18.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_19.png b/res/raw/custom_bookmark_favicon_19.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_19.png
+++ b/res/raw/custom_bookmark_favicon_19.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_2.ico b/res/raw/custom_bookmark_favicon_2.ico
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_2.ico
+++ b/res/raw/custom_bookmark_favicon_2.ico
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_20.png b/res/raw/custom_bookmark_favicon_20.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_20.png
+++ b/res/raw/custom_bookmark_favicon_20.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_3.png b/res/raw/custom_bookmark_favicon_3.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_3.png
+++ b/res/raw/custom_bookmark_favicon_3.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_4.ico b/res/raw/custom_bookmark_favicon_4.ico
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_4.ico
+++ b/res/raw/custom_bookmark_favicon_4.ico
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_5.png b/res/raw/custom_bookmark_favicon_5.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_5.png
+++ b/res/raw/custom_bookmark_favicon_5.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_6.ico b/res/raw/custom_bookmark_favicon_6.ico
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_6.ico
+++ b/res/raw/custom_bookmark_favicon_6.ico
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_7.png b/res/raw/custom_bookmark_favicon_7.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_7.png
+++ b/res/raw/custom_bookmark_favicon_7.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_8.png b/res/raw/custom_bookmark_favicon_8.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_8.png
+++ b/res/raw/custom_bookmark_favicon_8.png
Binary files differ
diff --git a/res/raw/custom_bookmark_favicon_9.png b/res/raw/custom_bookmark_favicon_9.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_favicon_9.png
+++ b/res/raw/custom_bookmark_favicon_9.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_1.png b/res/raw/custom_bookmark_thumb_1.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_1.png
+++ b/res/raw/custom_bookmark_thumb_1.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_10.png b/res/raw/custom_bookmark_thumb_10.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_10.png
+++ b/res/raw/custom_bookmark_thumb_10.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_11.png b/res/raw/custom_bookmark_thumb_11.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_11.png
+++ b/res/raw/custom_bookmark_thumb_11.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_12.png b/res/raw/custom_bookmark_thumb_12.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_12.png
+++ b/res/raw/custom_bookmark_thumb_12.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_13.png b/res/raw/custom_bookmark_thumb_13.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_13.png
+++ b/res/raw/custom_bookmark_thumb_13.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_14.png b/res/raw/custom_bookmark_thumb_14.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_14.png
+++ b/res/raw/custom_bookmark_thumb_14.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_15.png b/res/raw/custom_bookmark_thumb_15.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_15.png
+++ b/res/raw/custom_bookmark_thumb_15.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_16.png b/res/raw/custom_bookmark_thumb_16.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_16.png
+++ b/res/raw/custom_bookmark_thumb_16.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_17.png b/res/raw/custom_bookmark_thumb_17.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_17.png
+++ b/res/raw/custom_bookmark_thumb_17.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_18.png b/res/raw/custom_bookmark_thumb_18.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_18.png
+++ b/res/raw/custom_bookmark_thumb_18.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_19.png b/res/raw/custom_bookmark_thumb_19.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_19.png
+++ b/res/raw/custom_bookmark_thumb_19.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_2.png b/res/raw/custom_bookmark_thumb_2.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_2.png
+++ b/res/raw/custom_bookmark_thumb_2.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_20.png b/res/raw/custom_bookmark_thumb_20.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_20.png
+++ b/res/raw/custom_bookmark_thumb_20.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_3.png b/res/raw/custom_bookmark_thumb_3.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_3.png
+++ b/res/raw/custom_bookmark_thumb_3.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_4.png b/res/raw/custom_bookmark_thumb_4.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_4.png
+++ b/res/raw/custom_bookmark_thumb_4.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_5.png b/res/raw/custom_bookmark_thumb_5.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_5.png
+++ b/res/raw/custom_bookmark_thumb_5.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_6.png b/res/raw/custom_bookmark_thumb_6.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_6.png
+++ b/res/raw/custom_bookmark_thumb_6.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_7.png b/res/raw/custom_bookmark_thumb_7.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_7.png
+++ b/res/raw/custom_bookmark_thumb_7.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_8.png b/res/raw/custom_bookmark_thumb_8.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_8.png
+++ b/res/raw/custom_bookmark_thumb_8.png
Binary files differ
diff --git a/res/raw/custom_bookmark_thumb_9.png b/res/raw/custom_bookmark_thumb_9.png
index e69de29..a190695 100644
--- a/res/raw/custom_bookmark_thumb_9.png
+++ b/res/raw/custom_bookmark_thumb_9.png
Binary files differ
diff --git a/res/raw/history.png b/res/raw/history.png
index e69de29..a190695 100644
--- a/res/raw/history.png
+++ b/res/raw/history.png
Binary files differ
diff --git a/res/values/bools.xml b/res/values/bools.xml
index e746563..d727c63 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -15,7 +15,7 @@
<bool name="isTablet">false</bool>
<!-- hide the title bar -->
<bool name="hide_title">false</bool>
- <bool name="hide_title_on_scroll">true</bool>
+ <bool name="hide_title_on_scroll">false</bool>
<bool name="hide_nav_buttons">true</bool>
<!-- Browser menu toggles -->
<bool name="menu_show_navigation">true</bool>
diff --git a/src/com/android/browser/Browser.java b/src/com/android/browser/Browser.java
index 01b9706..5a30fad 100644
--- a/src/com/android/browser/Browser.java
+++ b/src/com/android/browser/Browser.java
@@ -22,6 +22,9 @@
import android.util.Log;
import android.os.Process;
+import org.chromium.content.browser.ResourceExtractor;
+import org.chromium.base.PathUtils;
+
import org.codeaurora.swe.Engine;
import com.android.browser.BrowserConfig;
@@ -36,10 +39,15 @@
// Set to true to enable extra debug logging.
final static boolean LOGD_ENABLED = true;
+ private static final String[] MP_MANDATORY_PAKS = new String[] {
+ "webviewchromium.pak",
+ "icudtl.dat"
+ };
+
@Override
public void onCreate() {
super.onCreate();
-
+ initializeApplicationParameters();
if (LOGV_ENABLED)
Log.v(LOGTAG, "Browser.onCreate: this=" + this);
@@ -55,7 +63,13 @@
Engine.initialize(context);
BrowserSettings.initialize(context);
Preloader.initialize(context);
- }
+ }
+
+ }
+
+ public static void initializeApplicationParameters() {
+ ResourceExtractor.setMandatoryPaksToExtract(MP_MANDATORY_PAKS);
+ PathUtils.setPrivateDataDirectorySuffix("android_browser");
}
}
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 82109e9..01cd964 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -61,7 +61,6 @@
import org.json.JSONException;
import org.json.JSONObject;
-import org.codeaurora.net.NetworkServices;
interface BookmarksPageCallbacks {
// Return true if handled
@@ -436,9 +435,6 @@
LoaderManager lm = getLoaderManager();
lm.restartLoader(LOADER_ACCOUNTS, null, this);
- //Notify about anticipated network activity
- NetworkServices.HintUpcomingUserActivity();
-
return mRoot;
}
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index 9e19d11..fb291c9 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -109,7 +109,8 @@
"com.android.browser.preferences.AdvancedPreferencesFragment",
"com.android.browser.preferences.BandwidthPreferencesFragment",
"com.android.browser.preferences.LabPreferencesFragment",
- "com.android.browser.preferences.AboutPreferencesFragment"));
+ "com.android.browser.preferences.AboutPreferencesFragment",
+ "com.android.browser.AutoFillSettingsFragment"));
@Override
protected boolean isValidFragment(String fragmentName) {
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 14a0793..ea1a60c 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -601,13 +601,29 @@
}
private void shareCurrentPage(Tab tab) {
- if (tab != null) {
- sharePage(mActivity, tab.getTitle(),
- tab.getUrl(), tab.getFavicon(),
- createScreenshot(tab.getWebView(),
- getDesiredThumbnailWidth(mActivity),
- getDesiredThumbnailHeight(mActivity)));
- }
+ if (tab == null || tab.getWebView() == null)
+ return;
+
+ final Tab mytab = tab;
+ final ValueCallback<Bitmap> onScreenshot = new ValueCallback<Bitmap>() {
+ @Override
+ public void onReceiveValue(Bitmap bitmap) {
+ sharePage(mActivity, mytab.getTitle(), mytab.getUrl(),
+ mytab.getFavicon(), bitmap);
+ }
+ };
+
+ createScreenshotAsync(
+ tab.getWebView(),
+ getDesiredThumbnailWidth(mActivity),
+ getDesiredThumbnailHeight(mActivity),
+ new ValueCallback<Bitmap>() {
+ @Override
+ public void onReceiveValue(Bitmap bitmap) {
+ sharePage(mActivity, mytab.getTitle(), mytab.getUrl(),
+ mytab.getFavicon(), bitmap);
+ }
+ });
}
/**
@@ -2145,10 +2161,21 @@
@Override
public void bookmarkCurrentPage() {
- Intent bookmarkIntent = createBookmarkCurrentPageIntent(false);
- if (bookmarkIntent != null) {
- mActivity.startActivity(bookmarkIntent);
- }
+ WebView w = getCurrentTopWebView();
+ if (w == null)
+ return;
+
+ final Intent i = createBookmarkCurrentPageIntent(false);
+ createScreenshotAsync(
+ w, getDesiredThumbnailWidth(mActivity),
+ getDesiredThumbnailHeight(mActivity),
+ new ValueCallback<Bitmap>() {
+ @Override
+ public void onReceiveValue(Bitmap bitmap) {
+ i.putExtra(BrowserContract.Bookmarks.THUMBNAIL, bitmap);
+ mActivity.startActivity(i);
+ }
+ });
}
private void goLive() {
@@ -2378,9 +2405,7 @@
settings.getUserAgentString());
}
}
- i.putExtra(BrowserContract.Bookmarks.THUMBNAIL,
- createScreenshot(w, getDesiredThumbnailWidth(mActivity),
- getDesiredThumbnailHeight(mActivity)));
+ //SWE: Thumbnail will need to be set asynchronously
i.putExtra(BrowserContract.Bookmarks.FAVICON, w.getFavicon());
if (editExisting) {
i.putExtra(AddBookmarkPage.CHECK_FOR_DUPE, true);
@@ -2472,6 +2497,27 @@
return sThumbnailBitmap;
}
+ static void createScreenshotAsync(WebView view, int width, int height,
+ final ValueCallback<Bitmap> cb) {
+ if (view == null || width == 0 || height == 0) {
+ return;
+ }
+
+ view.getContentBitmapAsync(
+ (float) width / view.getWidth(),
+ new Rect(),
+ new ValueCallback<Bitmap>() {
+ @Override
+ public void onReceiveValue(Bitmap bitmap) {
+ Log.e("sudheer", "screensot bitmap: w: " + bitmap.getWidth()
+ + " h: " + bitmap.getHeight());
+ if (bitmap != null)
+ bitmap = bitmap.copy(Bitmap.Config.RGB_565, false);
+ cb.onReceiveValue(bitmap);
+ }});
+ }
+
+
private void updateScreenshot(Tab tab) {
// If this is a bookmarked site, add a screenshot to the database.
// FIXME: Would like to make sure there is actually something to
diff --git a/src/com/android/browser/LocationButton.java b/src/com/android/browser/LocationButton.java
index e805e43..15371ef 100644
--- a/src/com/android/browser/LocationButton.java
+++ b/src/com/android/browser/LocationButton.java
@@ -71,7 +71,8 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- init();
+ //SWE-FIXME : Enable once SWE geolocation api works.
+ //init();
}
private void init() {
diff --git a/src/com/android/browser/NavigationBarBase.java b/src/com/android/browser/NavigationBarBase.java
index 100e8d7..a8f52fe 100644
--- a/src/com/android/browser/NavigationBarBase.java
+++ b/src/com/android/browser/NavigationBarBase.java
@@ -75,7 +75,8 @@
protected void onFinishInflate() {
super.onFinishInflate();
mLockIcon = (ImageView) findViewById(R.id.lock);
- mLocationButton = (LocationButton) findViewById(R.id.location_button);
+ //SWE-FIXME
+ //mLocationButton = (LocationButton) findViewById(R.id.location_button);
mFavicon = (ImageView) findViewById(R.id.favicon);
mUrlInput = (UrlInputView) findViewById(R.id.url);
mUrlInput.setUrlInputListener(this);
@@ -397,7 +398,8 @@
}
public void onTabDataChanged(Tab tab) {
- mLocationButton.onTabDataChanged(tab);
+ //SWE-FIXME
+ //mLocationButton.onTabDataChanged(tab);
}
public void onVoiceResult(String s) {
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 78b3cc8..c789eba 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -25,6 +25,7 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
+import android.graphics.Rect;
import android.os.Message;
import android.util.Log;
import android.util.TypedValue;
@@ -35,6 +36,7 @@
import android.view.MenuItem;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
+import android.webkit.ValueCallback;
import org.codeaurora.swe.WebView;
import android.widget.ImageView;
@@ -122,7 +124,7 @@
if (mAnimScreen == null) {
mAnimScreen = new AnimScreen(mActivity);
// initialize bitmaps
- mAnimScreen.set(getTitleBar(), getWebView());
+ //mAnimScreen.set(getTitleBar(), getWebView());
}
}
}
@@ -271,6 +273,19 @@
mShowNav = true;
dismissIME();
mUiController.setBlockEvents(true);
+
+ getWebView()
+ .getContentBitmapAsync(1.0f,
+ new Rect(),
+ new ValueCallback<Bitmap>() {
+ @Override
+ public void onReceiveValue(Bitmap bitmap) {
+ onShowNavScreenContinue(bitmap);
+ }});
+ }
+
+ void onShowNavScreenContinue(Bitmap viewportBitmap) {
+
if (mNavScreen == null) {
mNavScreen = new NavScreen(mActivity, mUiController, this);
mCustomViewContainer.addView(mNavScreen, COVER_SCREEN_PARAMS);
@@ -287,7 +302,7 @@
mAnimScreen.mTitle.setAlpha(1f);
mAnimScreen.setScaleFactor(1f);
}
- mAnimScreen.set(getTitleBar(), getWebView());
+ mAnimScreen.set(getTitleBar(), viewportBitmap);
if (mAnimScreen.mMain.getParent() == null) {
mCustomViewContainer.addView(mAnimScreen.mMain, COVER_SCREEN_PARAMS);
}
@@ -383,7 +398,7 @@
}
int width = mContentView.getWidth();
int height = mContentView.getHeight();
- Bitmap bm = tab.getFullScreenshot();
+ Bitmap bm = tab.getScreenshot();
if (bm == null)
bm = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
mAnimScreen.set(bm);
@@ -503,6 +518,7 @@
mNavScreen.setVisibility(View.GONE);
mCustomViewContainer.setAlpha(1f);
mCustomViewContainer.setVisibility(View.GONE);
+ mAnimScreen.set(null);
}
@Override
@@ -543,8 +559,8 @@
setScaleFactor(getScaleFactor());
}
- public void set(TitleBar tbar, WebView web) {
- if (tbar == null || web == null) {
+ public void set(TitleBar tbar, Bitmap viewportBitmap) {
+ if (tbar == null) {
return;
}
int embTbarHeight = tbar.getEmbeddedHeight();
@@ -566,29 +582,8 @@
}
mTitle.setImageBitmap(mTitleBarBitmap);
mTitle.setVisibility(View.VISIBLE);
- // SWE: WebView.draw() wouldn't draw anything if SurfaceView is enabled.
- if (mContentBitmap != null) {
- mContentBitmap.recycle();
- mContentBitmap = null;
- }
- mContentBitmap = web.getViewportBitmap();
- if (mContentBitmap == null) {
- int h = web.getHeight() - embTbarHeight;
- if (mContentBitmap == null
- || mContentBitmap.getWidth() != web.getWidth()
- || mContentBitmap.getHeight() != h) {
- mContentBitmap = safeCreateBitmap(web.getWidth(), h);
- }
- if (mContentBitmap != null) {
- Canvas c = new Canvas(mContentBitmap);
- int tx = web.getScrollX();
- int ty = web.getScrollY();
- c.translate(-tx, -ty - embTbarHeight);
- web.draw(c);
- c.setBitmap(null);
- }
- }
- mContent.setImageBitmap(mContentBitmap);
+
+ mContent.setImageBitmap(viewportBitmap);
}
private Bitmap safeCreateBitmap(int width, int height) {
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 4f183fe..5e71aca 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -33,6 +33,7 @@
import android.graphics.Picture;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
+import android.graphics.Rect;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
@@ -1965,8 +1966,9 @@
values.put(Snapshots.BACKGROUND, web.getPageBackgroundColor());
values.put(Snapshots.DATE_CREATED, System.currentTimeMillis());
values.put(Snapshots.FAVICON, compressBitmap(getFavicon()));
- Bitmap screenshot = web.getViewportBitmap();
- values.put(Snapshots.THUMBNAIL, compressBitmap(screenshot));
+ Bitmap screenshot = getScreenshot();
+ if (screenshot != null)
+ values.put(Snapshots.THUMBNAIL, compressBitmap(screenshot));
return values;
}
@@ -2046,44 +2048,26 @@
if (mMainView.getContentWidth() <= 0 || mMainView.getContentHeight() <= 0) {
return;
}
+
+ mMainView
+ .getContentBitmapAsync(
+ (float) mCaptureWidth / mMainView.getWidth(),
+ new Rect(),
+ new ValueCallback<Bitmap>() {
+ @Override
+ public void onReceiveValue(Bitmap bitmap) {
+ onCaptureCallback(bitmap);
+ }});
+ }
+
+ private void onCaptureCallback(Bitmap bitmap) {
+ if (mCapture == null || bitmap == null)
+ return;
+
Canvas c = new Canvas(mCapture);
- int state = c.save();
- float scale = 0;
- Bitmap screenShot = mMainView.getViewportBitmap();
- if (mScreenShot != null) {
- mScreenShot.recycle();
- mScreenShot = null;
- }
- mScreenShot = screenShot;
- if (screenShot != null) {
- //scale based on device orientation
- if (screenShot.getHeight() > screenShot.getWidth()){
- scale = (float) mCaptureWidth / screenShot.getWidth();
- } else {
- scale = (float) mCaptureHeight / screenShot.getHeight();
- }
- mCapture.eraseColor(Color.WHITE);
- c.scale(scale, scale);
- c.drawBitmap(screenShot, 0, 0, null);
- } else {
- final int left = mMainView.getViewScrollX();
- final int top = mMainView.getViewScrollY() + mMainView.getVisibleTitleHeight();
+ mCapture.eraseColor(Color.WHITE);
+ c.drawBitmap(bitmap, 0, 0, null);
- if (mMainView.getHeight() > mMainView.getWidth()){
- scale = mCaptureWidth / (float) mMainView.getWidth();
- } else {
- scale = mCaptureHeight / (float) mMainView.getHeight();
- }
-
- c.translate(-left, -top);
- c.scale(scale, scale, left, top);
- if (mMainView instanceof BrowserWebView) {
- ((BrowserWebView)mMainView).drawContent(c);
- } else {
- mMainView.draw(c);
- }
- }
- c.restoreToCount(state);
// manually anti-alias the edges for the tilt
c.drawRect(0, 0, 1, mCapture.getHeight(), sAlphaPaint);
c.drawRect(mCapture.getWidth() - 1, 0, mCapture.getWidth(),
diff --git a/src/com/android/browser/preferences/AdvancedPreferencesFragment.java b/src/com/android/browser/preferences/AdvancedPreferencesFragment.java
index e693297..9c96768 100644
--- a/src/com/android/browser/preferences/AdvancedPreferencesFragment.java
+++ b/src/com/android/browser/preferences/AdvancedPreferencesFragment.java
@@ -160,14 +160,15 @@
}
}
});
- GeolocationPermissions.getInstance().getOrigins(new ValueCallback<Set<String> >() {
+ //SWE-FIXME : Uncomment when geolocation is working.
+ /*GeolocationPermissions.getInstance().getOrigins(new ValueCallback<Set<String> >() {
@Override
public void onReceiveValue(Set<String> geolocationOrigins) {
if ((geolocationOrigins != null) && !geolocationOrigins.isEmpty()) {
websiteSettings.setEnabled(true);
}
}
- });
+ });*/
}
@Override
diff --git a/swe_android_browser.gypi b/swe_android_browser.gypi
index 0c9c485..99ca387 100644
--- a/swe_android_browser.gypi
+++ b/swe_android_browser.gypi
@@ -6,9 +6,6 @@
'dependencies': [
'swe_engine_java',
'android-support-v13',
- 'fast_webview_java',
- '<@(libnetxt_dependencies)',
- '<@(libsweadrenoext_dependencies)',
],
'variables': {
'apk_name': 'SWE_AndroidBrowser',
@@ -20,7 +17,13 @@
'assets_dir': '../../swe/browser/assets',
'native_lib_target': 'libswewebviewchromium',
'additional_input_paths': ['<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak'],
- 'additional_native_libs': ['<@(libnetxt_native_libs)', '<@(libsweadrenoext_native_libs)'],
+ 'conditions': [
+ ['icu_use_data_file_flag==1', {
+ 'additional_input_paths': [
+ '<(PRODUCT_DIR)/icudtl.dat',
+ ],
+ }],
+ ],
'override_package_name': 'com.android.swe.browser',
'android_manifest_path': '../../swe/browser/AndroidManifest.xml',
'additional_src_dirs': ['<(DEPTH)/swe/browser/src_standalone/com/android/browser'],
@@ -31,6 +34,13 @@
'files': [
'<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak'
],
+ 'conditions': [
+ ['icu_use_data_file_flag==1', {
+ 'files': [
+ '<(PRODUCT_DIR)/icudtl.dat',
+ ],
+ }],
+ ],
},
{
'destination': '<(PRODUCT_DIR)/swe_android_browser_apk/assets/wml',