Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9025dba3 authored by Owen Lin's avatar Owen Lin Committed by Wei Huang
Browse files

(DO NOT MERGE)

Add a hard limit on the size of the widget images.

There is a limit on the size of the data transfered by binder.
For now, we just add a hard limit (360 pixel) to ensure the widget's image
can be passed by binder.

Also adjust the size of widget to make it looks better.

Fix a bug in DecodeUtils which cause OOM for a image in size 12200x1920.
In that case, we should generate a screen nail of size 640x101 instead of
4066x640.

Change-Id: Ie42805d9e9e579b063fc99f5130ec433d695b8c9
fix: 5273271
parent 1e62174e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public class BitmapUtils {
    // minSideLength long. If that's not possible, return 1.
    public static int computeSampleSizeLarger(int w, int h,
            int minSideLength) {
        int initialSize = Math.min(w / minSideLength, h / minSideLength);
        int initialSize = Math.max(w / minSideLength, h / minSideLength);
        if (initialSize <= 1) return 1;

        return initialSize <= 8
+3 −3
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@
-->
<resources>
    <dimen name="appwidget_width">240dp</dimen>
    <dimen name="appwidget_height">200dp</dimen>
    <dimen name="stack_photo_width">230dp</dimen>
    <dimen name="stack_photo_height">190dp</dimen>
    <dimen name="appwidget_height">240dp</dimen>
    <dimen name="stack_photo_width">220dp</dimen>
    <dimen name="stack_photo_height">165dp</dimen>

    <!-- configuration for album set page -->
    <dimen name="albumset_display_item_size">144dp</dimen>
+4 −4
Original line number Diff line number Diff line
@@ -14,10 +14,10 @@
     limitations under the License.
-->
<resources>
    <dimen name="appwidget_width">146dp</dimen>
    <dimen name="appwidget_height">146dp</dimen>
    <dimen name="stack_photo_width">140dp</dimen>
    <dimen name="stack_photo_height">110dp</dimen>
    <dimen name="appwidget_width">180dp</dimen>
    <dimen name="appwidget_height">180dp</dimen>
    <dimen name="stack_photo_width">160dp</dimen>
    <dimen name="stack_photo_height">120dp</dimen>

    <!-- configuration for album set page -->
    <dimen name="albumset_display_item_size">80dp</dimen>
+2 −2
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
        android:minWidth="180dp"
        android:minHeight="180dp"
        android:minWidth="@dimen/appwidget_width"
        android:minHeight="@dimen/appwidget_height"
        android:updatePeriodMillis="86400000"
        android:previewImage="@drawable/preview"
        android:initialLayout="@layout/appwidget_main"
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class DecodeUtils {
     * Decodes the bitmap from the given byte array if the image size is larger than the given
     * requirement.
     *
     * Note: The returned image may be resized down. However, both width and heigh must be
     * Note: The returned image may be resized down. However, both width and height must be
     * larger than the <code>targetSize</code>.
     */
    public static Bitmap requestDecodeIfBigEnough(JobContext jc, byte[] data,
Loading