am 25a5f301: Merge "Use ashmem backed bitmaps for passing around notifications" into mnc-dev
* commit '25a5f3012805e0fbcf3610dc57ab5c28d25aab0f': Use ashmem backed bitmaps for passing around notifications
This commit is contained in:
@@ -3586,12 +3586,19 @@ public class Notification implements Parcelable
|
|||||||
* object.
|
* object.
|
||||||
*/
|
*/
|
||||||
public Notification build() {
|
public Notification build() {
|
||||||
|
if (mSmallIcon != null) {
|
||||||
|
mSmallIcon.convertToAshmem();
|
||||||
|
}
|
||||||
|
if (mLargeIcon != null) {
|
||||||
|
mLargeIcon.convertToAshmem();
|
||||||
|
}
|
||||||
mOriginatingUserId = mContext.getUserId();
|
mOriginatingUserId = mContext.getUserId();
|
||||||
mHasThreeLines = hasThreeLines();
|
mHasThreeLines = hasThreeLines();
|
||||||
|
|
||||||
Notification n = buildUnstyled();
|
Notification n = buildUnstyled();
|
||||||
|
|
||||||
if (mStyle != null) {
|
if (mStyle != null) {
|
||||||
|
mStyle.purgeResources();
|
||||||
n = mStyle.buildStyled(n);
|
n = mStyle.buildStyled(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3790,6 +3797,8 @@ public class Notification implements Parcelable
|
|||||||
return wip;
|
return wip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void purgeResources() {}
|
||||||
|
|
||||||
// The following methods are split out so we can re-create notification partially.
|
// The following methods are split out so we can re-create notification partially.
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
@@ -3901,8 +3910,18 @@ public class Notification implements Parcelable
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RemoteViews makeBigContentView() {
|
@Override
|
||||||
|
public void purgeResources() {
|
||||||
|
super.purgeResources();
|
||||||
|
if (mPicture != null && mPicture.isMutable()) {
|
||||||
|
mPicture = mPicture.createAshmemBitmap();
|
||||||
|
}
|
||||||
|
if (mBigLargeIcon != null) {
|
||||||
|
mBigLargeIcon.convertToAshmem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RemoteViews makeBigContentView() {
|
||||||
// Replace mLargeIcon with mBigLargeIcon if mBigLargeIconSet
|
// Replace mLargeIcon with mBigLargeIcon if mBigLargeIconSet
|
||||||
// This covers the following cases:
|
// This covers the following cases:
|
||||||
// 1. mBigLargeIconSet -> mBigLargeIcon (null or non-null) applies, overrides
|
// 1. mBigLargeIconSet -> mBigLargeIcon (null or non-null) applies, overrides
|
||||||
|
|||||||
@@ -109,6 +109,10 @@ public final class Icon implements Parcelable {
|
|||||||
return (Bitmap) mObj1;
|
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.
|
* @return The length of the compressed bitmap byte array held by this {@link #TYPE_DATA} Icon.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -346,6 +350,16 @@ public final class Icon implements Parcelable {
|
|||||||
return loadDrawable(context);
|
return loadDrawable(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Writes a serialized version of an Icon to the specified stream.
|
||||||
*
|
*
|
||||||
@@ -466,7 +480,7 @@ public final class Icon implements Parcelable {
|
|||||||
throw new IllegalArgumentException("Bitmap must not be null.");
|
throw new IllegalArgumentException("Bitmap must not be null.");
|
||||||
}
|
}
|
||||||
final Icon rep = new Icon(TYPE_BITMAP);
|
final Icon rep = new Icon(TYPE_BITMAP);
|
||||||
rep.mObj1 = bits;
|
rep.setBitmap(bits);
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user