summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2015-06-03 11:48:13 -0700
committerDaniel Sandler <dsandler@android.com>2015-06-23 19:55:41 +0000
commita0d58ae574a3a69145512e0cd92e7842f0fbf83d (patch)
tree4364ba89fc76b93de6c0f064260de61a277a1762 /graphics/java
parent323b768d6d06c73209363f559cdd278e06ca7e48 (diff)
downloadframeworks_base-a0d58ae574a3a69145512e0cd92e7842f0fbf83d.zip
frameworks_base-a0d58ae574a3a69145512e0cd92e7842f0fbf83d.tar.gz
frameworks_base-a0d58ae574a3a69145512e0cd92e7842f0fbf83d.tar.bz2
Use ashmem backed bitmaps for passing around notifications
Avoids many copies during IPC and duplicate Java heap consumption in system_server, SystemUI, etc. Bug: 18386420 Change-Id: Id5ac9406062d472f7848009d65f12131f5f4dac9
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/drawable/Icon.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index 85db6a1..09386c0 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -109,6 +109,10 @@ public final class Icon implements Parcelable {
return (Bitmap) mObj1;
}
+ private void setBitmap(Bitmap b) {
+ mObj1 = b;
+ }
+
/**
* @return The length of the compressed bitmap byte array held by this {@link #TYPE_DATA} Icon.
* @hide
@@ -347,6 +351,16 @@ public final class Icon implements Parcelable {
}
/**
+ * Puts the memory used by this instance into Ashmem memory, if possible.
+ * @hide
+ */
+ public void convertToAshmem() {
+ if (mType == TYPE_BITMAP && getBitmap().isMutable()) {
+ setBitmap(getBitmap().createAshmemBitmap());
+ }
+ }
+
+ /**
* Writes a serialized version of an Icon to the specified stream.
*
* @param stream The stream on which to serialize the Icon.
@@ -466,7 +480,7 @@ public final class Icon implements Parcelable {
throw new IllegalArgumentException("Bitmap must not be null.");
}
final Icon rep = new Icon(TYPE_BITMAP);
- rep.mObj1 = bits;
+ rep.setBitmap(bits);
return rep;
}