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

Commit 20ad4dab authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Clean up memory leak in volume dialog

Fixes: 144843711
Test: dump java heap; open close volumedialog many times;
take another java heap; compare

Change-Id: I160d77822c9f0c4b15c83acad99dbe6e6d41d440
parent 426e4c1b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ public class ConfigurableTexts {

    public int add(final TextView text, final int labelResId) {
        if (text == null) return 0;
        if (mTexts.containsKey(text)) {
            return mTexts.get(text);
        }
        final Resources res = mContext.getResources();
        final float fontScale = res.getConfiguration().fontScale;
        final float density = res.getDisplayMetrics().density;
@@ -63,6 +66,11 @@ public class ConfigurableTexts {
        return sp;
    }

    public void remove(final TextView text) {
        mTexts.remove(text);
        mTextLabels.remove(text);
    }

    public void update() {
        if (mTexts.isEmpty()) return;
        mTexts.keyAt(0).post(mUpdateAll);
+1 −0
Original line number Diff line number Diff line
@@ -922,6 +922,7 @@ public class VolumeDialogImpl implements VolumeDialog,
            if (!mDynamic.get(row.stream)) {
                mRows.remove(i);
                mDialogRowsView.removeView(row.view);
                mConfigurableTexts.remove(row.header);
            }
        }
    }