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

Commit 4feb3260 authored by John Reck's avatar John Reck
Browse files

Improve resource loading by ~3x

Bug: 22392651

ColorStateLists were never cached because the lazy-create
of the constant state had a typo.

Resource caching in general was broken because ThemeKey did not
clone the hash code, so all keys in the cache had a hashCode
of 0 which did not match the real, uncloned ThemeKeys hash code
so the binary search in ArrayMap based off of hash code was failing.

Change-Id: I9df1628b226bfa797bed97875354c19bf64f41ad
parent cf9aebf1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -603,7 +603,7 @@ public class ColorStateList implements Parcelable {
     * @hide only for resource preloading
     */
    public ConstantState<ColorStateList> getConstantState() {
        if (mFactory != null) {
        if (mFactory == null) {
            mFactory = new ColorStateListFactory(this);
        }
        return mFactory;
+1 −0
Original line number Diff line number Diff line
@@ -1918,6 +1918,7 @@ public class Resources {
            other.mResId = mResId;
            other.mForce = mForce;
            other.mCount = mCount;
            other.mHashCode = mHashCode;
            return other;
        }
    }