OSDN Git Service

Convert ashmem bitmap thresholds to constants.
authorRiley Andrews <riandrews@google.com>
Wed, 4 Nov 2015 07:36:52 +0000 (23:36 -0800)
committerRiley Andrews <riandrews@google.com>
Wed, 4 Nov 2015 07:52:17 +0000 (23:52 -0800)
Bug 25256717

Change-Id: I23e2795ef8798d83bf60dcbd6ff2e7093fcaa9b0
Signed-off-by: Riley Andrews <riandrews@google.com>
core/java/android/app/Notification.java
graphics/java/android/graphics/drawable/Icon.java

index a2e8fd1..6a4f6a1 100644 (file)
@@ -3963,6 +3963,9 @@ public class Notification implements Parcelable
             return this;
         }
 
+        /** @hide */
+        public static final int MIN_ASHMEM_BITMAP_SIZE = 128 * (1 << 10);
+
         /**
          * @hide
          */
@@ -3971,7 +3974,7 @@ public class Notification implements Parcelable
             super.purgeResources();
             if (mPicture != null &&
                 mPicture.isMutable() &&
-                mPicture.getAllocationByteCount() >= (128 * (1 << 10))) {
+                mPicture.getAllocationByteCount() >= MIN_ASHMEM_BITMAP_SIZE) {
                 mPicture = mPicture.createAshmemBitmap();
             }
             if (mBigLargeIcon != null) {
index 44d7530..d800acb 100644 (file)
@@ -377,6 +377,9 @@ public final class Icon implements Parcelable {
         return loadDrawable(context);
     }
 
+    /** @hide */
+    public static final int MIN_ASHMEM_ICON_SIZE = 128 * (1 << 10);
+
     /**
      * Puts the memory used by this instance into Ashmem memory, if possible.
      * @hide
@@ -384,7 +387,7 @@ public final class Icon implements Parcelable {
     public void convertToAshmem() {
         if (mType == TYPE_BITMAP &&
             getBitmap().isMutable() &&
-            getBitmap().getAllocationByteCount() >= (128 * (1 << 10))) {
+            getBitmap().getAllocationByteCount() >= MIN_ASHMEM_ICON_SIZE) {
             setBitmap(getBitmap().createAshmemBitmap());
         }
     }