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

Commit 7d8fc3c9 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Revert "Use a weakreference to prevent the static variable from holding...

Merge "Revert "Use a weakreference to prevent the static variable from holding an Activity." Bug was fixed in a different way."
parents 8f8dae15 b724c346
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -268,11 +268,10 @@ extends Layout
        // generate new layout for affected text

        StaticLayout reflowed;
        WeakReference<StaticLayout> layoutRef;

        synchronized (sLock) {
            layoutRef = sStaticLayoutRef;
            reflowed = sStaticLayoutRef != null ? sStaticLayoutRef.get() : null;
            sStaticLayoutRef = null;
            reflowed = sStaticLayout;
            sStaticLayout = null;
        }

        if (reflowed == null) {
@@ -359,12 +358,8 @@ extends Layout
        }

        synchronized (sLock) {
            sStaticLayout = reflowed;
            reflowed.finish();
            if (layoutRef == null || layoutRef.get() != reflowed) {
                sStaticLayoutRef = new WeakReference<StaticLayout>(reflowed);
            } else {
                sStaticLayoutRef = layoutRef;
            }
        }
    }

@@ -493,8 +488,7 @@ extends Layout

    private int mTopPadding, mBottomPadding;

    private static WeakReference<StaticLayout> sStaticLayoutRef = new WeakReference<StaticLayout>(
            new StaticLayout(true));
    private static StaticLayout sStaticLayout = new StaticLayout(true);
    private static final Object[] sLock = new Object[0];

    private static final int START = 0;