diff options
author | Pankaj Garg <pgarg@codeaurora.org> | 2015-03-25 13:40:59 -0700 |
---|---|---|
committer | WebTech Code Review <code-review@localhost> | 2015-03-26 16:19:42 -0700 |
commit | eba076f1ebca068b794b861bc20d969249ac80b5 (patch) | |
tree | cc884bf11a90b3f7aa52511a9262a9cb75dfdc50 /src/com/android/browser/Controller.java | |
parent | 64c77e0086a00ddbf84d5711b33072aa63873ecc (diff) | |
download | android_packages_apps_Gello-eba076f1ebca068b794b861bc20d969249ac80b5.tar.gz android_packages_apps_Gello-eba076f1ebca068b794b861bc20d969249ac80b5.tar.bz2 android_packages_apps_Gello-eba076f1ebca068b794b861bc20d969249ac80b5.zip |
Fix browser crash on high resolution device while adding bookmark
The bitmap of page was being sent as part of intent. The binder
was throwing an exception due to large size of bitmap. Removed
the bitmap from intent and added a static method in Controller
to expose the bitmap object.
CR-Fixed: SWE-4171
Change-Id: I9000b3ffa83e2846881fef5486bee07479a7b2ce
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r-- | src/com/android/browser/Controller.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 747b7790..80a5a424 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -254,6 +254,7 @@ public class Controller private String mUpdateMyNavThumbnailUrl; private float mLevel = 0.0f; private WebView.HitTestResult mResult; + private static Bitmap mBookmarkBitmap; public Controller(Activity browser) { mActivity = browser; @@ -2309,6 +2310,16 @@ public class Controller BrowserPreferencesPage.startPreferencesForResult(mActivity, getCurrentTopWebView().getUrl(), PREFERENCES_PAGE); } + // This function is specifically used from AddBookmark Activity. + // The bookmark activity clears the bitmap after retrieving it. + // The function usage elsewhere will result in breaking bookmark + // functionality. + public static Bitmap getAndReleaseLastBookmarkBitmapFromIntent() { + Bitmap bitmap = mBookmarkBitmap; + mBookmarkBitmap = null; + return bitmap; + } + @Override public void bookmarkCurrentPage() { WebView w = getCurrentTopWebView(); @@ -2321,7 +2332,7 @@ public class Controller new ValueCallback<Bitmap>() { @Override public void onReceiveValue(Bitmap bitmap) { - i.putExtra(BrowserContract.Bookmarks.THUMBNAIL, bitmap); + mBookmarkBitmap = bitmap; mActivity.startActivity(i); } }); @@ -2620,7 +2631,6 @@ public class Controller if (view == null || width == 0 || height == 0) { return; } - view.getContentBitmapAsync( (float) width / view.getWidth(), new Rect(), |