DO NOT MERGE Remove more extras during notification lightening.
Basically anything Parcelable needs to go since it might be
quite large. Note that this includes additional extras such as
those contributed by WearableExtender.
Cherry-picked from 5012853de2
Bug: 26038546
Change-Id: I00eadd2b23dfc4fccf42332df658373bb05b8a45
This commit is contained in:
committed by
Ian Pedowitz
parent
180dd72a9b
commit
ddb52fb1f5
@@ -45,6 +45,7 @@ import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.MathUtils;
|
||||
import android.util.SparseArray;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@@ -62,6 +63,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A class that represents how a persistent notification is to be presented to
|
||||
@@ -1603,13 +1606,23 @@ public class Notification implements Parcelable
|
||||
bigContentView = null;
|
||||
headsUpContentView = null;
|
||||
mLargeIcon = null;
|
||||
if (extras != null) {
|
||||
extras.remove(Notification.EXTRA_LARGE_ICON);
|
||||
extras.remove(Notification.EXTRA_LARGE_ICON_BIG);
|
||||
extras.remove(Notification.EXTRA_PICTURE);
|
||||
extras.remove(Notification.EXTRA_BIG_TEXT);
|
||||
if (extras != null && !extras.isEmpty()) {
|
||||
// Prevent light notifications from being rebuilt.
|
||||
extras.remove(Builder.EXTRA_NEEDS_REBUILD);
|
||||
final Set<String> keyset = extras.keySet();
|
||||
final int N = keyset.size();
|
||||
final String[] keys = keyset.toArray(new String[N]);
|
||||
for (int i=0; i<N; i++) {
|
||||
final String key = keys[i];
|
||||
final Object obj = extras.get(key);
|
||||
if (obj != null &&
|
||||
( obj instanceof Parcelable
|
||||
|| obj instanceof Parcelable[]
|
||||
|| obj instanceof SparseArray
|
||||
|| obj instanceof ArrayList)) {
|
||||
extras.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user